13 Replies Latest reply on Aug 7, 2006 12:59 AM by jaikiran pai

    javax.naming.NameNotFoundException

    charlie cha Newbie

      When I try to run my EJB project using JBuilder and Jboss 4.xx, I've got the error as below;

      This happened in the line od code :
      Object objRef = initialContext.lookup(jndiName);


      ===================================================
      17:25:25,156 ERROR [[action]] Servlet.service() for servlet action threw exception
      javax.naming.NameNotFoundException: rpc not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1061)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:700)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:716)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at rpc.services.promotion.util.PromotionUtil.lookupHome(PromotionUtil.java:38)
      at rpc.services.promotion.util.PromotionUtil.getLocalHome(PromotionUtil.java:59)
      at rpc.de.web.struts.action.BaseAction.getPromotion(BaseAction.java:69)
      at rpc.de.web.struts.action.signon.LoginAction.doExecute(LoginAction.java:41)
      at rpc.de.web.struts.action.BaseAction.execute(BaseAction.java:64)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:534)

      =======================================================================================

      I also debuged why it happened showing all bound names as below:

      ========================================================================================
      17:25:25,000 INFO [STDOUT] JNDI name : java:/comp/env/ejb/PromotionLocal
      17:25:25,000 INFO [STDOUT] Name:ChequeDataLocal==> CLASS NAME:$Proxy96
      17:25:25,000 INFO [STDOUT] Name:RegionCodeLocal==> CLASS NAME:$Proxy93
      17:25:25,000 INFO [STDOUT] Name:ValidateSubscriberLocal==> CLASS NAME:$Proxy102
      17:25:25,046 INFO [STDOUT] Name:PricePlanLocal==> CLASS NAME:$Proxy104
      17:25:25,046 INFO [STDOUT] Name:QueueConnectionFactory==> CLASS NAME:org.jboss.naming.LinkRefPair
      17:25:25,046 INFO [STDOUT] javax.naming.Context:::Name:HAPartition==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,046 INFO [STDOUT] Name:CreditAppliedLocal==> CLASS NAME:$Proxy112
      17:25:25,046 INFO [STDOUT] Name:ManfDescriptionLocal==> CLASS NAME:$Proxy97
      17:25:25,046 INFO [STDOUT] Name:ValidateSubplanLocal==> CLASS NAME:$Proxy105
      17:25:25,046 INFO [STDOUT] Name:XAConnectionFactory==> CLASS NAME:org.jboss.mq.SpyXAConnectionFactory
      17:25:25,046 INFO [STDOUT] javax.naming.Context:::Name:queue==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,046 INFO [STDOUT] Name:PhoneCodeLocal==> CLASS NAME:$Proxy107
      17:25:25,046 INFO [STDOUT] Name:Treo600DataPlanLocal==> CLASS NAME:$Proxy106
      17:25:25,062 INFO [STDOUT] Name:UUIDKeyGeneratorFactory==> CLASS NAME:org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory
      17:25:25,062 INFO [STDOUT] Name:HiLoKeyGeneratorFactory==> CLASS NAME:org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory
      17:25:25,062 INFO [STDOUT] Name:StagingBlackberryLocal==> CLASS NAME:$Proxy92
      17:25:25,062 INFO [STDOUT] Name:UIL2ConnectionFactory==> CLASS NAME:javax.naming.LinkRef
      17:25:25,062 INFO [STDOUT] Name:UserTransactionSessionFactory==> CLASS NAME:$Proxy52
      17:25:25,062 INFO [STDOUT] Name:CouponsLocal==> CLASS NAME:$Proxy115
      17:25:25,062 INFO [STDOUT] Name:UILXAConnectionFactory==> CLASS NAME:javax.naming.LinkRef
      17:25:25,062 INFO [STDOUT] Name:PrecustomerLocal==> CLASS NAME:$Proxy101
      17:25:25,062 INFO [STDOUT] Name:UndeliverableLocal==> CLASS NAME:$Proxy98
      17:25:25,078 INFO [STDOUT] Name:CouponLocal==> CLASS NAME:$Proxy108
      17:25:25,078 INFO [STDOUT] javax.naming.Context:::Name:console==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,078 INFO [STDOUT] Name:UpdateLocal==> CLASS NAME:$Proxy95
      17:25:25,078 INFO [STDOUT] Name:HTTPXAConnectionFactory==> CLASS NAME:org.jboss.mq.SpyXAConnectionFactory
      17:25:25,078 INFO [STDOUT] Name:ValidatorHelperLocal==> CLASS NAME:$Proxy113
      17:25:25,078 INFO [STDOUT] javax.naming.Context:::Name:topic==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,078 INFO [STDOUT] Name:StagingLocal==> CLASS NAME:$Proxy110
      17:25:25,078 INFO [STDOUT] Name:SequenceSessionLocal==> CLASS NAME:$Proxy114
      17:25:25,078 INFO [STDOUT] Name:RogerspriceplanLocal==> CLASS NAME:$Proxy89
      17:25:25,078 INFO [STDOUT] Name:RebateMailDateLocal==> CLASS NAME:$Proxy99
      17:25:25,078 INFO [STDOUT] Name:ProvinceLocal==> CLASS NAME:$Proxy100
      17:25:25,078 INFO [STDOUT] Name:UserTransaction==> CLASS NAME:org.jboss.tm.usertx.client.ClientUserTransaction
      17:25:25,078 INFO [STDOUT] Name:HTTPConnectionFactory==> CLASS NAME:org.jboss.mq.SpyConnectionFactory
      17:25:25,078 INFO [STDOUT] Name:CustomerLocal==> CLASS NAME:$Proxy103
      17:25:25,078 INFO [STDOUT] Name:SequenceLocal==> CLASS NAME:$Proxy94
      17:25:25,093 INFO [STDOUT] javax.naming.Context:::Name:HASessionState==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,093 INFO [STDOUT] Name:UIL2XAConnectionFactory==> CLASS NAME:javax.naming.LinkRef
      17:25:25,093 INFO [STDOUT] Name:NoteLocal==> CLASS NAME:$Proxy111
      17:25:25,093 INFO [STDOUT] Name:PromoCodeLocal==> CLASS NAME:$Proxy109
      17:25:25,093 INFO [STDOUT] javax.naming.Context:::Name:invokers==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,093 INFO [STDOUT] Name:EventDispatcher==> CLASS NAME:org.jboss.ws.eventing.mgmt.DispatcherDelegate
      17:25:25,093 INFO [STDOUT] Name:UILConnectionFactory==> CLASS NAME:javax.naming.LinkRef
      17:25:25,093 INFO [STDOUT] javax.naming.Context:::Name:jmx==> CLASS NAME:org.jnp.interfaces.NamingContext
      17:25:25,093 INFO [STDOUT] Name:PromotionLocal==> CLASS NAME:$Proxy116
      17:25:25,093 INFO [STDOUT] Name:AccountLocal==> CLASS NAME:$Proxy90
      17:25:25,109 INFO [STDOUT] Name:ConnectionFactory==> CLASS NAME:org.jboss.mq.SpyConnectionFactory
      17:25:25,109 INFO [STDOUT] Name:TopicConnectionFactory==> CLASS NAME:org.jboss.naming.LinkRefPair
      17:25:25,109 INFO [STDOUT] Name:StatusCodeLocal==> CLASS NAME:$Proxy91
      =============================================================

        • 1. Re: javax.naming.NameNotFoundException
          Peter Johnson Master

          What is the value of jndiName that was passed to lookup()? According to the stack trace:

          javax.naming.NameNotFoundException: rpc not bound

          This means that one components of the name being looked up contains the term 'rpc'. I searched through the bound names that were printed out and none of them contain 'rpc'.

          • 2. Re: javax.naming.NameNotFoundException
            charlie cha Newbie

            Thank you for your auick reply.

            The rpc is the project name which means rpc.jar file.
            Actually I'm looking for ejb/PromotionLocal bound name as you see the second error message as below:

            ================================
            17:25:25,000 INFO [STDOUT] JNDI name : java:/comp/env/ejb/PromotionLocal
            ================================

            rpc is just project name and jar file name but not name bound.

            • 3. Re: javax.naming.NameNotFoundException
              jaikiran pai Master

              If you are looking up the PromotionLocal bean then your jndiName should be java:comp/env/ejb/PromotionLocal and your code should look like:

              String jndiName = "java:comp/env/ejb/PromotionLocal";
              Object objRef = initialContext.lookup(jndiName);




              • 4. Re: javax.naming.NameNotFoundException
                charlie cha Newbie

                I tried as you mentioned but same result.

                String jndiName = "java:comp/env/ejb/PromotionLocal";


                • 5. Re: javax.naming.NameNotFoundException
                  jaikiran pai Master

                  Re-read your first post and this should be the correct thing:

                  String jndiName = "PromotionLocal";
                  Object objRef = initialContext.lookup(jndiName);


                  Your bean is bound in global jndi namespace.

                  Try it out.

                  • 6. Re: javax.naming.NameNotFoundException
                    charlie cha Newbie

                    I tried as you said and then now I have different error message

                    =====================
                    java.lang.ClassCastException
                    =====================
                    in

                    cachedLocalHome = (rpc.services.promotion.interfaces.PromotionLocalHome)
                     lookupHome(new java.util.Hashtable(), rpc.services.promotion.interfaces.PromotionLocalHome.COMP_NAME,
                     rpc.services.promotion.interfaces.PromotionLocalHome.class);


                    • 7. Re: javax.naming.NameNotFoundException
                      jaikiran pai Master

                      To make things clear, lets do the following:

                      - Post the exact contents of your ejb-jar.xml and jboss.xml
                      - Post the exact code that you are using to lookup the bean(the reason i mention this is, i see that you are using the constant COMP_NAME during lookup whose value is different from what i had asked you to use in my previous post)
                      - Then post the entire exception stack trace that you are seeing.

                      From the command prompt run the following command and post the output:

                      jar -tf rpc.jar


                      This will display the contents of your jar file.

                      Right now, without all these information, i can only *guess* that the object returned from the lookup is an instance of remote home of the Promotion bean and not a local home instance(just a wild guess) resulting in a ClassCastException. Posting the above mentioned files will help in identifying the issue.





                      • 8. Re: javax.naming.NameNotFoundException
                        charlie cha Newbie

                        I cant's show all codes because it is too many.
                        I just grabed some parts for you as below:


                        In rpc.jar

                        META-INF/ejb-jar.xml
                        META-INF/jboss.xml
                        .
                        .
                        .
                        
                        rpc/services/promotion/interfaces/PromotionLocal.class
                        rpc/services/promotion/interfaces/PromotionLocalHome.class
                        


                        Some parts in ejb-jar.xml
                         <session >
                         <description><![CDATA[]]></description>
                         <ejb-name>Promotion</ejb-name>
                         <local-home>rpc.services.promotion.interfaces.PromotionLocalHome</local-home>
                         <local>rpc.services.promotion.interfaces.PromotionLocal</local>
                         <ejb-class>rpc.services.promotion.ejb.PromotionSession</ejb-class>
                         <session-type>Stateless</session-type>
                         <transaction-type>Container</transaction-type>
                         <ejb-local-ref >
                         .
                         .
                         .
                         </ejb-local-ref>
                         </session >
                        

                        some part in jboss.xml
                         <session>
                         <ejb-name>Promotion</ejb-name>
                         <local-jndi-name>PromotionLocal</local-jndi-name>
                         <resource-ref>
                         .
                         .
                         .
                         </resource-ref>
                         </session>
                        


                        some parts in web-xml
                        <web-app>
                         <ejb-local-ref >
                         <ejb-ref-name>ejb/PromotionLocal</ejb-ref-name>
                         <ejb-ref-type>Session</ejb-ref-type>
                         <local-home>rpc.services.promotion.interfaces.PromotionLocalHome</local-home>
                         <local>rpc.services.promotion.interfaces.PromotionLocal</local>
                         <ejb-link>Promotion</ejb-link>
                         </ejb-local-ref>
                        </web-app>
                        



                        • 9. Re: javax.naming.NameNotFoundException
                          charlie cha Newbie

                          I forgot to show the entire exception stack trace:

                          
                          12:19:06,406 INFO [STDOUT] JNDI name : PromotionLocal
                          12:19:06,406 INFO [STDOUT] Name:ChequeDataLocal==> CLASS NAME:$Proxy96
                          12:19:06,406 INFO [STDOUT] Name:RegionCodeLocal==> CLASS NAME:$Proxy93
                          12:19:06,406 INFO [STDOUT] Name:ValidateSubscriberLocal==> CLASS NAME:$Proxy102
                          12:19:06,437 INFO [STDOUT] Name:PricePlanLocal==> CLASS NAME:$Proxy104
                          12:19:06,437 INFO [STDOUT] Name:QueueConnectionFactory==> CLASS NAME:org.jboss.naming.LinkRefPair
                          12:19:06,437 INFO [STDOUT] javax.naming.Context:::Name:HAPartition==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,437 INFO [STDOUT] Name:CreditAppliedLocal==> CLASS NAME:$Proxy112
                          12:19:06,437 INFO [STDOUT] Name:ManfDescriptionLocal==> CLASS NAME:$Proxy97
                          12:19:06,437 INFO [STDOUT] Name:ValidateSubplanLocal==> CLASS NAME:$Proxy105
                          12:19:06,437 INFO [STDOUT] Name:XAConnectionFactory==> CLASS NAME:org.jboss.mq.SpyXAConnectionFactory
                          12:19:06,437 INFO [STDOUT] javax.naming.Context:::Name:queue==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,437 INFO [STDOUT] Name:PhoneCodeLocal==> CLASS NAME:$Proxy107
                          12:19:06,437 INFO [STDOUT] Name:Treo600DataPlanLocal==> CLASS NAME:$Proxy106
                          12:19:06,453 INFO [STDOUT] Name:UUIDKeyGeneratorFactory==> CLASS NAME:org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory
                          12:19:06,453 INFO [STDOUT] Name:HiLoKeyGeneratorFactory==> CLASS NAME:org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory
                          12:19:06,453 INFO [STDOUT] Name:StagingBlackberryLocal==> CLASS NAME:$Proxy92
                          12:19:06,453 INFO [STDOUT] Name:UIL2ConnectionFactory==> CLASS NAME:javax.naming.LinkRef
                          12:19:06,453 INFO [STDOUT] Name:UserTransactionSessionFactory==> CLASS NAME:$Proxy52
                          12:19:06,453 INFO [STDOUT] Name:CouponsLocal==> CLASS NAME:$Proxy115
                          12:19:06,453 INFO [STDOUT] Name:UILXAConnectionFactory==> CLASS NAME:javax.naming.LinkRef
                          12:19:06,453 INFO [STDOUT] Name:PrecustomerLocal==> CLASS NAME:$Proxy101
                          12:19:06,453 INFO [STDOUT] Name:UndeliverableLocal==> CLASS NAME:$Proxy98
                          12:19:06,468 INFO [STDOUT] Name:CouponLocal==> CLASS NAME:$Proxy108
                          12:19:06,468 INFO [STDOUT] javax.naming.Context:::Name:console==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,468 INFO [STDOUT] Name:UpdateLocal==> CLASS NAME:$Proxy95
                          12:19:06,468 INFO [STDOUT] Name:HTTPXAConnectionFactory==> CLASS NAME:org.jboss.mq.SpyXAConnectionFactory
                          12:19:06,468 INFO [STDOUT] Name:ValidatorHelperLocal==> CLASS NAME:$Proxy113
                          12:19:06,468 INFO [STDOUT] javax.naming.Context:::Name:topic==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,468 INFO [STDOUT] Name:StagingLocal==> CLASS NAME:$Proxy110
                          12:19:06,468 INFO [STDOUT] Name:SequenceSessionLocal==> CLASS NAME:$Proxy114
                          12:19:06,468 INFO [STDOUT] Name:RogerspriceplanLocal==> CLASS NAME:$Proxy89
                          12:19:06,468 INFO [STDOUT] Name:RebateMailDateLocal==> CLASS NAME:$Proxy99
                          12:19:06,468 INFO [STDOUT] Name:ProvinceLocal==> CLASS NAME:$Proxy100
                          12:19:06,468 INFO [STDOUT] Name:UserTransaction==> CLASS NAME:org.jboss.tm.usertx.client.ClientUserTransaction
                          12:19:06,468 INFO [STDOUT] Name:HTTPConnectionFactory==> CLASS NAME:org.jboss.mq.SpyConnectionFactory
                          12:19:06,468 INFO [STDOUT] Name:CustomerLocal==> CLASS NAME:$Proxy103
                          12:19:06,468 INFO [STDOUT] Name:SequenceLocal==> CLASS NAME:$Proxy94
                          12:19:06,484 INFO [STDOUT] javax.naming.Context:::Name:HASessionState==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,484 INFO [STDOUT] Name:UIL2XAConnectionFactory==> CLASS NAME:javax.naming.LinkRef
                          12:19:06,484 INFO [STDOUT] Name:NoteLocal==> CLASS NAME:$Proxy111
                          12:19:06,484 INFO [STDOUT] Name:PromoCodeLocal==> CLASS NAME:$Proxy109
                          12:19:06,484 INFO [STDOUT] javax.naming.Context:::Name:invokers==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,484 INFO [STDOUT] Name:EventDispatcher==> CLASS NAME:org.jboss.ws.eventing.mgmt.DispatcherDelegate
                          12:19:06,484 INFO [STDOUT] Name:UILConnectionFactory==> CLASS NAME:javax.naming.LinkRef
                          12:19:06,484 INFO [STDOUT] javax.naming.Context:::Name:jmx==> CLASS NAME:org.jnp.interfaces.NamingContext
                          12:19:06,484 INFO [STDOUT] Name:PromotionLocal==> CLASS NAME:$Proxy116
                          12:19:06,484 INFO [STDOUT] Name:AccountLocal==> CLASS NAME:$Proxy90
                          12:19:06,500 INFO [STDOUT] Name:ConnectionFactory==> CLASS NAME:org.jboss.mq.SpyConnectionFactory
                          12:19:06,500 INFO [STDOUT] Name:TopicConnectionFactory==> CLASS NAME:org.jboss.naming.LinkRefPair
                          12:19:06,500 INFO [STDOUT] Name:StatusCodeLocal==> CLASS NAME:$Proxy91
                          12:19:06,531 WARN [RequestProcessor] Unhandled Exception thrown: class java.lang.ClassCastException
                          12:19:06,531 ERROR [[action]] Servlet.service() for servlet action threw exception
                          java.lang.ClassCastException
                           at rpc.services.promotion.util.PromotionUtil.getLocalHome(PromotionUtil.java:59)
                           at rpc.de.web.struts.action.BaseAction.getPromotion(BaseAction.java:69)
                           at rpc.de.web.struts.action.signon.LoginAction.doExecute(LoginAction.java:41)
                           at rpc.de.web.struts.action.BaseAction.execute(BaseAction.java:64)
                           at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
                           at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
                           at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
                           at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
                           at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                           at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                           at java.lang.Thread.run(Thread.java:534)
                          


                          • 10. Re: javax.naming.NameNotFoundException
                            charlie cha Newbie

                            Can you help me to work out this stuff ?

                            • 11. Re: javax.naming.NameNotFoundException
                              jaikiran pai Master

                              Sorry, did not notice your earlier replies. Do you have your localhome/bean classes in more than one jars? If yes, remove those duplicate files and maintain them in a single jar. Also, try out the following:

                              - Access http://localhost:8080/jmx-console
                              - Search for "service=JNDIView"
                              - Click on it
                              - On the page that comes up, click on the "Invoke" button beside the list() method.
                              - This will show all the jndinames and the objects(and their types) they are bound to
                              Post the output. Lets see to which object your jndiname corresponds to.

                              • 12. Re: javax.naming.NameNotFoundException
                                charlie cha Newbie

                                I have only one jar file.
                                I grabed all JNDIView lists as below.
                                I hope this help you out to make my project work.

                                Ejb Module: rpc.jar
                                
                                java:comp namespace of the Rogerspriceplan bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Account bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the StatusCode bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the StagingBlackberry bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the RegionCode bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                
                                
                                java:comp namespace of the Sequence bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                
                                
                                java:comp namespace of the Update bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the ChequeData bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                
                                
                                java:comp namespace of the ManfDescription bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Undeliverable bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                
                                
                                java:comp namespace of the RebateMailDate bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Province bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Precustomer bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the ValidateSubscriber bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Customer bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the PricePlan bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the ValidateSubplan bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Treo600DataPlan bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the PhoneCode bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Coupon bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the PromoCode bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Staging bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSession[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Note bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the CreditApplied bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceSessionLocal[link -> SequenceSessionLocal] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the ValidatorHelper bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- ${jndi.queue.order}[link -> queue/order] (class: javax.naming.LinkRef)
                                 | +- jdbc (class: org.jnp.interfaces.NamingContext)
                                 | | +- hunt[link -> java:/hunt] (class: javax.naming.LinkRef)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- RogerspriceplanLocal[link -> RogerspriceplanLocal] (class: javax.naming.LinkRef)
                                 | | +- ValidateSubscriberLocal[link -> ValidateSubscriberLocal] (class: javax.naming.LinkRef)
                                 | | +- StatusCodeLocal[link -> StatusCodeLocal] (class: javax.naming.LinkRef)
                                 | | +- PhoneCodeLocal[link -> PhoneCodeLocal] (class: javax.naming.LinkRef)
                                 | | +- Treo600DataPlanLocal[link -> Treo600DataPlanLocal] (class: javax.naming.LinkRef)
                                 | | +- RegionCodeLocal[link -> RegionCodeLocal] (class: javax.naming.LinkRef)
                                 | | +- ManfDescriptionLocal[link -> ManfDescriptionLocal] (class: javax.naming.LinkRef)
                                 | | +- PricePlanLocal[link -> PricePlanLocal] (class: javax.naming.LinkRef)
                                 | | +- StagingBlackberryLocal[link -> StagingBlackberryLocal] (class: javax.naming.LinkRef)
                                 | | +- ValidateSubplanLocal[link -> ValidateSubplanLocal] (class: javax.naming.LinkRef)
                                 | +- jms (class: org.jnp.interfaces.NamingContext)
                                 | | +- rpc (class: org.jnp.interfaces.NamingContext)
                                 | | | +- QueueConnectionFactory[link -> java:/ConnectionFactory] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the SequenceSession bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- blockSize (class: java.lang.Integer)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- SequenceLocal[link -> SequenceLocal] (class: javax.naming.LinkRef)
                                 | +- retryCount (class: java.lang.Integer)
                                
                                
                                java:comp namespace of the Coupons bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- jdbc (class: org.jnp.interfaces.NamingContext)
                                 | | +- hunt[link -> java:/hunt] (class: javax.naming.LinkRef)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- CouponLocal[link -> CouponLocal] (class: javax.naming.LinkRef)
                                 | +- jms (class: org.jnp.interfaces.NamingContext)
                                 | | +- rpc (class: org.jnp.interfaces.NamingContext)
                                 | | | +- QueueConnectionFactory[link -> java:/ConnectionFactory] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Promotion bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- jdbc (class: org.jnp.interfaces.NamingContext)
                                 | | +- hunt[link -> java:/hunt] (class: javax.naming.LinkRef)
                                 | +- ejb (class: org.jnp.interfaces.NamingContext)
                                 | | +- UpdateLocal[link -> UpdateLocal] (class: javax.naming.LinkRef)
                                 | | +- AccountLocal[link -> AccountLocal] (class: javax.naming.LinkRef)
                                 | | +- RebateMailDateLocal[link -> RebateMailDateLocal] (class: javax.naming.LinkRef)
                                 | | +- NoteLocal[link -> NoteLocal] (class: javax.naming.LinkRef)
                                 | | +- PromoCodeLocal[link -> PromoCodeLocal] (class: javax.naming.LinkRef)
                                 | | +- PhoneCodeLocal[link -> PhoneCodeLocal] (class: javax.naming.LinkRef)
                                 | | +- StagingLocal[link -> StagingLocal] (class: javax.naming.LinkRef)
                                 | | +- UndeliverableLocal[link -> UndeliverableLocal] (class: javax.naming.LinkRef)
                                 | | +- CustomerLocal[link -> CustomerLocal] (class: javax.naming.LinkRef)
                                 | | +- CreditAppliedLocal[link -> CreditAppliedLocal] (class: javax.naming.LinkRef)
                                 | | +- PrecustomerLocal[link -> PrecustomerLocal] (class: javax.naming.LinkRef)
                                 | | +- ChequeDataLocal[link -> ChequeDataLocal] (class: javax.naming.LinkRef)
                                 | | +- ValidatorHelperLocal[link -> ValidatorHelperLocal] (class: javax.naming.LinkRef)
                                 | +- jms (class: org.jnp.interfaces.NamingContext)
                                 | | +- queue (class: org.jnp.interfaces.NamingContext)
                                 | | | +- rpc (class: org.jnp.interfaces.NamingContext)
                                 | | | | +- mail[link -> queue/mail] (class: javax.naming.LinkRef)
                                 | | +- rpc (class: org.jnp.interfaces.NamingContext)
                                 | | | +- QueueConnectionFactory[link -> java:/ConnectionFactory] (class: javax.naming.LinkRef)
                                
                                
                                java:comp namespace of the Mailer bean:
                                
                                 +- HandleDelegate (class: org.jboss.proxy.ejb.handle.HandleDelegateImpl)
                                 +- ORB (class: org.jacorb.orb.ORB)
                                 +- env (class: org.jnp.interfaces.NamingContext)
                                 | +- mail (class: org.jnp.interfaces.NamingContext)
                                 | | +- rpc (class: org.jnp.interfaces.NamingContext)
                                 | | | +- MailSession[link -> java:/Mail] (class: javax.naming.LinkRef)
                                
                                
                                java: Namespace
                                
                                 +- jaas (class: javax.naming.Context)
                                 | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
                                 | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
                                 | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
                                 +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
                                 +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
                                 +- JBossCorbaNaming (class: org.omg.CosNaming.NamingContextExt)
                                 +- hunt (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
                                 +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
                                 +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
                                 +- TransactionManager (class: org.jboss.tm.TxManager)
                                 +- JBossCorbaPOA (class: org.omg.PortableServer.POA)
                                 +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
                                 +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                                 +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
                                 +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                                 +- JBossCorbaInterfaceRepositoryPOA (class: org.omg.PortableServer.POA)
                                 +- Mail (class: javax.mail.Session)
                                 +- JBossCorbaORB (class: org.omg.CORBA.ORB)
                                 +- timedCacheFactory (class: javax.naming.Context)
                                Failed to lookup: timedCacheFactory, errmsg=null
                                 +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
                                 +- comp (class: javax.naming.Context)
                                
                                
                                Global JNDI Namespace
                                
                                 +- ChequeDataLocal (proxy: $Proxy96 implements interface rpc.domain.subscriber.interfaces.ChequeDataLocalHome)
                                 +- RegionCodeLocal (proxy: $Proxy93 implements interface rpc.domain.reference.interfaces.RegionCodeLocalHome)
                                 +- ValidateSubscriberLocal (proxy: $Proxy102 implements interface rpc.domain.subscriber.interfaces.ValidateSubscriberLocalHome)
                                 +- PricePlanLocal (proxy: $Proxy104 implements interface rpc.domain.reference.interfaces.PricePlanLocalHome)
                                 +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
                                 +- HAPartition (class: org.jnp.interfaces.NamingContext)
                                 | +- DefaultPartition (class: org.jboss.ha.framework.server.HAPartitionImpl)
                                 +- CreditAppliedLocal (proxy: $Proxy112 implements interface rpc.domain.subscriber.interfaces.CreditAppliedLocalHome)
                                 +- ManfDescriptionLocal (proxy: $Proxy97 implements interface rpc.domain.reference.interfaces.ManfDescriptionLocalHome)
                                 +- ValidateSubplanLocal (proxy: $Proxy105 implements interface rpc.domain.subscriber.interfaces.ValidateSubplanLocalHome)
                                 +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                                 +- queue (class: org.jnp.interfaces.NamingContext)
                                 | +- A (class: org.jboss.mq.SpyQueue)
                                 | +- testQueue (class: org.jboss.mq.SpyQueue)
                                 | +- mail (class: org.jboss.mq.SpyQueue)
                                 | +- ex (class: org.jboss.mq.SpyQueue)
                                 | +- DLQ (class: org.jboss.mq.SpyQueue)
                                 | +- D (class: org.jboss.mq.SpyQueue)
                                 | +- C (class: org.jboss.mq.SpyQueue)
                                 | +- B (class: org.jboss.mq.SpyQueue)
                                 +- PhoneCodeLocal (proxy: $Proxy107 implements interface rpc.domain.reference.interfaces.PhoneCodeLocalHome)
                                 +- Treo600DataPlanLocal (proxy: $Proxy106 implements interface rpc.domain.subscriber.interfaces.Treo600DataPlanLocalHome)
                                 +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
                                 +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
                                 +- StagingBlackberryLocal (proxy: $Proxy92 implements interface rpc.domain.subscriber.interfaces.StagingBlackberryLocalHome)
                                 +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
                                 +- UserTransactionSessionFactory (proxy: $Proxy52 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
                                 +- CouponsLocal (proxy: $Proxy115 implements interface rpc.services.promotion.interfaces.CouponsLocalHome)
                                 +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
                                 +- PrecustomerLocal (proxy: $Proxy101 implements interface rpc.domain.subscriber.interfaces.PrecustomerLocalHome)
                                 +- UndeliverableLocal (proxy: $Proxy98 implements interface rpc.domain.reference.interfaces.UndeliverableLocalHome)
                                 +- CouponLocal (proxy: $Proxy108 implements interface rpc.domain.coupon.interfaces.CouponLocalHome)
                                 +- console (class: org.jnp.interfaces.NamingContext)
                                 | +- PluginManager (proxy: $Proxy44 implements interface org.jboss.console.manager.PluginManagerMBean)
                                 +- UpdateLocal (proxy: $Proxy95 implements interface rpc.domain.subscriber.interfaces.UpdateLocalHome)
                                 +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
                                 +- ValidatorHelperLocal (proxy: $Proxy113 implements interface rpc.services.promotion.interfaces.ValidatorHelperLocalHome)
                                 +- topic (class: org.jnp.interfaces.NamingContext)
                                 | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
                                 | +- testTopic (class: org.jboss.mq.SpyTopic)
                                 | +- securedTopic (class: org.jboss.mq.SpyTopic)
                                 +- StagingLocal (proxy: $Proxy110 implements interface rpc.domain.staging.interfaces.StagingLocalHome)
                                 +- SequenceSessionLocal (proxy: $Proxy114 implements interface rpc.util.uidgen.interfaces.SequenceSessionLocalHome)
                                 +- RogerspriceplanLocal (proxy: $Proxy89 implements interface rpc.domain.reference.interfaces.RogerspriceplanLocalHome)
                                 +- RebateMailDateLocal (proxy: $Proxy99 implements interface rpc.domain.subscriber.interfaces.RebateMailDateLocalHome)
                                 +- ProvinceLocal (proxy: $Proxy100 implements interface rpc.domain.reference.interfaces.ProvinceLocalHome)
                                 +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
                                 +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                                 +- CustomerLocal (proxy: $Proxy103 implements interface rpc.domain.subscriber.interfaces.CustomerLocalHome)
                                 +- SequenceLocal (proxy: $Proxy94 implements interface rpc.util.uidgen.interfaces.SequenceLocalHome)
                                 +- HASessionState (class: org.jnp.interfaces.NamingContext)
                                 | +- Default (class: org.jboss.ha.hasessionstate.server.HASessionStateImpl)
                                 +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
                                 +- NoteLocal (proxy: $Proxy111 implements interface rpc.domain.subscriber.interfaces.NoteLocalHome)
                                 +- PromoCodeLocal (proxy: $Proxy109 implements interface rpc.domain.reference.interfaces.PromoCodeLocalHome)
                                 +- invokers (class: org.jnp.interfaces.NamingContext)
                                 | +- Charlie_Cha (class: org.jnp.interfaces.NamingContext)
                                 | | +- iiop (class: org.jboss.invocation.iiop.IIOPInvoker)
                                 +- EventDispatcher (class: org.jboss.ws.eventing.mgmt.DispatcherDelegate)
                                 +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
                                 +- jmx (class: org.jnp.interfaces.NamingContext)
                                 | +- invoker (class: org.jnp.interfaces.NamingContext)
                                 | | +- RMIAdaptor (proxy: $Proxy43 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
                                 | +- rmi (class: org.jnp.interfaces.NamingContext)
                                 | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
                                 +- PromotionLocal (proxy: $Proxy116 implements interface rpc.services.promotion.interfaces.PromotionLocalHome)
                                 +- AccountLocal (proxy: $Proxy90 implements interface rpc.domain.signon.interfaces.AccountLocalHome)
                                 +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
                                 +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
                                 +- StatusCodeLocal (proxy: $Proxy91 implements interface rpc.domain.reference.interfaces.StatusCodeLocalHome)
                                


                                • 13. Re: javax.naming.NameNotFoundException
                                  jaikiran pai Master

                                  Apologies for the late reply. If you have got this working, its well and good. If not, then try out the following:

                                  - First of all, the code which you are using:

                                  cachedLocalHome = (rpc.services.promotion.interfaces.PromotionLocalHome) lookupHome(new java.util.Hashtable(), rpc.services.promotion.interfaces.PromotionLocalHome.COMP_NAME, rpc.services.promotion.interfaces.PromotionLocalHome.class);


                                  needs to be changed(just for the time being for debugging this issue) to:

                                  String jndiName = "PromotionLocal";
                                  Object objRef = initialContext.lookup(jndiName);
                                  System.out.println("Lookup successful: " + objRef);
                                  //now do the casting
                                  rpc.services.promotion.interfaces.PromotionLocalHome home = (rpc.services.promotion.interfaces.PromotionLocalHome) objRef;
                                  System.out.println("Casted successfully");


                                  If this does work, then the cause of your ClassCastException might have something to do with the implementation of you lookupHome() method.

                                  If even this does not work, then try out the JMX Console method mentioned at:
                                  http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassCastExceptions
                                  to try and find if the same class is being loaded by multiple classloaders.