0 Replies Latest reply: Jul 23, 2007 1:19 PM by 807605 RSS

    Error in EJB JNDI Binding for EMP Bean

    807605
      Hi friends,
      I need to call a ejb from second ejb ( entity bean from a sission bean). I have defined all xml mapping in ejb.xml.jar and server specific jar file (jboss.xml.jar). I am using boss-4.0.5.GA. But when I am calling that session bean from simple desk top client. It show me this error
      23:48:59,578 ERROR [STDERR] javax.naming.NameNotFoundException: UserLocalHome not bound
      23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      23:48:59,578 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      23:48:59,578 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      23:48:59,578 ERROR [STDERR]      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      23:48:59,578 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      23:48:59,578 ERROR [STDERR]      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      23:48:59,578 ERROR [STDERR]      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      23:48:59,578 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getHome(UserFacadeBean.java:51)
      23:48:59,578 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getAll(UserFacadeBean.java:74)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
      23:48:59,578 ERROR [STDERR]      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      23:48:59,578 ERROR [STDERR]      at org.jboss.ejb.Container.invoke(Container.java:954)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,578 ERROR [STDERR]      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      23:48:59,578 ERROR [STDERR]      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
      23:48:59,578 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,578 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,578 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,578 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      23:48:59,593 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      23:48:59,593 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
      23:48:59,593 ERROR [STDERR] java.lang.NullPointerException
      23:48:59,593 ERROR [STDERR]      at com.ejb.service.UserFacadeBean.getAll(UserFacadeBean.java:75)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237)
      23:48:59,593 ERROR [STDERR]      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
      23:48:59,593 ERROR [STDERR]      at org.jboss.ejb.Container.invoke(Container.java:954)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,593 ERROR [STDERR]      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
      23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      23:48:59,593 ERROR [STDERR]      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
      23:48:59,593 ERROR [STDERR]      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      23:48:59,593 ERROR [STDERR]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      23:48:59,593 ERROR [STDERR]      at java.lang.reflect.Method.invoke(Method.java:585)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      23:48:59,593 ERROR [STDERR]      at java.security.AccessController.doPrivileged(Native Method)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      23:48:59,593 ERROR [STDERR]      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      23:48:59,593 ERROR [STDERR]      at java.lang.Thread.run(Thread.java:595)
      23:48:59,593 INFO [STDOUT] exit from getAll() method.....


      Can any one help me. how can I resolve it. When I see server log. when I found then one of bean is not perperly bind with jndi name. it showing message like this.

      23:48:21,187 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'FtacostManagerBean' to jndi 'local/FtacostManagerBean@27432016'


      It seems like , it unable to bind Manager Bean with local home. but I am not sure. Please help me. how can I resulve it.

      Here I am sending my ejb config files.
      ------------------------------------------------------------------------------------------------
      JBoss.xml.jar

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">

      <jboss>

      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jboss-beans.xml that contains
      the <session></session>, <entity></entity> and <message-driven></message-driven>
      markup for those beans.
      -->

      <entity>
      <ejb-name>UserBean</ejb-name>
      <local-jndi-name>UserLocalHome</local-jndi-name>


      </entity>


           <session>
      <ejb-name>UserFacadeBean</ejb-name>
      <jndi-name>UserFacadeHome</jndi-name>

      <ejb-local-ref>
      <ejb-ref-name>User</ejb-ref-name>
      <local-jndi-name>UserLocalHome</local-jndi-name>
      </ejb-local-ref>
                     
      </session>
           


      <!--
      write a merge file jboss-webservices.ent for webservice-description
      -->

      </enterprise-beans>

      <!--
      To specify your own assembly descriptor info here, add a file to your
      XDoclet merge directory called jboss-assembly-descriptor.xml that contains
      the <assembly-descriptor></assembly-descriptor> markup.
      -->
      <assembly-descriptor>
      <!-- message destinations -->
      <!--
      To specify additional message-destination elements, add a file in the merge
      directory called jboss-message-destinations.ent that contains them.
      -->
      </assembly-descriptor>

      <resource-managers>
      </resource-managers>

      <!--
      | for container settings, you can merge in jboss-container.xml
      | this can contain <invoker-proxy-bindings/> and <container-configurations/>
      -->

      </jboss>

      ------------------------------------------------------------------------------------------------
      ejb-jar.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar >

      <description>Umashankar beans</description>
      <display-name>Programmed by umashnakar</display-name>

      <enterprise-beans>

      <!-- Session Beans -->
      <session>
      <display-name>UserFacade</display-name>
      <ejb-name>UserFacadeBean</ejb-name>
      <home>com.ejb.service.UserFacadeHome</home>
      <remote>com.ejb.service.UserFacadeRemote</remote>
      <ejb-class>com.ejb.service.UserFacadeBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      </session>


      <!-- Entity Beans -->

      <entity>
           <description>User Bean Made by Uma</description>     
           <display-name>This is local user Entity</display-name>
           <ejb-name>UserBean</ejb-name>
           <local-home>com.ejb.persistence.UserLocalHome</local-home>
           
           <local>com.ejb.persistence.UserLocal</local>
           
           
           <ejb-class>com.ejb.persistence.UserLocalBean</ejb-class>
           <persistence-type>Container</persistence-type>
           <prim-key-class>java.lang.Integer</prim-key-class>
           <reentrant>false</reentrant>
           <abstract-schema-name>user</abstract-schema-name>
           
                <cmp-field>
                <field-name>cuId</field-name>
                </cmp-field>
                <cmp-field>
                <field-name>accessCode</field-name>
                </cmp-field>
                <cmp-field>
                <field-name>password</field-name>
                </cmp-field>
                <cmp-field>
                <field-name>creationDate</field-name>
                </cmp-field>
                
                <cmp-field>
                <field-name>siteId</field-name>
                </cmp-field>
                <primkey-field>cuId</primkey-field>
                <query>
                          <description>Query by accessCode</description>
                          <query-method>
                               <method-name>findByAccessCode</method-name>
                               <method-params>
                                    <method-param>java.lang.String</method-param>
                               </method-params>
                          </query-method>                    
                          <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.accessCode = ?1</ejb-ql>
                          
                </query>
                <query>
                          <description>Query by accessCode</description>
                          <query-method>
                               <method-name>findByPassword</method-name>
                               <method-params>
                                    <method-param>java.lang.String</method-param>
                               </method-params>
                          </query-method>
                          <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.password = ?1</ejb-ql>
                </query>
                <query>
                          <description>Query by accessCode</description>
                          <query-method>
                               <method-name>findByCreationDate</method-name>
                               <method-params>
                                    <method-param>java.sql.Timestamp</method-param>
                               </method-params>
                          </query-method>
                          <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.creationDate = ?1</ejb-ql>
                          
                </query>
                <query>
                          <description>Query by accessCode</description>
                          <query-method>
                               <method-name>findBySiteId</method-name>
                               <method-params>
                                    <method-param>java.lang.Integer</method-param>
                               </method-params>
                          </query-method>
                          <ejb-ql>SELECT OBJECT(u) FROM user AS u WHERE u.siteId = ?1</ejb-ql>
                </query>
                <query>
                          <description>Query by accessCode</description>
                          <query-method>
                               <method-name>findAll</method-name>
                               <method-params/>
                          </query-method>
                               <ejb-ql>SELECT OBJECT(u) FROM user AS u </ejb-ql>
                </query>
           
           
      </entity>

      </enterprise-beans>
      <assembly-descriptor >
                <container-transaction>
      <method>
      <ejb-name>UserBean</ejb-name>
      <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
      </container-transaction>

      <container-transaction>
      <method>
      <ejb-name>UserFacadeBean</ejb-name>
      <method-name>*</method-name>
      </method>
      <trans-attribute>Required</trans-attribute>
      </container-transaction>


      </assembly-descriptor>

      </ejb-jar>
      ------------------------------------------------------------------------------------------------

      Please rep[y me on adha.umashankar@gmail.com. I appreciate it if you come on google talk.

      Thanks in Advance.
      UmaShankar(TumoDev)
      Software Engineer