facebook

Wrong COMP_NAME Gen in Local Home Interface – EJB Not Bound

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #198270 Reply

    wilkerd1
    Member

    I am having a problem with the COMP_NAME and JNDI_NAME fields on the LocalHomeInterface that is generated from the XDoclet support. They are incorrect and I cannot figure out how to get them to change (i.e. exactly what Ant task property and/or class level XDoclet attribute needs to be changed and/or added).

    I am using JBoss 3.2.2, Eclipse 2.1.1., and MyEclipse 2.6.1, j2sdk1.4.1_05.

    The JNDIView’s list operation dosen’t even register the bean at the same locations specified in the generated code. I have pasted the output of my JNDIView’s list operation and the stack trace from executing the code below.

    BTW – I have seen quite a few others with the same problem out on the web, however, no one seems to have a definitive answer. The closest answer I have run into is, “add ejb.util at the class level and set its generate attribute to physical”.

    There has to be a better way than this, besides, when I tried the ejb.util generate = “physical” it didn’t work either…same problem ejb not bound except this time it had the name of my bean instead of ejb in the error message.

    I hope all of this makes sense (I am tired and it’s late) and I appreciate any help with this matter.

    Thanks!
    Daniel

    —————————————–
    COMP_NAME and JNDI_NAME Attribute
    Values from the Generated
    LocalHome interface
    —————————————–
    public static final String COMP_NAME=”java:comp/env/ejb/SampleLocal”;
    public static final String JNDI_NAME=”local/SampleLocalHome”;

    —————————————–
    JNDIView List Operation Results:
    —————————————–

    Ejb Module: TestEJB.jar
    java:comp namespace of the Sample bean:
    +- env (class: org.jnp.interfaces.NamingContext)

    Ejb Module: ejb-management.jar
    java:comp namespace of the MEJB bean:
    +- env (class: org.jnp.interfaces.NamingContext)
    | +- Server-Name (class: java.lang.String)

    java: Namespace
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
    +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
    +- DefaultJMSProvider (class: org.jboss.jms.jndi.JBossMQProvider)
    +- comp (class: javax.naming.Context)
    +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- jaas (class: javax.naming.Context)
    | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
    | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
    | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
    +- timedCacheFactory (class: javax.naming.Context)
    Failed to lookup: timedCacheFactory, errmsg=null
    +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
    +- Mail (class: javax.mail.Session)
    +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
    +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
    +- TransactionManager (class: org.jboss.tm.TxManager)

    Global JNDI Namespace
    +- jmx:evelyn1:rmi (class: org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl)
    +- jmx (class: org.jnp.interfaces.NamingContext)
    | +- invoker (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor (proxy: $Proxy20 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor)
    | +- rmi (class: org.jnp.interfaces.NamingContext)
    | | +- RMIAdaptor (class: org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl)
    +- OIL2XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UserTransactionSessionFactory (class: org.jboss.tm.usertx.server.UserTransactionSessionFactoryImpl)
    +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- invokers (class: org.jnp.interfaces.NamingContext)
    | +- evelyn1 (class: org.jnp.interfaces.NamingContext)
    | | +- pooled (class: org.jboss.invocation.pooled.interfaces.PooledInvokerProxy)
    | | +- jrmp (class: org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy)
    | | +- http (class: org.jboss.invocation.http.interfaces.HttpInvokerProxy)
    +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
    +- UILXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- RMIXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- UIL2XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
    +- local (class: org.jnp.interfaces.NamingContext)
    | +- Sample (proxy: $Proxy34 implements interface sample.ejb.SampleLocalHome)
    +- Sample (proxy: $Proxy35 implements interface sample.ejb.SampleHome,interface javax.ejb.Handle)
    +- queue (class: org.jnp.interfaces.NamingContext)
    | +- A (class: org.jboss.mq.SpyQueue)
    | +- testQueue (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)
    +- topic (class: org.jnp.interfaces.NamingContext)
    | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
    | +- testTopic (class: org.jboss.mq.SpyTopic)
    | +- securedTopic (class: org.jboss.mq.SpyTopic)
    +- console (class: org.jnp.interfaces.NamingContext)
    | +- PluginManager (proxy: $Proxy21 implements interface org.jboss.console.manager.PluginManagerMBean)
    +- UIL2ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UILConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- RMIConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- ejb (class: org.jnp.interfaces.NamingContext)
    | +- mgmt (class: org.jnp.interfaces.NamingContext)
    | | +- MEJB (proxy: $Proxy28 implements interface javax.management.j2ee.ManagementHome,interface javax.ejb.Handle)
    +- OIL2ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
    +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)

    —————————————–
    STACK TRACE FROM MY CODE:
    —————————————–

    22:49:33,010 INFO [EARDeployer] Started J2EE application: file:/D:/jboss-3.2.2RC3/server/default/deploy/Test.ear/
    22:49:33,010 INFO [MainDeployer] Deployed package: file:/D:/jboss-3.2.2RC3/server/default/deploy/Test.ear/
    22:50:15,641 INFO [STDOUT] ejb not bound
    22:50:15,641 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:228)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)
    22:50:15,661 ERROR [Engine] —– Root Cause —–
    java.lang.NullPointerException
    at sample.javabeans.BeanTester.getMessage(BeanTester.java:48)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:71)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:228)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
    at java.lang.Thread.run(Thread.java:536)

    #198297 Reply

    support-michael
    Keymaster

    We are researching this now. I’m consulting Scott on this one.

    Michael
    MyEclipse Support

    #198301 Reply

    Scott Anderson
    Participant

    Daniel,

    It seems that you’re simply trying to get an XDoclet configuration that works for your EJB, so I’ll describe some settings below that I use in some of my tests.

    In my test EJB, called TraderBean, I have XDoclet configured like this at the class level:

    
     * @ejb.bean name = "Trader"
     *           type = "Stateless"
     *           display-name = "Trader"
     *           description = "Trader EJB"
     *           view-type = "both"
     *           jndi-name = "ejb/com/genuitec/trader/ejb/TraderHome"
     *           local-jndi-name = "local/ejb/com/genuitec/ejb/TraderHome"
    

    In my project’s XDoclet configuration, I’ve enabled the following:

    
    ejbdoclet
      deployment descriptor
      fileset
      homeinterface
      jboss
      localhomeinterface
      localinterface
      packageSubstitution
      remoteinterface
      session
      utilobject
    

    When I run XDoclet I get the following constants in TraderLocalHome:

    
       public static final String COMP_NAME="java:comp/env/ejb/TraderLocal";
       public static final String JNDI_NAME="local/ejb/com/genuitec/ejb/TraderHome";
    

    In TraderHome I see:

    
       public static final String COMP_NAME="java:comp/env/ejb/Trader";
       public static final String JNDI_NAME="ejb/com/genuitec/trader/ejb/TraderHome";
    

    In TraderUtil, you’ll see that the generated lookups look like this:

    
             javax.naming.InitialContext initialContext = 
                   new javax.naming.InitialContext();
             try {
                java.lang.Object objRef = 
                   initialContext.lookup(
                     com.genuitec.traderx.interfaces.TraderHome.JNDI_NAME);
                cachedRemoteHome = 
                   (com.genuitec.traderx.interfaces.TraderHome) 
                    javax.rmi.PortableRemoteObject.narrow(
                      objRef, 
                      com.genuitec.traderx.interfaces.TraderHome.class);
             } finally {
                initialContext.close();
             }
    

    You can see that it uses the JNDI name from the home interface and that is correct as you can see from this generated jboss.xml deployment descriptor fragment:

    
          <session>
             <ejb-name>Trader</ejb-name>
             <jndi-name>
               ejb/com/genuitec/trader/ejb/TraderHome
             </jndi-name>
             <local-jndi-name>
               local/ejb/com/genuitec/ejb/TraderHome
             </local-jndi-name>
          </session>
    

    Please check your configuration against this and you’ll most likely turn up what’s not working quite right for you.

    –Scott
    MyEclipse Support

    #198325 Reply

    wilkerd1
    Member

    In my project’s XDoclet configuration, I’ve enabled the following:

    Code:

    ejbdoclet
    deployment descriptor
    fileset
    homeinterface
    jboss
    localhomeinterface
    localinterface
    packageSubstitution
    remoteinterface
    session
    utilobject

    Scott, your are 100% correct. I am looking to find an XDoclet config that works and use that as a baseline everytime a create my beans (I am still somewhat new to XDoclet).

    In your Ant tasks (above) what properties do you check for the Trader bean and what values do you use?…Do you leave them at their defaults or do you set the values to something (e.g. destinationDir, Pattern, Extent, etc.)?

    #198328 Reply

    Scott Anderson
    Participant

    In your Ant tasks (above) what properties do you check for the Trader bean and what values do you use?…

    ejbdoclet:
    addedTags: (default)
    destDir: src (because src is my source directory)
    ejbSpec: 2.0
    excludedTags: (default)

    deploymentdescriptor:
    destDir: src/META-INF
    validateXML: true

    fileset:
    dir: src
    includes: **/*.java

    homeinterface:
    <none checked>

    jboss:
    Version: 3.0
    destDir: src/META-INF

    localhomeinterface:
    <none checked>

    localinterface:
    <none checked>

    packageSubstitution:
    packages: ejb (my ejb package ends with .ejb)
    substituteWith: interfaces

    remoteinterface:
    <none checked>

    session:
    <none checked>

    utilobject:
    cacheHomes: true
    includeGUID: true

    –Scott
    MyEclipse Support

    #198407 Reply

    wilkerd1
    Member

    Scott,

    ❓ Why does the COMP_NAME not get registered properly in JBoss when EJBs are deployed using XDoclet? After using your last post as a baseline for comparison, I was able to successfully deploy my bean and make use of the Util object. However, I did have to use ” @ejb.util generate = “physical” ” forcing the lookup to be on the JNDI name instead of the componenet name. Is there a special JBoss tag that needs to be included in my bean’s XDoclet markup?

    Also, I have been using the XDoclet reference in the updated help, but have not been able to find reference information about the JBoss Ant task that has to be included with the StandardEJB doclet when using JBoss (only the JBoss class and method level XDoclet tags). Do you know where I can locate this information (have tried the XDoclet site, but same results)?

    Again thanks for all your help, I appreciate it!

    Cheers,
    Daniel

    #198408 Reply

    Scott Anderson
    Participant

    Daniel,

    I’m not sure about additional tags for the component name. Since I’m looking things up with JNDI, I have always just used the JNDI name and have never tried anything else.

    have not been able to find reference information about the JBoss Ant task that has to be included with the StandardEJB doclet when using JBoss

    It’s in the reference under the ejbdoclet, since it is an additional tag for that doclet. A direct link on the xdoclet website is below:
    http://xdoclet.sourceforge.net/ant/xdoclet/modules/jboss/ejb/JBossSubTask.html

    If you figure out the component name thing, please post the resolution back here so we can all benefit. 🙂

    –Scott
    MyEclipse Support

    #199684 Reply

    I’ve ran into the same problem today. (forgot to add ejb.util – didn’t know i have to add it, though). Therefore I would like to ask if the EJB template may be modified to reflect this.

    #251589 Reply

    David McReynolds
    Participant

    I ws running into the same problems as others when trying to execute the utility class’ getHome method. I was assuming that everyone was running in the same container. However, apparently that was not the case. Even though all development is local and I only run jBoss with the embedded servlet engine (Tomcat) I could not perform a lookup on the COMP_NAME from the home interface.

    There are two options:
    1. the @ejb.util generate = “physical” – cause xdoclet to generate lookups on JNDI_NAME.

    2. Add resource refs to web.xml and jboss-web.xml – Allows you to perform lookups on components.

    #251675 Reply

    Riyad Kalla
    Member

    Thank you for the followup DLM

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: Wrong COMP_NAME Gen in Local Home Interface – EJB Not Bound

You must be logged in to post in the forum log in