gen0
Sep 18th, 2005, 11:52 PM
Strange problem...
I have a SessionBean facade that returns a Collection of Objects which I am using from within a Web Application. When I get an instance of my SessionBean using the "old fashioned" approach, I have no problems, eg:
Context context = new InitialContext();
Object lookup = context.lookup(JNDI_NAME);
Object objHome = PortableRemoteObject.narrow(lookup,
IBroadcastServiceFacadeHome.class);
IBroadcastServiceFacadeHome home =
(IBroadcastServiceFacadeHome) objHome;
this.broadcastServiceFacade = home.create();
However... When I inject a session bean using the following snippet from my context XML:
<bean id="broadcastService"
class="org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean">
<property name="jndiName">
<value>java:comp/env/ejb/BroadcastService</value>
</property>
<property name="resourceRef">
<value>true</value>
</property>
<property name="businessInterface">
<value>com.gen.broadcast.IBroadcastServiceFacade</value>
</property>
</bean>
... things start to fall apart. I get the sessionbean object ok, I can call the method on it that returns a Collection, however as soon as I try to cast an Object in that Collection as one of my domain classes, I get a ClassCastException. Logging getClass().getName() tells me the Object is of the correct type, so I'm guessing some kind of class loader issue... But can anyone guess what this would be?
I have a SessionBean facade that returns a Collection of Objects which I am using from within a Web Application. When I get an instance of my SessionBean using the "old fashioned" approach, I have no problems, eg:
Context context = new InitialContext();
Object lookup = context.lookup(JNDI_NAME);
Object objHome = PortableRemoteObject.narrow(lookup,
IBroadcastServiceFacadeHome.class);
IBroadcastServiceFacadeHome home =
(IBroadcastServiceFacadeHome) objHome;
this.broadcastServiceFacade = home.create();
However... When I inject a session bean using the following snippet from my context XML:
<bean id="broadcastService"
class="org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean">
<property name="jndiName">
<value>java:comp/env/ejb/BroadcastService</value>
</property>
<property name="resourceRef">
<value>true</value>
</property>
<property name="businessInterface">
<value>com.gen.broadcast.IBroadcastServiceFacade</value>
</property>
</bean>
... things start to fall apart. I get the sessionbean object ok, I can call the method on it that returns a Collection, however as soon as I try to cast an Object in that Collection as one of my domain classes, I get a ClassCastException. Logging getClass().getName() tells me the Object is of the correct type, so I'm guessing some kind of class loader issue... But can anyone guess what this would be?