Accessing LDAP through Netbeans - netbeans

I'm new to LDAP and was wondering if I could access my LDAP entries using JNDI library in netbeans?
I tried using the code snippets given on the internet but I'm receiving this error:
javax.naming.CommunicationException: mydomain.com :389 [Root exception is java.net.UnknownHostException

Related

Failed to read challenge file [Caused by java.io.FileNotFoundException: /jboss/standalone/tmp/auth/local4123__.challenge (No such file or directory)

I am trying to connect two machines both running JBoss EAP 7.1.0 using a JMS bridge. Machine 1 is to act as a web server and has a WAR file deployed which is accessible, and Machine 2 is to act as the app server and has all the necessary components deployed just fine.
This is the error I am receiving:
WARN [org.apache.activemq.artemis.jms.bridge] (ServerService Thread Pool -- 72) AMQ342010: Failed to connect JMS Bridge N/A: javax.naming.CommunicationException: WFNAM00018: Failed to connect to remote host [Root exception is javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:
JBOSS-LOCAL-USER: javax.security.sasl.SaslException: ELY05128: [JBOSS-LOCAL-USER] Failed to read challenge file [Caused by java.io.FileNotFoundException: /.../.../jboss/standalone/tmp/auth/local3093626581916142639.challenge (No such file or directory)]]
at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNaming(RemoteNamingProvider.java:110)
at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNaming(RemoteNamingProvider.java:53)
at org.wildfly.naming.client.NamingProvider.getPeerIdentityForNamingUsingRetry(NamingProvider.java:105)
at org.wildfly.naming.client.remote.RemoteNamingProvider.getPeerIdentityForNamingUsingRetry(RemoteNamingProvider.java:91)
at org.wildfly.naming.client.remote.RemoteContext.lambda$lookupNative$0(RemoteContext.java:189)
at org.wildfly.naming.client.NamingProvider.performExceptionAction(NamingProvider.java:222)
at org.wildfly.naming.client.remote.RemoteContext.performWithRetry(RemoteContext.java:100)
at org.wildfly.naming.client.remote.RemoteContext.lookupNative(RemoteContext.java:188)
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:74)
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:60)
at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:144)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at org.apache.activemq.artemis.jms.bridge.impl.JNDIFactorySupport.createObject(JNDIFactorySupport.java:46)
at org.apache.activemq.artemis.jms.bridge.impl.JNDIDestinationFactory.createDestination(JNDIDestinationFactory.java:32)
at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.setupJMSObjects(JMSBridgeImpl.java:1072)
at org.apache.activemq.artemis.jms.bridge.impl.JMSBridgeImpl.start(JMSBridgeImpl.java:398)
at org.wildfly.extension.messaging.activemq.jms.bridge.JMSBridgeService.startBridge(JMSBridgeService.java:114)
at org.wildfly.extension.messaging.activemq.jms.bridge.JMSBridgeService$1.run(JMSBridgeService.java:84)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
The connection to the target machine (application server) is being made as the path to JBoss is that of the path on the machine, which I verified by testing with a Windows application server environment and the path was the correct Windows path to the directory where the challenge file should be, so clearly the connection is being made as the directories are being accessed. However, the .challenge file isn't present each time which understandably causes the error message.
I have scoured SO and JBoss forums for days now and nothing is resolving my issue.
I saw this post: JBOSS-LOCAL-USER: javax.security.sasl.SaslException: Failed to read server challenge
This is the same issue that I am facing, but the answer which was marked as correct doesn't help me very much. The solution, in this case, was to replace the default ApplicationRealm with a JAAS realm, but I do not know if this is what I need, and I certainly do not currently have one. I did research it, but it seemed to not be applicable to my setup, but I could be wrong.
I also tried this solution: https://access.redhat.com/solutions/3209281 (Subscription only access)
This solution was to remove default-user="$local" from here:
<security-realm name="ApplicationRealm">
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
I did this to both standalone-full.xml files on both machines, and it appeared to make no difference at all.
I have created application users on both machines and given them superuser privileges through the JBoss console as I figured it was probably an issue with permissions when trying to write the file but this too was to no avail. I have also verified that both user credentials are correct.
The workaround was to switch to using a core bridge instead of a JMS bridge, as per the recommendation from Justin in the comments.

Remote Invocation of EJB in WildFly 10 using JNDI lookup

Im trying to invoke an EJB from a remote server using JNDI lookup, Im using EJB3 with Spring-MVC in WildFly 10 and the configuration guided in this documentation has been done in my client and remote server
https://docs.jboss.org/author/display/WFLY10/EJB+invocations+from+a+remote+client+using+JNDI
But still I'm not able to get the connection of remote server.
1) Created a user under ApplicationRealm and gave the permissions for master slave setup for remote EJB Invocation.
2) This is my jboss-ejb-client.properties file, Here I have given the wildfly User_Name and Password of Host server.
endpoint.name=client-endpoint
remote.connections=one, two
remote.connection.one.host=172.16.25.26
remote.connection.one.port=8080
remote.connection.one.username=ABCD
remote.connection.one.password=ABCD#123
remote.connection.two.host=localhost
remote.connection.two.port=8080
remote.connection.two.username=guest
remote.connection.two.username=guest
# org.jboss.as.logging.per-deployment=true
My exception is
javax.naming.AuthenticationException: Failed to connect to any server. Servers tried:
[http-remoting://172.16.25.26:8080 (Authentication failed: all available authentication mechanisms failed:
JBOSS-LOCAL-USER: javax.security.sasl.SaslException: Failed to read server challenge [Caused by
java.io.FileNotFoundException: D:\wildfly-10.0.0.Final\standalone\tmp\auth\local3540175271681581878.challenge
(The system cannot find the file specified)]
DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Cannot perform callback to acquire realm,
authentication ID or password [Caused by javax.security.auth.callback.UnsupportedCallbackException])]
[Root exception is javax.security.sasl.SaslException: Authentication failed: all available authentication
mechanisms failed:
Please tell me what am I missing here thats causing this exception and what is the significance of secret-key generated while creating the user in wildfly and where to configure that key

Failed to connect to localhost orientdb using jdbc

I'm using OrientDB 2.1.9 and has created plocal graph database called 'TimespentEvents'.
When trying to connect from Java using JDBC driver in the same machine with URL 'jdbc:orient:remote:localhost/TimespentEvents' and user/password admin/admin I encounter the following exception:
Caused by: com.orientechnologies.orient.core.exception.OConfigurationException: Error on opening database: the engine 'remote' was not found. URL was: remote:localhost/TimespentEvents. Registered engines are: [plocal, memory]
When changing the URL into 'jdbc:orient:plocal:TimespentEvents' the error turns into:
Caused by: com.orientechnologies.orient.core.exception.OStorageException: Cannot open the storage 'TimespentEvents' because it does not exist in path: localhost/TimespentEvents
Below is the jdbc driver jars I include in the classpath:
orientdb-jdbc-2.1.9.jar
orientdb-core-2.1.9.jar
Any help would be greatly appreciated.
Thanks & Regards,
Setya
Turns out I have to include 2 additional jars:
orientdb-enterprise-2.1.9.jar
orientdb-client-2.1.9.jar
Thanks & Regards,
Setya

Can't log into workbench

I deployed kie-drools-wb-distribution-wars-6.1.0.Final-jboss-as7.0.war into a JBoss 6.3 AS, and added an admin user in the application realm using the add-user.sh command. The login page of KIE Workbench can display, but when I click the login button, the following error occurs:
BWEB000065: HTTP Status 400 - JBWEB000006: Invalid direct reference to
form login page
JBWEB000309: type JBWEB000067: Status report
JBWEB000068: message JBWEB000006: Invalid direct reference to form
login page
JBWEB000069: description JBWEB000120: The request sent by the client
was syntactically incorrect.
JBoss Web/7.4.8.Final-redhat-4
I also deployed the Tomcat version, the login page failed to authenticate the user login with the following errors:
HTTP Status 500 - Filter execution threw an exception type
Exception report message
Filter execution threw an exception description
The server encountered an internal error that prevented it from fulfilling this request.
exception javax.servlet.ServletException: Filter execution threw an exception
root cause java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContext
org.uberfire.security.server.auth.source.JACCAuthenticationSource.getSubjectFrom‌​Container(JACCAuthenticationSource.java:155)
org.uberfire.security.server.auth.source.JACCAuthenticationSource.loadRoles(JACC‌​AuthenticationSource.java:88)
org.uberfire.security.server.auth.HttpAuthenticationManager.authenticate(HttpAut‌​henticationManager.java:178)
org.uberfire.security.server.HttpSecurityManagerImpl.authenticate(HttpSecurityMa‌​nagerImpl.java:216)
org.uberfire.security.server.UberFireSecurityFilter.authenticate(UberFireSecurit‌​yFilter.java:337) org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFil‌​ter.java:278)
root cause java.lang.ClassNotFoundException: javax.security.jacc.PolicyContext org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:17‌​20)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:15‌​71)
org.uberfire.security.server.auth.source.JACCAuthenticationSource.getSubjectFrom‌​Container(JACCAuthenticationSource.java:155)
org.uberfire.security.server.auth.source.JACCAuthenticationSource.loadRoles(JACC‌​AuthenticationSource.java:88)
org.uberfire.security.server.auth.HttpAuthenticationManager.authenticate(HttpAut‌​henticationManager.java:178)
org.uberfire.security.server.HttpSecurityManagerImpl.authenticate(HttpSecurityMa‌​nagerImpl.java:216)
org.uberfire.security.server.UberFireSecurityFilter.authenticate(UberFireSecurit‌​yFilter.java:337)
org.uberfire.security.server.UberFireSecurityFilter.doFilter(UberFireSecurityFil‌​ter.java:278)
That is because you have not download the KIE Execution Server, please download this: https://download.jboss.org/drools/release/6.5.0.Final/kie-server-distribution-6.5.0.Final.zip. Put it in the tomcat webapps folder, and config the setenv.sh like this:
CATALINA_OPTS="-Xmx512M -XX:MaxPermSize=512m -Dbtm.root=$CATALINA_HOME
-Dorg.jbpm.cdi.bm=java:comp/env/BeanManager -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties -Djbpm.tsr.jndi.lookup=java:comp/env/TransactionSynchronizationRegistry
-Djava.security.auth.login.config=$CATALINA_HOME/webapps/kie-drools-web/WEB-INF/classes/login.config
-Dorg.kie.server.persistence.ds=java:comp/env/jdbc/jbpm -Dorg.kie.server.persistence.tm=org.hibernate.service.jta.platform.internal.BitronixJtaPlatform
-Dorg.kie.server.id=tomcat-kieserver -Dorg.kie.server.location=http://localhost:8080/kie-server-6.5.0.Final-webc/services/rest/server
-Dorg.kie.server.controller=http://localhost:8080/kie-drools-web/rest/controller
-Dorg.kie.server.user=tomcat -Dorg.kie.server.pwd=tomcat -Dorg.kie.server.controller.user=tomcat -Dorg.kie.server.controller.pwd=tomcat"

Can't find suitable driver

I have a simple application that uses hibernate to work with db. When i check connection and some methods in main method, everything is fine. But when i deploy it on server, it throws
javax.servlet.ServletException: Cant instantiate class: managed.ClientsBean.
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
root cause:
com.sun.faces.mgbean.ManagedBeanCreationException: Cant instantiate class: managed.ClientsBean.
...
root cause:
javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
...
root cause:
org.hibernate.exception.JDBCConnectionException: Could not open connection
root cause
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:5432/project
But I have that driver, in jboss\standalone\deployments too. How can I make jboss see it?
See here:
https://community.jboss.org/wiki/DataSourceConfigurationInAS7
And here
JDBC Postgresql driver on JBoss 7