users@glassfish.java.net

Re: GF V3 - Cannot resolve reference Remote ejb-ref

From: <glassfish_at_javadesktop.org>
Date: Tue, 26 Jan 2010 07:53:29 PST

thanks for your reply,
yes your suggestion should work well. But now the deployer is forced to do redefining all my ejb definitions. This makes the usage a little bit uncomfortable. The declaration should be still an optional feature.

But currently maybe I found a better solution. But I need some help if this way is spec conform:

In the moment my EAR declares the two EJBModuls. My "third-party-ejb" and my application specific ejb.
...
  <module>
    <ejb>jee-demo-ejb-0.0.2-SNAPSHOT.jar</ejb>
  </module>
  <module>
    <ejb>jee-demo-lib-0.0.2-SNAPSHOT.jar</ejb>
  </module>
...

When I try to overwrite a EJB declaration form the "third-party-ejb" (jee-demo-lib) in my application specific ejb module (jee-demo-ejb) the EJB is deployed twice (as you explained and as we can see in the server.log).
If I remove (just for testing) the ejb injection from my DemoServiceSecondBean I can see in the server.log that now the ear successfull deploys and that I got now two different Portable JNDI names for the same ejb:

INFO: Portable JNDI names for EJB DemoServiceSecondBean : [java:global/jee-demo-ear-0.0.2-SNAPSHOT/jee-demo-ejb-0.0.2-SNAPSHOT/DemoServiceSecondBean!org.imixs.demo.DemoServiceSecond, java:global/jee-demo-ear-0.0.2-SNAPSHOT/jee-demo-ejb-0.0.2-SNAPSHOT/DemoServiceSecondBean]
...
INFO: Portable JNDI names for EJB DemoServiceSecondBean : [java:global/jee-demo-ear-0.0.2-SNAPSHOT/jee-demo-lib-0.0.2-SNAPSHOT/DemoServiceSecondBean!org.imixs.demo.DemoServiceSecond, java:global/jee-demo-ear-0.0.2-SNAPSHOT/jee-demo-lib-0.0.2-SNAPSHOT/DemoServiceSecondBean]

one from my "third-party-ejb" and one from my application specific.
I think that I understand this behavior now. And it seems to be logical that I run later into the
...Cannot resolve reference Remote ejb-ref name.... problem.

So now I will explain my new solution:

I remove the EJBModule declaration from my application.xml for the "third-party-ejb". And the "third-party-ejb" will be simply added into the root of my EAR.

...
  <module>
    <ejb>jee-demo-ejb-0.0.2-SNAPSHOT.jar</ejb>
  </module>
 ...

Next I change the MANIFEST.MF from my application specific EJB Module (jee-demo-ejb) like this:

   Manifest-Version: 1.0
   Class-Path: jee-demo-lib-0.0.2-SNAPSHOT.jar

What happens now is, that all(!) my EJBs from my jee-demo-lib-0.0.2-SNAPSHOT.jar will be deployed successfully together with my application specific EJB Module.
I can see this in the server.log output that all 3 EJBs are in the same namespace of my only ejb module!

java:global/jee-demo-ear-0.0.2-SNAPSHOT/jee-demo-ejb-0.0.2-SNAPSHOT/

That is great! :-)
So my final question is:
Is this kind of packaging recommended? Adding ejb.jars to a ejb module by adding them to the classpath of the MANIFEST.MF. I have read before about this practice in deploying JPA entities together with an ejb module.
So if this is JEE6 conform I should go this way?

Thanks for your help

By the way, what really missing in Glassfish V3 is the JNDI Browser Feature from V2.1 ... ;-)
[Message sent by forum member 'rsoika' (Ralph.Soika_at_imixs.com)]

http://forums.java.net/jive/thread.jspa?messageID=383045