users@glassfish.java.net

Resource Adapter can not be injected via anotation must be set via xml in

From: <forums_at_java.net>
Date: Fri, 12 Oct 2012 07:07:22 -0500 (CDT)

Hi all, I have developed a resource adapter that opens a socket and then
calls the registered MDB beans for a handshake... This all works but if I try
to use @MessageDriven annotation for the bean I get a class cast exception..
here is the code for the mdb bean if added in ejb-jar.xml SOCKET_MDB
SOCKET_MDB mk.icelabs.vtcore.util.socket.ServerSocketMDB
mk.icelabs.socketj2ee.advertisment.SocketMessageEndpoint Container port 12050
encoding UTF-8 maximumConnections 100 connectionTimeoutMilliseconds 9999
ipAddress 0.0.0.0 SOCKET_MDB * NotSupported so used like this all works fine.
But if I use annotation instead of xml.... @MessageDriven(
messageListenerInterface=SocketMessageEndpoint.class, activationConfig = {
@ActivationConfigProperty(propertyName = "ipAddress", propertyValue =
"0.0.0.0"), @ActivationConfigProperty(propertyName = "port", propertyValue =
"12050") } ) public class ServerSocketMDB implements SocketMessageEndpoint {
} then again all looks ok on deploy etc... but when the resource adapter
tries to call the MDB by creating a endpoint in the adapter and casting this
to my interface I get this exception: java.lang.ClassCastException: $ProxyXYZ
cannot be cast to mk.icelabs.socketj2ee.advertisement.SocketMessageEndpoint
the code looks like this SocketMessageEndpoint listener =
(SocketMessageEndpoint) MessageEndpointFactory.createEndpoint(null); When I
use the ejb-jar.xml setup I also see(by debug) that the class is $ProxyXYZ
but then its castable to SocketMessageEndpoint I probably have something not
configured while I use the annotation...but what?! Any idea somebody? Blaze

--
[Message sent by forum member 'baze985']
View Post: http://forums.java.net/node/891408