Hi, would need to check with a sample but I think it was fixed on trunk but not sure there was an "app" workaround. Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau
2013/10/28 Allen, Robert R <[email protected]>: > Although it appears this topic has been discussed in other threads, I don't > see guidance on the fix. > > My tomee.xml contains the following boilerplate: > <tomee> > <!-- see http://tomee.apache.org/containers-and-resources.html --> > > <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter"> > BrokerXmlConfig = broker:(tcp://localhost:61616) > ServerUrl = tcp://localhost:61616 > </Resource> > > <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory"> > ResourceAdapter = MyJmsResourceAdapter > </Resource> > > <Container id="MyJmsMdbContainer" ctype="MESSAGE"> > ResourceAdapter = MyJmsResourceAdapter > </Container> > > </tomee> > > > My webapp is initialized with container resources as follows. This results in > a ConnectionFactory with the standard class loader, not the webapp loader, > although the thread running the init() call has the webapp > LazyStopWebappClassLoader. > > public class InitServlet extends HttpServlet { > > @Resource > private ConnectionFactory connectionFactory; > > public void init(ServletConfig config) throws ServletException > { > > // ------- JMS service start -------------- > try { > connection = connectionFactory.createConnection(); > connection.start(); > > // set up cfgMgmt services > Session session = connection.createSession(false, > Session.AUTO_ACKNOWLEDGE); > MySvc mySvc = new MySvc (session); > } > > public class MySvc implements MessageListener > { > private Session session; > private MessageConsumer consumer; > private MessageProducer writer; > > public MySvc(Session session) > { > this.session = session; > writer = session.createProducer(null); > Destination destination_in = > session.createQueue("myqueue"); > consumer = session.createConsumer(destination_in); > consumer.setMessageListener(this); > } > > ... > > Because MySvc was created by the LazyStopWebappClassLoader thread, it's > objects are loaded by it. > However when I receive a message: > > public void onMessage(Message request) > { > Object reqObj = ((ObjectMessage) request).getObject(); > if (!(reqObj instanceof BaseMsg)) { > throw new Exception("FUNCTIONALITY_NOT_SUPPORTED"); > } > > ... > } > the deserialization was done by the connectionFactory's classLoader (not the > webapp loader), so the class instanceof compare fails. > > Is there a common sense way to resolve this in the TomEE environment > configuration? > > > -------------------------------------------------------------------------- > "The most precious thing we have is life, yet it has absolutely no > trade-in value." > > Robert R. Allen Sr Principal Software Architect > [email protected] (919)677-2899 CA Technologies > ------------------------------
