users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Mon, 25 Jan 2010 07:13:54 PST

The problem is that the DemoServiceOneBean bean class is part of a library .jar in the top-level "lib" directory of the .ear. That means the classes are visible to all modules in the .ear. Each module is processed for annotations, so the bean is created more than once. This is the reason that it is not recommended to put classes with component-defining annotations in a library .jar.

It can be tricky to share a class with a no-interface view across multiple modules in a .jar. I recommend you either use a local business interface for the cross-module view and limit the bean class to the ejb-jar, OR explicitly link the ejb-ref/_at_EJB dependency to the correct target EJB in the ejb-jar, e.g. by adding lookup="java:app/<ejb-jar-name>/DemoServiceOneBean".
[Message sent by forum member 'ksak' (kenneth.saks_at_sun.com)]

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