7 Replies Latest reply on Nov 6, 2015 12:09 AM by jaysensharma

    wildfly-8.1.0.Final: Unable to connect to JNDI port

    qwirkle101

      Hi,

       

       

        I have deployed the jackrabbit webapp in wildfly. When I try to access the repository through the URL - http://localhost:8080/jackrabbit-webapp-2.10.1/, it throws the below error.

       

       

        Failed to connect to any server. Servers tried: [jnp://localhost:1099 (No connection provider for URI scheme "jnp" is installed)]

       

       

        This port is not accessible. How.How n we open this port to access the repository. Any pointers?

       

       

        Here is the init param entry for Repository servlet. Is it the right port for JNDI?

       

       

      <init-param>

                   <param-name>java.naming.provider.url</param-name>

                   <param-value>jnp://localhost:1099</param-value>

               </init-param>

               <init-param>

                   <param-name>java.naming.factory.initial</param-name>

                   <param-value>org.jboss.naming.remote.client.InitialContextFactory</param-value>

              </init-param>

        • 1. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
          jaysensharma

          WildFly does not use "jnp" protocol or jnp port "1099"

          WildFly uses "http-remoting://localhost:8080"

           

          So may be you can try with the following:

           

                   <init-param>
                       <param-name>java.naming.provider.url</param-name>
                       <param-value>http-remoting://localhost:8080</param-value>
                   </init-param>
                   <init-param>
                       <param-name>java.naming.factory.initial</param-name>
                       <param-value>org.jboss.naming.remote.client.InitialContextFactory</param-value>
                  </init-param>
          

          Ideally for local lookup  we can simply use   InitialContext ic - new InitialContext();

          But not sure how Jack Rabbit works.   So please try the above.

           

          See: https://docs.jboss.org/author/display/WFLY8/Remote+JNDI+Reference+Update+Draft

          • 2. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
            wdfink

            Another option is described here EJB invocations from a remote client using JNDI - WildFly 8

            But it seems you migrate from earlier versions, so be aware that there are some changes in behaviour as this is a complete new implementation.

            • 3. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
              qwirkle101

              Thanks for your reply. The above connection error is gone by changing the provider url to http-remoting://localhost:8080... Now I'm getting a different lookup error

               

               

              Error while retrieving repository using JNDI (name=java:/jca/DocumentStore): javax.naming.NameNotFoundException: jca/DocumentStore -- service jboss.naming.context.java.jboss.exported.jca.DocumentStore

               

               

              standalone.xml resource configuration

              ----------------------------

              <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0">

                          <resource-adapters>

                              <resource-adapter id="jackrabbit-jca-2.10.1.rar">

                                  <archive>

                                      jackrabbit-jca-2.10.1.rar

                                  </archive>

                                  <transaction-support>XATransaction</transaction-support>

                                  <connection-definitions>

                                      <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:/jca/DocumentStore" enabled="true" pool-name="RabbitAdapter">

                                          <config-property name="ConfigFile">

                                              C:\wildfly-8.1.0.Final\repository\repository.xml

                                          </config-property>

                                          <config-property name="HomeDir">

                                              C:\wildfly-8.1.0.Final\repository

                                          </config-property>

                                          <security>

                                              <application/>

                                          </security>

                                          <validation>

                                              <background-validation>false</background-validation>

                                          </validation>

                                      </connection-definition>

                                  </connection-definitions>

                              </resource-adapter>

                          </resource-adapters>

                      </subsystem>

              • 4. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
                jaysensharma

                As you mentioned that you are getting this Error while retrieving repository using JNDI.

                 

                So can you please post the complete Error stackTrace?

                Also please share the code which is trying to perform the JNDI lookup?

                • 5. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
                  jaysensharma

                  The ERROR which you are getting is as

                   

                  javax.naming.NameNotFoundException: jca/DocumentStore -- service jboss.naming.context.java.jboss.exported.jca.DocumentStore
                  

                   

                  Notice the part "exported" there. Which means you are trying to lookup the "org.apache.jackrabbit.jca.JCAManagedConnectionFactory" remotely.

                   

                  But you have given the JNDI name without the "java:jboss/exported" prefix so you can not access that JNDI name remotely (Means out  side of that JVM)

                   

                  So if you want to look up that connection factory remotely (out side of the JVM) then can you try changing the JNDI name as following:

                   

                   

                  <subsystem xmlns="urn:jboss:domain:resource-adapters:2.0">
                              <resource-adapters>
                                  <resource-adapter id="jackrabbit-jca-2.10.1.rar">
                                      <archive>
                                          jackrabbit-jca-2.10.1.rar
                                      </archive>
                                      <transaction-support>XATransaction</transaction-support>
                                      <connection-definitions>
                                          <connection-definition class-name="org.apache.jackrabbit.jca.JCAManagedConnectionFactory" jndi-name="java:jboss/exported/jca/DocumentStore" enabled="true" pool-name="RabbitAdapter">
                                              <config-property name="ConfigFile">
                  

                   

                  Notice the JNDI name is changed ""java:jboss/exported/jca/DocumentStore""

                  • 6. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
                    qwirkle101

                    It didn't work    .getting the below error

                     

                    same as How to remote lookup resource adapter in Jboss 7.1.0.Final?

                     

                    at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_67]

                    Caused by: java.io.NotSerializableException: org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl

                    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:892) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1064) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1020) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:999) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:886) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1064) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1020) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:886) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.naming.remote.protocol.v1.Protocol$1$2.write(Protocol.java:138) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.naming.remote.protocol.v1.WriteUtil.write(WriteUtil.java:61) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:128) [jboss-client.jar:8.1.0.Final]
                    at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) [jboss-client.jar:8.1.0.Final]
                    ... 3 more

                    Caused by: an exception which occurred:

                    in field cachedConnectionManager
                    in field cm
                    in object org.apache.jackrabbit.jca.JCARepositoryHandle@4e06b46f
                    • 7. Re: wildfly-8.1.0.Final: Unable to connect to JNDI port
                      jaysensharma

                      Yes, thats true that class "org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl" is intentionally not marked as Serializable. So it means that the remote lookups for resource adapters are not designed.