5 Replies Latest reply on Mar 26, 2007 7:38 AM by hmrizin

    Problem with Context

    hmrizin

      Hi,

      I am having problems with the javax.naming.InitialContext that the JBossESB refers to. In one of my action classes i am creating a new Context and setting it to refer to Oracle 10g Server for EJB lookup.
      After the action class returns I am trying to perform Static Router Action. But now the ESB tries to retrieve the registry information with the Context information that I set for the Oracle 10g Server.

      I even tried resetting the Context back in the Action class once my EJB lookup is over. But I am still getting the same error.

      The following is the jboss-esb.xml that i am using.
      I am having two services, Service #1 and Service#2.
      The Service #1 has four actions and Service #2 has only one action.
      The execution goes like this.
      Service #1 Action #1 : No Change in context
      Service #1 Action #2 : Static Router Works Fine
      Service #1 Action #3 : Context changed. EJB lookup done. Context restored.
      Service #1 Action #4 : Static Router throws error


      <?xml version = "1.0" encoding = "UTF-8"?>
      <jbossesb
       xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.xsd"
       parameterReloadSecs="5">
      
       <providers>
       <jms-provider name="JBossMQ"
       connection-factory="ConnectionFactory"
       jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
       jndi-URL="localhost">
      
       <jms-bus busid="ESBRequestGw">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/ESBRequestGwQ" />
       </jms-bus>
       <jms-bus busid="ESBRequestEsb">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/ESBRequestEsbQ" />
       </jms-bus>
       <jms-bus busid="ESBResponseBusGw">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/ESBResponseGwQ" />
       </jms-bus>
       <jms-bus busid="ESBResponseBusEsb">
       <jms-message-filter dest-type="QUEUE" dest-name="queue/ESBResponseEsbQ" />
       </jms-bus>
       </jms-provider>
       </providers>
      
       <services>
       <!-- SERVICE #1-->
       <service category="ESupplyOMSEndPoint" name="ESupplyOMSService" description="ESupply OMS Service">
       <listeners>
       <jms-listener name="ESBRequestGw" busidref="ESBRequestGw" maxThreads="1" is-gateway="true"/>
       <jms-listener name="ESBRequestEsb" busidref="ESBRequestEsb" maxThreads="1"/>
       </listeners>
       <actions>
       <!-- SERVICE #1 ACTION #1 -->
       <action
       name="processSOAction"
       class="fs.proto.esupply.service.ESupplyProcessSOAction"
       process="processSO">
       <property name="exceptionMethod" value="exceptionHandler"/>
       </action>
       <!-- SERVICE #1 ACTION #2 -->
       <action name="routeToNotifyEndPoint" class="org.jboss.soa.esb.actions.StaticRouter">
       <property name="destinations">
       <route-to service-category="NotifyEndPoint" service-name="NotifyService" />
       </property>
       </action>
       <!-- SERVICE #1 ACTION #3 -->
       <action
       name="uploadSOAction"
       class="fsproto.esb.elog.service.ELogUploadSOAction"
       process="uploadSO">
       <property name="exceptionMethod" value="exceptionHandler"/>
       </action>
       <!-- SERVICE #1 ACTION #4 -->
       <action name="routeToNotifyEndPoint" class="org.jboss.soa.esb.actions.StaticRouter">
       <property name="destinations">
       <route-to service-category="NotifyEndPoint" service-name="NotifyService" />
       </property>
       </action>
       </actions>
       </service>
      
       <!-- SERVICE #2 -->
       <service category="NotifyEndPoint" name="NotifyService" description="Notify Service">
       <listeners>
       <jms-listener name="ESBResponseBusEsb" busidref="ESBResponseBusEsb" maxThreads="1" />
       <jms-listener name="ESBResponseBusGw" busidref="ESBResponseBusGw" maxThreads="1" is-gateway="true"/>
       </listeners>
       <actions>
       <!-- SERVICE #2 ACTION #1 -->
       <action
       name="replyJMSClient"
       class="fs.proto.esb.service.ReplyJMSClient"
       process="replyClient">
       <property name="destination" value="ESBResponseGwQ" />
       <property name="exceptionMethod" value="exceptionHandler"/>
       </action>
       </actions>
       </service>
      
       </services>
      
      </jbossesb>
      

      The Error message is
      2007-03-22 21:02:48,663 ERROR [pool-4-thread-1][org.jboss.soa.esb.services.routing.MessageRouter] Could not obtain an EPR from the Registry. Message is not routed. javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
      org.jboss.soa.esb.services.registry.RegistryException: javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:332)
       at org.jboss.soa.esb.services.routing.MessageRouter.deliverMessages(MessageRouter.java:103)
       at org.jboss.soa.esb.actions.StaticRouter.process(StaticRouter.java:66)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:90)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.xml.registry.JAXRException: javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.apache.ws.scout.registry.BusinessQueryManagerImpl.findServices(BusinessQueryManagerImpl.java:663)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:440)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:317)
       ... 10 more
      2007-03-22 21:02:48,679 ERROR [pool-4-thread-1][org.jboss.soa.esb.listeners.message.ActionProcessingPipeline] Process method threw Exception
      java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:90)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.soa.esb.addressing.MalformedEPRException: org.jboss.soa.esb.services.routing.MessageRouterException: Message Could not be delivered due to issues with the Registry. javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.jboss.soa.esb.actions.StaticRouter.process(StaticRouter.java:71)
       ... 8 more
      Caused by: org.jboss.soa.esb.services.routing.MessageRouterException: Message Could not be delivered due to issues with the Registry. javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.jboss.soa.esb.services.routing.MessageRouter.deliverMessages(MessageRouter.java:160)
       at org.jboss.soa.esb.actions.StaticRouter.process(StaticRouter.java:66)
       ... 8 more
      Caused by: org.jboss.soa.esb.services.registry.RegistryException: javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:332)
       at org.jboss.soa.esb.services.routing.MessageRouter.deliverMessages(MessageRouter.java:103)
       ... 9 more
      Caused by: javax.xml.registry.JAXRException: javax.naming.NamingException: Error reading application-client descriptor: No location specified and no suitable instance of the type 'com.foursoft.elog.salesorder.ejb.sls.SalesManager' found for the ejb-ref ejb/EJB_com.foursoft.elog.salesorder.ejb.sls.SalesManagerBean
       at org.apache.ws.scout.registry.BusinessQueryManagerImpl.findServices(BusinessQueryManagerImpl.java:663)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findService(JAXRRegistryImpl.java:440)
       at org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl.findEPRs(JAXRRegistryImpl.java:317)
       ... 10 more
      


      Thanks in Advance
      Hmrizin

        • 1. Re: Problem with Context
          kurtstam

          Did you plug JNDI into the (JAXR)Registry?

          • 2. Re: Problem with Context
            hmrizin

            I am a newb to jbossesb. Can u pls tell me how do i do that? or any docs on that?

            Thanks
            Hmrizin

            • 3. Re: Problem with Context
              marklittle

              Download the distribution and work your way through the various quickstart examples and documentation.

              • 4. Re: Problem with Context
                hmrizin

                Hi Mark/kurt,

                Thanks for ur replies. But i think there has been some misunderstanding. Lemme make it simple. This is my problem.

                I have my esb configured which works fine (including registry lookups) until i change the Context in one of my Action Classes to point to Oracle 10g server as:

                Properties props = new Properties();
                props.load(new FileInputStream("myjndi.properties"));
                Context ctx = new InitialContext(Props);
                
                myjndi.properties file content:
                java.naming.provider.url=ormi://localhost:23792/CoreeLog
                java.naming.factory.initial=com.evermind.server.ApplicationClientInitialContextFactory
                java.naming.security.principal=admin
                java.naming.security.credentials=welcome
                dedicated.connection=true
                


                After this point onwards the Jboss ESB runtime tries lookingup registry on Oracle 10g provider url ormi://localhost:23792/CoreeLog instead of jnp://localhost:1099.

                Hope i have made my problem clear.

                Regards
                Hmrizin



                • 5. Re: Problem with Context
                  hmrizin

                  Hi.

                  The problem was with the System properties which I somehow missed out. I had to reset the System properties as

                  System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
                  System.setProperty("java.naming.provider.url", "jnp://localhost:1099");
                  System.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces");
                  

                  once my ejb lookup is complete.

                  Thanks
                  Hmrizin