JBoss Community

"javax.naming.NameNotFoundException: comp not bound" while doing Entity bean lookup

created by George C in Beginner's Corner - View the full discussion

I have created a 2application.EJB2.

In this application, the Stateful and stateless beans are working just fine.

Created a ejb.jar and deployed on JBoss4.

Created a web project and deployed on JBoss5. this will call the remote EJBs from the ejb jar deployed on JBoss4.

Both the servers on the same machine. CHanged the ports of JBoss5 to make it work on the same machine.

As far as i do lookup of stateless and stateful beans, it works absolutely fine. the moment I do a lookup for entity bean, it gives me the above error in Jboss 4 console.

Prinstacktrace as below:

"

javax.naming.NameNotFoundException: comp not bound

23:33:32,062 ERROR [STDERR]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

23:33:32,062 ERROR [STDERR]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)

23:33:32,062 ERROR [STDERR]     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)

23:33:32,062 ERROR [STDERR]     at org.jnp.server.NamingServer.lookup(NamingServer.java:267)

23:33:32,062 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

23:33:32,062 ERROR [STDERR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

23:33:32,078 ERROR [STDERR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

23:33:32,078 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Method.java:324)

23:33:32,078 ERROR [STDERR]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.Transport$1.run(Transport.java:148)

23:33:32,078 ERROR [STDERR]     at java.security.AccessController.doPrivileged(Native Method)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.Transport.serviceCall(Transport.java:144)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)

23:33:32,078 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:534)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)

23:33:32,078 ERROR [STDERR]     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)

23:33:32,078 ERROR [STDERR]     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)

23:33:32,078 ERROR [STDERR]     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

23:33:32,078 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)

23:33:32,078 ERROR [STDERR]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)

23:33:32,078 ERROR [STDERR]     at javax.naming.InitialContext.lookup(InitialContext.java:351)

23:33:32,078 ERROR [STDERR]     at com.ejb.MyDataUtil.lookupHome(MyDataUtil.java:17)

23:33:32,078 ERROR [STDERR]     at com.ejb.MyDataUtil.getHome(MyDataUtil.java:46)

23:33:32,078 ERROR [STDERR]     at org.apache.jsp.test_jsp._jspService(test_jsp.java:79)

23:33:32,078 ERROR [STDERR]     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

23:33:32,078 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

23:33:32,078 ERROR [STDERR]     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

23:33:32,078 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)

23:33:32,078 ERROR [STDERR]     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)

23:33:32,078 ERROR [STDERR]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

23:33:32,078 ERROR [STDERR]     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

23:33:32,078 ERROR [STDERR]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)

23:33:32,078 ERROR [STDERR]     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)

23:33:32,078 ERROR [STDERR]     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)

23:33:32,078 ERROR [STDERR]     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

23:33:32,078 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:595)"

 

Not sure why.

Also I get couple of errors in the Jboss4 server.log as below.

 

1.> java.sql.SQLException: Table already exists: JMS_MESSAGES in statement [CREATE CACHED TABLE JMS_MESSAGES]

2.> Unable to retrieve orbjavax.management.InstanceNotFoundException: jboss:service=CorbaORB is not registered.( this error comes up in the JBoss5 server.log as well).

 

Additional warning message that pops up in the JBoss5 server.log

1.>  WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.

 

This is my 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><![CDATA[No Description.]]></description>

   <display-name>Generated by XDoclet</display-name>

 

   <enterprise-beans>

 

      <!-- Session Beans -->

      <session >

         <description><![CDATA[An EJB named MyState]]></description>

         <display-name>MyState</display-name>

 

         <ejb-name>MyState</ejb-name>

 

         <home>com.ejb.MyStateHome</home>

         <remote>com.ejb.MyState</remote>

         <local-home>com.ejb.MyStateLocalHome</local-home>

         <local>com.ejb.MyStateLocal</local>

         <ejb-class>com.ejb.MyStateSession</ejb-class>

         <session-type>Stateful</session-type>

         <transaction-type>Container</transaction-type>

 

      </session>

 

      <session >

         <description><![CDATA[An EJB named Advice]]></description>

         <display-name>Advice</display-name>

 

         <ejb-name>Advice</ejb-name>

 

         <home>com.ejb.AdviceHome</home>

         <remote>com.ejb.Advice</remote>

         <local-home>com.ejb.AdviceLocalHome</local-home>

         <local>com.ejb.AdviceLocal</local>

         <ejb-class>com.ejb.AdviceSession</ejb-class>

         <session-type>Stateless</session-type>

         <transaction-type>Container</transaction-type>

 

      </session>

 

     <!--

       To add session beans that you have deployment descriptor info for, add

       a file to your XDoclet merge directory called session-beans.xml that contains

       the <session></session> markup for those beans.

     -->

 

      <!-- Entity Beans -->

      <entity >

         <description><![CDATA[<!-- begin-xdoclet-definition -->]]></description>

 

         <ejb-name>MyData</ejb-name>

 

         <home>com.ejb.MyDataHome</home>

         <remote>com.ejb.MyData</remote>

         <local-home>com.ejb.MyDataLocalHome</local-home>

         <local>com.ejb.MyDataLocal</local>

 

         <ejb-class>com.ejb.MyDataBean</ejb-class>

         <persistence-type>Container</persistence-type>

         <prim-key-class>java.lang.String</prim-key-class>

         <reentrant>False</reentrant>

         <cmp-version>2.x</cmp-version>

         <abstract-schema-name>mySQL</abstract-schema-name>

         <cmp-field >

            <description><![CDATA[<!-- begin-user-doc --> CMP Field testNumber Returns the testNumber]]></description>

            <field-name>testNumber</field-name>

         </cmp-field>

         <cmp-field >

            <description><![CDATA[<!-- begin-user-doc --> CMP Field firstName Returns the firstName]]></description>

            <field-name>firstName</field-name>

         </cmp-field>

         <cmp-field >

            <description><![CDATA[<!-- begin-user-doc --> CMP Field lastName Returns the lastName]]></description>

            <field-name>lastName</field-name>

         </cmp-field>

         <cmp-field >

            <description><![CDATA[<!-- begin-user-doc --> CMP Field cityName Returns the cityName]]></description>

            <field-name>cityName</field-name>

         </cmp-field>

         <primkey-field>testNumber</primkey-field>

 

         <query>

            <query-method>

               <method-name>findAll</method-name>

               <method-params>

               </method-params>

            </query-method>

            <ejb-ql><![CDATA[SELECT OBJECT(a) FROM mySQL as a]]></ejb-ql>

         </query>

      <!-- Write a file named ejb-finders-MyDataBean.xml if you want to define extra finders. -->

 

      </entity>

 

     <!--

       To add entity beans that you have deployment descriptor info for, add

       a file to your XDoclet merge directory called entity-beans.xml that contains

       the <entity></entity> markup for those beans.

     -->

 

      <!-- Message Driven Beans -->

     <!--

       To add message driven beans that you have deployment descriptor info for, add

       a file to your XDoclet merge directory called message-driven-beans.xml that contains

       the <message-driven></message-driven> markup for those beans.

     -->

 

   </enterprise-beans>

 

   <!-- Relationships -->

 

   <!-- Assembly Descriptor -->

     <!--

       To specify your own assembly descriptor info here, add a file to your

       XDoclet merge directory called assembly-descriptor.xml that contains

       the <assembly-descriptor></assembly-descriptor> markup.

     -->

 

   <assembly-descriptor >

     <!--

       To specify additional security-role elements, add a file in the merge

       directory called ejb-security-roles.xml that contains them.

     -->

 

   <!-- method permissions -->

     <!--

       To specify additional method-permission elements, add a file in the merge

       directory called ejb-method-permissions.ent that contains them.

     -->

 

   <!-- transactions -->

     <!--

       To specify additional container-transaction elements, add a file in the merge

       directory called ejb-container-transactions.ent that contains them.

     -->

 

   <!-- finder transactions -->

 

   <!-- message destinations -->

     <!--

       To specify additional message-destination elements, add a file in the merge

       directory called ejb-message-destinations.ent that contains them.

     -->

 

   <!-- exclude list -->

     <!--

       To specify an exclude-list element, add a file in the merge directory

       called ejb-exclude-list.xml that contains it.

     -->

   </assembly-descriptor>

 

</ejb-jar>

 

this is my jboss.xml

 

<?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>MyData</ejb-name>

         <jndi-name>MyData</jndi-name>

         <local-jndi-name>MyDataLocal</local-jndi-name>

 

        <method-attributes>

        </method-attributes>

 

      </entity>

 

      <session>

         <ejb-name>MyState</ejb-name>

         <jndi-name>MyState</jndi-name>

         <local-jndi-name>MyStateLocal</local-jndi-name>

 

        <method-attributes>

        </method-attributes>

      </session>

      <session>

         <ejb-name>Advice</ejb-name>

         <jndi-name>Advice</jndi-name>

         <local-jndi-name>AdviceLocal</local-jndi-name>

 

        <method-attributes>

        </method-attributes>

      </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>

 

this is the jbosscmp-jdbc.xml

 

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

<!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">

 

<jbosscmp-jdbc>

   <defaults>

   </defaults>

 

   <enterprise-beans>

 

     <!--

       To add beans that you have deployment descriptor info for, add

       a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml

       that contains the <entity></entity> markup for those beans.

     -->

 

      <entity>

         <ejb-name>MyData</ejb-name>

         <datasource>java:/MySqlDS</datasource>

         <datasource-mapping>mySQL</datasource-mapping>

         <create-table>false</create-table>

         <remove-table>false</remove-table>

         <table-name>testtable</table-name>

 

         <cmp-field>

            <field-name>testNumber</field-name>

            <read-only>false</read-only>

            <column-name>testNumber</column-name>

            <jdbc-type>VARCHAR</jdbc-type>

            <sql-type>INT</sql-type>

            <auto-increment/>

        </cmp-field>

         <cmp-field>

            <field-name>firstName</field-name>

            <read-only>false</read-only>

            <column-name>firstName</column-name>

 

            <jdbc-type>VARCHAR</jdbc-type>

            <sql-type>VARCHAR(0)</sql-type>

 

        </cmp-field>

         <cmp-field>

            <field-name>lastName</field-name>

            <read-only>false</read-only>

            <column-name>lastName</column-name>

 

            <jdbc-type>VARCHAR</jdbc-type>

            <sql-type>VARCHAR(0)</sql-type>

 

        </cmp-field>

         <cmp-field>

            <field-name>cityName</field-name>

            <read-only>false</read-only>

            <column-name>cityName</column-name>

 

            <jdbc-type>VARCHAR</jdbc-type>

            <sql-type>VARCHAR(0)</sql-type>

 

        </cmp-field>

<entity-command name="mysql-get-generated-keys"

class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCMySQLCreateCommand"/>

 

<!-- jboss 3.2 features -->

<!-- optimistic locking does not express the exclusions needed -->

      </entity>

 

   </enterprise-beans>

 

</jbosscmp-jdbc>

 

Kindly guide.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community