8 Replies Latest reply on Feb 25, 2008 9:58 AM by Allan Oliveira

    ejb application

    Allan Oliveira Newbie

      Hi guys...

      Im trying to do a ejb application... Im using xDoclet to generate xml, well i have a entity and session bean (class SitesBean extends EntityBean and SitesSBBean extends SessionBean)

      for entitybeans i generated local and local home interface e for sessionbean generated remote and home interface

      when i deployed on jboss, i got the error
      SitesSB cannot be Bound, doesn't have local and local home interfaces

      sorry for my poor english

        • 1. Re: ejb application
          jaikiran pai Master

          Which version of JBoss and Java do you use? Post the entire exception stacktrace and the contents of your jboss.xml file.

          While posting, remember to wrap the contents in a code block using the Code button in the message editor window.

          • 2. Re: ejb application
            Allan Oliveira Newbie

            Hi jaikiran,

            Im using jboss 4.2.2 and java 1.6

            Stacktrace:
            javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]

            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>Sites</ejb-name>
             <local-jndi-name>SitesLocal</local-jndi-name>
            
             <method-attributes>
             </method-attributes>
            
             </entity>
            
             <session>
             <ejb-name>SitesSB</ejb-name>
             <jndi-name>SitesSB</jndi-name>
            
             <resource-ref>
             <res-ref-name>jdbc/APAESP</res-ref-name>
             <jndi-name>jdbc/APAESP</jndi-name>
             </resource-ref>
             <resource-ref>
             <res-ref-name>jdbc/MARLIN</res-ref-name>
             <jndi-name>jdbc/MARLIN</jndi-name>
             </resource-ref>
             <resource-ref>
             <res-ref-name>jdbc/GCM2</res-ref-name>
             <jndi-name>jdbc/GCM2</jndi-name>
             </resource-ref>
            
             <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>


            • 3. Re: ejb application
              jaikiran pai Master

               

              Stacktrace:
              javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]


              You havent posted the entire exception stacktrace that you see in the logs yet. Going by this one line its difficult to tell why you are seeing this exception. When does this exception occur? When you are deploying your application or when you are accessing the application? Does it occur on the server or on the client from where you invoke the application? This exception usually occurs when you are using an incorrect version of a jar file. Post the entire exception stacktrace. That might help in identifying the problem.

              • 4. Re: ejb application
                Allan Oliveira Newbie

                Full StackTrace:

                javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance]
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:780)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
                 at javax.naming.InitialContext.lookup(Unknown Source)
                 at teste.BeanClient.main(BeanClient.java:22)
                Caused by: java.io.InvalidClassException: org.jboss.invocation.InvokerInterceptor; unable to create instance
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.readObject(Unknown Source)
                 at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
                 at java.io.ObjectInputStream.readExternalData(Unknown Source)
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.readObject(Unknown Source)
                 at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
                 at java.io.ObjectInputStream.readExternalData(Unknown Source)
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.readObject(Unknown Source)
                 at org.jboss.proxy.Interceptor.readExternal(Interceptor.java:80)
                 at java.io.ObjectInputStream.readExternalData(Unknown Source)
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.readObject(Unknown Source)
                 at org.jboss.proxy.ClientContainer.readExternal(ClientContainer.java:156)
                 at java.io.ObjectInputStream.readExternalData(Unknown Source)
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
                 at java.io.ObjectInputStream.readSerialData(Unknown Source)
                 at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
                 at java.io.ObjectInputStream.readObject0(Unknown Source)
                 at java.io.ObjectInputStream.readObject(Unknown Source)
                 at java.rmi.MarshalledObject.get(Unknown Source)
                 at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
                 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:710)
                 ... 3 more
                Caused by: java.lang.reflect.InvocationTargetException
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
                 at java.lang.reflect.Constructor.newInstance(Unknown Source)
                 at java.io.ObjectStreamClass.newInstance(Unknown Source)
                 ... 33 more
                Caused by: java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/SynchronizedLong
                 at org.jboss.util.id.UID.<clinit>(UID.java:56)
                 at org.jboss.util.id.VMID.create(VMID.java:259)
                 at org.jboss.util.id.VMID.getInstance(VMID.java:223)
                 at org.jboss.util.id.GUID.<init>(GUID.java:65)
                 at org.jboss.invocation.Invoker.<clinit>(Invoker.java:55)
                 at org.jboss.invocation.InvokerInterceptor.<init>(InvokerInterceptor.java:61)
                 ... 38 more
                Caused by: java.lang.ClassNotFoundException: EDU.oswego.cs.dl.util.concurrent.SynchronizedLong
                 at java.net.URLClassLoader$1.run(Unknown Source)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at java.net.URLClassLoader.findClass(Unknown Source)
                 at java.lang.ClassLoader.loadClass(Unknown Source)
                 at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
                 at java.lang.ClassLoader.loadClass(Unknown Source)
                 at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                 ... 44 more


                This error happens when i run a ejb client to test the deploy
                Class Client:
                import java.util.Properties;
                import javax.naming.Context;
                import javax.naming.InitialContext;
                
                public class BeanClient {
                
                 public static void main(String[] args) {
                 Properties prop = new Properties();
                 prop.put(Context.INITIAL_CONTEXT_FACTORY,
                 "org.jnp.interfaces.NamingContextFactory");
                 prop.put(Context.PROVIDER_URL, "localhost:1099");
                
                 try {
                 InitialContext ic = new InitialContext(prop);
                
                 Object refLocal = ic.lookup("SitesLocal");
                
                 Object refRemote = ic.lookup("SitesSB");
                
                
                 } catch (Exception e) {
                 e.printStackTrace();
                 }
                 }
                }


                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[Bean implementation class for Enterprise Bean: SitesSB]]></description>
                 <display-name>SitesSB</display-name>
                
                 <ejb-name>SitesSB</ejb-name>
                
                 <home>br.com.gcm.ejb.sb.SitesSBHome</home>
                 <remote>br.com.gcm.ejb.sb.SitesSB</remote>
                 <ejb-class>br.com.gcm.ejb.sb.SitesSBBean</ejb-class>
                 <session-type>Stateless</session-type>
                 <transaction-type>Container</transaction-type>
                
                 <resource-ref >
                 <res-ref-name>jdbc/APAESP</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
                 <res-sharing-scope>Shareable</res-sharing-scope>
                 </resource-ref>
                 <resource-ref >
                 <res-ref-name>jdbc/MARLIN</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
                 <res-sharing-scope>Shareable</res-sharing-scope>
                 </resource-ref>
                 <resource-ref >
                 <res-ref-name>jdbc/GCM2</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
                 <res-sharing-scope>Shareable</res-sharing-scope>
                 </resource-ref>
                
                 </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[Bean implementation class for Enterprise Bean: Sites]]></description>
                
                 <ejb-name>Sites</ejb-name>
                
                 <local-home>br.com.gcm.ejb.cmp.SitesLocalHome</local-home>
                 <local>br.com.gcm.ejb.cmp.SitesLocal</local>
                
                 <ejb-class>br.com.gcm.ejb.cmp.SitesBean</ejb-class>
                 <persistence-type>Container</persistence-type>
                 <prim-key-class>br.com.gcm.ejb.cmp.SitesKey</prim-key-class>
                 <reentrant>False</reentrant>
                 <cmp-version>2.x</cmp-version>
                 <abstract-schema-name>Sites</abstract-schema-name>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: siteid]]></description>
                 <field-name>siteid</field-name>
                 </cmp-field>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: sitename]]></description>
                 <field-name>sitename</field-name>
                 </cmp-field>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: siteimage]]></description>
                 <field-name>siteimage</field-name>
                 </cmp-field>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: siteacronym]]></description>
                 <field-name>siteacronym</field-name>
                 </cmp-field>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: siteprodurl]]></description>
                 <field-name>siteprodurl</field-name>
                 </cmp-field>
                 <cmp-field >
                 <description><![CDATA[Get accessor for persistent attribute: sitehomologurl]]></description>
                 <field-name>sitehomologurl</field-name>
                 </cmp-field>
                
                 <!-- Write a file named ejb-finders-SitesBean.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>
                


                • 5. Re: ejb application
                  jaikiran pai Master

                  In your client's classpath, you have an incorrect version of JBoss jar. Remove the existing JBoss related jars from the client's classpath and place the jbossall-client.jar (which is under %JBOSS_HOME%/client folder) in the client's classpath. Basically, the jars on the client side should be the same as what you have on the server where the EJB is deployed.


                  • 6. Re: ejb application
                    Allan Oliveira Newbie

                    Thankz

                    I replace the bossall-client.jar and located the reference and what about the error log SitesSB cannot be Bound, doesn't have local and local home interfaces on deploy the ejb jar, I need to do anything else ?

                    • 7. Re: ejb application
                      jaikiran pai Master

                       

                      what about the error log SitesSB cannot be Bound, doesn't have local and local home interfaces on deploy the ejb jar, I need to do anything else ?


                      You will have to post that exception stacktrace too. I did not see this exception in any of the stacktraces that you posted so far.

                      • 8. Re: ejb application
                        Allan Oliveira Newbie

                        Well , ejb has been deployed and the class client run ok too. No problem for now, thank a lot, but a i dont understand the reason of program runs normally

                        2008-02-25 11:49:49,156 DEBUG [org.jboss.ejb.plugins.local.BaseLocalProxyFactory] SitesSB cannot be Bound, doesn't have local and local home interfaces
                        2008-02-25 11:49:49,172 DEBUG [org.jboss.proxy.ejb.ProxyFactory] (re-)Binding Home comp/env/ejb/br/com/gcm/ejb/sb/SitesSB
                        2008-02-25 11:49:49,172 INFO [org.jboss.proxy.ejb.ProxyFactory] Bound EJB Home 'SitesSB' to jndi 'comp/env/ejb/br/com/gcm/ejb/sb/SitesSB'
                        2008-02-25 11:49:49,172 DEBUG [org.jboss.system.ServiceController] starting service jboss.j2ee:service=EJB,plugin=pool,jndiName=comp/env/ejb/br/com/gcm/ejb/sb/SitesSB