users@glassfish.java.net

Deploying EJB3 Session Bean from external JAR file

From: <glassfish_at_javadesktop.org>
Date: Thu, 22 Nov 2007 09:18:47 PST

Hi,

I am trying to build a custom JNDI-reference for a EJB3 Stateless Session Bean which is available on my EJB component's classpath in a JAR-file like this:

[i]<sun-ejb-jar>
  <enterprise-beans>
    <ejb>
      <ejb-name>external.jar#HelloBean</ejb-name>
      <jndi-name>my.custom.jndi.name.HelloService</jndi-name>
    </ejb>
  </enterprise-beans>
</sun-ejb-jar>[/i]

The JAR file content looks like this

---
[i]external.jar
/external/HelloBean.class
/external/HelloService.class[/i]
---
Java code would be something like
---
[i]package external;
@Remote
public interface HelloService {
	public String sayHello(String name);
}[/i]
---
---
package external;
[i]@Stateless
public class HelloBean implements HelloService {
	public String sayHello(String name) {
		return "hello, " + name;
	}
}[/i]
---
I am always getting this error when deploying to GFv2:
---
[i]com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [test] -- Referencing error: This bundle has no bean of name [external.jar#HelloBean][/i]
---
I have also tried various variations of <ejb-name/> in sun-ejb-jar.xml, all leading to the same result
[i]<ejb-name>HelloBean</ejb-name>
<ejb-name>external.HelloBean</ejb-name>
<ejb-name>external.jar#HelloBean</ejb-name>
<ejb-name>HelloBean#external.jar</ejb-name>[/i]
Using ejb-jar.xml seems impossible, because we need ior-security-config directives from sun-ejb-jar.xml. I experience that ejb-jar.xml and sun-ejb-jar.xml cannot be used simoultaneously - is that assumption right?
My last option is to customize my build process in order to extract the contents of the jar file before deployment to the server. But my favourite would be to use the jar as is and get the bean deployed out of it by configuration.
Have you guys any comments/suggestions for me?
Thanks.
[Message sent by forum member 'copperschnack' (copperschnack)]
http://forums.java.net/jive/thread.jspa?messageID=246834