Announcement Announcement Module
Collapse
No announcement yet.
problem with LocalStatelessSessionProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with LocalStatelessSessionProxyFactoryBean

    Hi folks,

    I think I ran into a similar problem as described in the Spring Framework Mailing Lists post by Colin Sampaleanu: http://sourceforge.net/mailarchive/m...msg_id=7104648. I seem to have a different environment, though.

    When invoking an EJB from Sun ONE App Server 7 using LocalStatelessSessionProxyFactoryBean, I'm getting the following exception:

    java.lang.IllegalArgumentException: object is not an instance of declaring class
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.springframework.ejb.access.LocalSlsbInvokerInt erceptor.invoke(LocalSlsbInvokerInterceptor.java:7 7)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :140)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:153)
    at $Proxy1.getById(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    .....

    When I use remote interfaces and SimpleRemoteStatelessSessionProxyFactoryBean, it works just fine.

    The EJB gets generated by XDoclet (v 1.2), and as I mentioned above, I'm invoking it from Sun ONE. Here're some snippets of the code I'm using:

    /**
    * A session facade for managing a timecard app
    *
    * @ejb.bean
    * name="TimecardFacade"
    * type="Stateless"
    * view-type="local"
    * transaction-type="Container"
    * jndi-name="ejb/TimecardFacade"
    *
    * @ejb.env-entry
    * name="ejb/BeanFactoryPath"
    * type="java.lang.String"
    * value="/timecardManService-ejb-beans.xml"
    *
    * @ejb.interface
    * local-extends="javax.ejb.EJBLocalObject"
    * @ejb.home
    * local-extends="javax.ejb.EJBLocalHome"
    *
    * @sunone.bean-pool
    * steady-pool-size="1"
    * resize-quantity="1"
    * max-pool-size="20"
    * pool-idle-timeout="600"
    *
    *
    */


    public abstract class TimecardFacadeBean extends AbstractStatelessSessionBean
    implements TimecardManager, SessionBean {

    public static final String POJO_SERVICE_ID = "timecardManagerPOJOImpl";
    TimecardManager timecardManager;

    public void setSessionContext (SessionContext ctx) {
    super.setSessionContext(ctx);
    }

    /** @ejb.create-method */
    public void ejbCreate() throws CreateException {
    super.ejbCreate();
    }

    protected void onEjbCreate() throws CreateException {
    timecardManager = (TimecardManager) getBeanFactory().getBean(POJO_SERVICE_ID);
    }


    /** Implementation of the business interface methods **/

    /**
    * @ejb.interface-method
    *
    */
    public void authenticate(){
    timecardManager.authenticate();
    }


    /**
    * @ejb.interface-method
    *
    */
    public Employee getById(String tid){
    return timecardManager.getById(tid);
    }


    ...........

    }

    a piece from applicationContext.xml
    -------------------------------------------

    <bean id="timecardManager" lazy-init="true" class="org.springframework.ejb.access.LocalStatele ssSessionProxyFactoryBean">
    <property name="jndiName">
    <value>java:comp/env/ejb/TimecardFacadeLocal</value>
    </property>
    <property name="businessInterface">
    <value>edu.metro.prod.timecard.payroll.TimecardMan ager</value>
    </property>
    </bean>

    ejb-local-ref declaration from web.xml
    --------------------------------------------

    <ejb-local-ref >
    <ejb-ref-name>ejb/TimecardFacadeLocal</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>edu.metro.prod.timecard.interfaces.TimecardFa cadeLocalHome</local-home>
    <local>edu.metro.prod.timecard.interfaces.Timecard FacadeLocal</local>
    <ejb-link>TimecardFacade</ejb-link>
    </ejb-local-ref>

    Is it xDoclet or class loader problem, or something else?? I would appreciate if someone could point out what I'm missing here.

    Thanks much.

  • #2
    Seems to me this _is_ the same or almost the same problem I was having and described in that email post, the object returned isn't of the right type.

    Why don't you declare the local business interface, with xdoclet's 'local-business-interface' attribute? You do have the
    @ejb.home local-extends="javax.ejb.EJBLocalHome"
    tag, but that's actually just the default value, and is not telling XDoclet anything about the business interface, in any case.

    Regards,

    Comment

    Working...
    X