PDA

View Full Version : Error deploying SLSB+Spring on JBoss


guila
Feb 15th, 2005, 01:31 PM
Hi.

I am new to using Spring with EJB and I am having problems to deploy a simple application on JBoss. When I copy the EAR file to the server, I get the following error:
14:49:10,432 INFO [EARDeployer] Init J2EE application: file:/C:/Java/jboss-4.0.1RC1/server/default/deploy/sgn-ear.ear
14:49:11,273 WARN [verifier] EJB spec violation:
Bean : ModuloGerencial
Section: 22.2
Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
Info : Class not found on 'com.ipq.sgn.ejb.ModuloGerencialEJB': Unexpected error during load of: com.ipq.sgn.ejb.ModuloGerencialEJB, msg=org/springframework/ejb/support/AbstractStatelessSessionBean

14:49:11,273 ERROR [MainDeployer] could not create deployment: file:/C:/Java/jboss-4.0.1RC1/server/default/tmp/deploy/tmp581
96sgn-ear.ear-contents/sgn-ejb.jar
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java: 553)
at org.jboss.deployment.MainDeployer.create(MainDeplo yer.java:898)
...
(I removed the rest of the stack trace)
...

14:49:11,293 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
Incompletely deployed packages:
org.jboss.deployment.DeploymentInfo@723eaac1 { url=file:/C:/Java/jboss-4.0.1RC1/server/default/deploy/sgn-ear.ear }
deployer: org.jboss.deployment.EARDeployer@257f1b
status: Deployment FAILED reason: Verification of Enterprise Beans failed, see above for error messages.
state: FAILED
watch: file:/C:/Java/jboss-4.0.1RC1/server/default/deploy/sgn-ear.ear
altDD: null
lastDeployed: 1108489750953
lastModified: 1108489750422
mbeans:


I followed the reference and the ejbtest example to create de EJB and I am using xdoclet to create the descriptors and interfaces. I´ve checked then and I am sure they are correct, but I do not know what is going wrong.
My EAR file has the structure:

sgn-ear.ear - sgn-ejb.jar (contains the ModuloGerencial EJB) [list:fe24156d47]
com
beanRefContext.xml
META-INF [list:fe24156d47]
MANIFEST.MF
ejb-jar.xml
jboss.xml [/list:u:fe24156d47]
spring.jar
hibernate2.jar
other jar files needed (commons-*.jar, aopalliance.jar, etc)
META-INF
MANIFEST.MF
application.xml
[/list:u:fe24156d47]

The source of my EJB is:
package com.ipq.sgn.ejb;

import java.util.List;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.SessionContext;
import org.springframework.context.access.ContextSingleto nBeanFactoryLocator;
import org.springframework.ejb.support.AbstractStatelessS essionBean;
import com.ipq.sgn.beans.Empresa;

/**
* @ejb.bean name = "ModuloGerencial"
* type = "Stateless"
* display-name = "Modulo Gerencial"
* view-type = "both"
* jndi-name = "ejb/com/ipq/sgn/ModuloGerencial"
* local-jndi-name = "ejb/com/ipq/sgn/ModuloGerencialLocal"
* remote-business-interface = "com.ipq.sgn.ejb.IModuloGerencial"
* local-business-interface = "com.ipq.sgn.ejb.IModuloGerencial"
*
* @ejb.interface extends = "javax.ejb.EJBObject"
* local-extends = "javax.ejb.EJBLocalObject"
*
* @ejb.home extends = "javax.ejb.EJBHome"
* local-extends = "javax.ejb.EJBLocalHome"
*/
public class ModuloGerencialEJB extends AbstractStatelessSessionBean implements IModuloGerencial {
private IModuloGerencial moduloGerencial;

protected void onEjbCreate() throws CreateException {
this.moduloGerencial = (IModuloGerencial) this.getBeanFactory().getBean("moduloGerencial");
}

public void setSessionContext(SessionContext sessionContext) {
super.setSessionContext(sessionContext);
this.setBeanFactoryLocator(ContextSingletonBeanFac toryLocator.getInstance());
this.setBeanFactoryLocatorKey(Constants.EJB_ID);
}

/* Bussiness Methods */

/**
* @ejb.interface-method view-type = "both"
*/
public String sayHello() throws EJBException {
return moduloGerencial.sayHello();
}
}


I hope you can help me with this. Thanks!

gmatthews
Feb 15th, 2005, 07:55 PM
The problem is likely in your ejb-jar.xml file, and likely not to do with Spring.

Can you post the section of your ejb-jar.xml file that declares the SLSB?

I seem to remember that the particular error you're getting is a bit of a red herring and that you can get it if the SLSB doesn't throw the correct exception types from methods.

So, you might also want to post your SLSB interface + class if they're not too long, or compare your method signatures with the EJB spec.

jcurry1
Feb 16th, 2005, 09:47 AM
This is a shot in the dark as I am pretty new to EJBs (but I do have a couple working). Try taking out the remote-business-interface and local-business-interface. That is the only difference between what I have working and what you have that I can see. When I was putting my stuff together I couldn't quite figure out what those two statements were doing for me so I didn't put them in. Also you didn't say what commons-*.jar you deployed but I you don't need the logging one (jboss gives it to you). I think I got a rather odd error when I had that in my ear.

benethridge
Feb 7th, 2006, 09:11 PM
Hi.

I'm getting essentially the same error as this thread-starter, on a simple EJB project (the Fibo sample from the JBoss Eclipse IDe Tutorial):

http://docs.jboss.com/jbosside/tutorial/build/en/html/index.html

...which I then enhanced as best I could using this:

http://www.javaworld.com/javaworld/jw-02-2005/jw-0214-springejb.html

...and this:

http://www.springframework.org/docs/reference/ejb.html

The problem APPEARS to be that the AbstractStatelessSessionBean does not implement all the methods required by the EJB spec, but I'm guessing that it's more subtle than that.

(Yes, my Fibo EJB project runs fine as a straight EJB in-container app in JBoss Eclipse.)

When I replace the "regular" EJB interfaces and implementations with Spring stuff, I get the error.

I can attach the ear, if someone wants to check it out. This is using a recent download of the JBoss/Eclipse IDE, with a recent spring.jar.

Alternatively, if someone could modify the Fibo project slightly, to use Spring with the EJBs, so that it runs simple tests both in and out of the container, and post that in the FAQ, I'm pretty sure it would be appreciated by the group, and would reduce the learning time for the EJB usage.

Ben