Announcement Announcement Module
No announcement yet.
Regarding Ejb 3.0 Deployment With Spring 2.5 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Regarding Ejb 3.0 Deployment With Spring 2.5

    Hi All,

    At present, I am trying my hand in integrating Ejb 3.0 with Spring 2.5. I am using jboss 4.2.2 GA.
    I am starting my server and deploying my ear file through Eclipse.

    I am getting the following exception while deploying the ejb jar along with the ear file. ( after removing this ejb jar , the deployment is fine )

    09:40:38,674 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=demoear.ear,jar=demoejb.jar,name=Ma sterdataEJB,service=EJB3 with dependencies:
    09:40:38,721 INFO [EJBContainer] STARTED EJB: com.demo.MasterdataEJB ejbName: MasterdataEJB
    09:40:38,799 INFO [EJBContainer] STOPPED EJB: com.demo.MasterdataEJB ejbName: MasterdataEJB
    09:40:38,799 WARN [ServiceController] Problem starting service jboss.j2ee:ear=demoear.ear,jar=demoejb.jar,name=Ma sterdataEJB,service=EJB3
    java.lang.ClassCastException: $Proxy81
    at org.jboss.util.naming.Util.createSubcontext(Util.j ava:69)
    at org.jboss.util.naming.Util.rebind(
    at org.jboss.util.naming.Util.rebind(
    at org.jboss.ejb3.stateless.StatelessRemoteProxyFacto ry.start(
    at org.jboss.ejb3.ProxyDeployer.start(ProxyDeployer.j ava:83)
    at org.jboss.ejb3.SessionContainer.start(SessionConta
    at org.jboss.ejb3.stateless.StatelessContainer.start(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
    at java.lang.reflect.Method.invoke(
    at org.jboss.ejb3.ServiceDelegateWrapper.startService (
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Start(
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Lifecycle(
    at sun.reflect.GeneratedMethodAccessor3.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
    at java.lang.reflect.Method.invoke(
    at e(
    at .java:94)
    at ava:86)

    I am not sure where the mistake is.

    below are the files.

    Files inside META-INF
    <?xml version="1.0" encoding="UTF-8"?> 
    service.xml ( availabe in the root folder of the classpath )

    <?xml version="1.0" encoding="UTF-8"?>
    	<!-- =========  DAO DECLARATIONS============== -->
    	<bean id="rootService"
    Java Classes ( have not used the at-the-rate symbol for annotations while posting , as im not permitted to post it. )

    Stateless(name = "MasterdataEJB")
    public class MasterdataEJB extends AbstractStatelessSessionBean implements
    		MasterdataService {
    public interface MasterdataHome extends EJBHome {
    	public MasterdataRemote create() throws CreateException, RemoteException;
    public interface MasterdataRemote extends MasterdataService, EJBObject {
    public interface MasterdataService {
    As of now, there are no methods. I am not getting why, I am getting this exp while deploying an ejb with spring.

    Thanx in Advance.

  • #2
    First off all it seems you are mixing classes from EJB2 and EJB3, the AbstractStatelessSessionBean is EJB 2 NOT EJB3, the same for EJBHome and EJBObject, so start by removing that. Also isn't your interface declaration off?! Your @Local is at the Home interface not a Local interface. Just seems odd to me. Remember that EJB3 is an attempt to use POJO based programming in an EJB model. So no more special EJB classes, just some annotations.

    Another question I have is is the service.xml posted in whole? No tx stuff going on? I also suggest chapter 18.3.2 which explains how to use spring in EJB3.

    @Stateless(name = "MasterdataEJB")
    public class MasterdataEJB implements MaterdataLocal, MasterdataRemote {
      public void someMethod() {
        System.out.println("someMethod called.");
    public interface MasterdataLocal extends MasterdataService {
    public interface MasterdataRemote extends MasterdataService {
    public interface MasterdataService {
      public void someMethod();
    I would have expected something like this. Although you might want to check if you really need both a Local and Remote interface...
    Last edited by Marten Deinum; Aug 28th, 2008, 12:41 AM.