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.