Hello, Environment: ServiceMix 3.0.1 JRE: 1.5.0.9 App Server: JBoss 4.0.4GA
I have a custom exception class that I plan on using in 2 different service units. First service unit catches an exception and throws my custom exception. The second service unit (a JSR) takes the custom exception from the message exchange and processes it. I have added the custom jar (which has Exception class) as a dependancy and included it in the library in xbean and servicemix files of two service units. Both service units are part of the same service assembly. At run-time, in the JSR, I see a ClassCastException while casting the exception (received via exchange.getError) as my custom exception. I have pasted the exception log below. However, If I do not package the jar (containing the exception class) in the service units but instead install them in the JBoss deploy directory, then it works. I have another custom class that I use to set as a property on the message in one service unit and retreive from another service unit that works. I am typecasting there also. However in this case of custom exception it does not work. How can I package the same Jar in two service units in one service assembly without getting this error? I do not want to put the jar in jboss deploy because then it becomes an external deployment outside of my service unit. Thanks and Regards, Ritesh ========================================================================== 2007-04-02 11:28:52,744 DEBUG [org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow] Called Flow send 2007-04-02 11:28:52,744 DEBUG [org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue] [EMAIL PROTECTED] dequeued exchange: InOut[ id: ID:rsamanpure-1693-1175527707400-7:0 status: Error role: consumer endpoint: ExampleService in: <?xml version="1.0" encoding="UTF-8"?><echoHello xmlns="http://servicemix.apache.org/replaceMe"><echoHello>testing echo</echoHello></echoHello> error: com.mycompany.servicemix.samples.CustomException: This is a custom Exception ] 2007-04-02 11:28:52,744 DEBUG [org.apache.servicemix.jbi.messaging.DeliveryChannelImpl] Processing inbound exchange: InOut[ id: ID:rsamanpure-1693-1175527707400-7:0 status: Error role: consumer endpoint: ExampleService in: <?xml version="1.0" encoding="UTF-8"?><echoHello xmlns="http://servicemix.apache.org/replaceMe"><echoHello>testing echo</echoHello></echoHello> error: com.mycompany.servicemix.samples.CustomException: This is a custom Exception ] 2007-04-02 11:28:52,744 DEBUG [org.apache.servicemix.jbi.messaging.DeliveryChannelImpl] Notifying exchange ID:rsamanpure-1693-1175527707400-7:0(1c57a92) in DeliveryChannel{servicemix-jsr181} from processInboundSynchronousExchange 2007-04-02 11:28:52,744 DEBUG [org.apache.servicemix.jbi.messaging.DeliveryChannelImpl] Notified: ID:rsamanpure-1693-1175527707400-7:0(1c57a92) in DeliveryChannel{servicemix-jsr181} from sendSync 2007-04-02 11:28:52,744 ERROR [org.codehaus.xfire.handler.DefaultFaultHandler] Fault occurred! java.lang.ClassCastException: com.mycompany.servicemix.samples.CustomException at com.mycompany.errorMsg.service.ExampleServiceImpl.sayHello(ExampleServiceImpl.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:54) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(ServiceInvocationHandler.java:271) at org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:84) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:132) at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:107) at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64) at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38) at org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.doProcess(Jsr181ExchangeProcessor.java:113) at org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.process(Jsr181ExchangeProcessor.java:68) at org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:410) at org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:43) at org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:624) at org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:170) at org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:177) at org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:227) at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291) at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Thread.java:595) ========================================================================== Custom Jar source: http://www.nabble.com/file/7615/ExceptionClass.zip ExceptionClass.zip Compiled jar of the custom exception: http://www.nabble.com/file/7616/mycompanyTest-1.0.jar mycompanyTest-1.0.jar Test document to run against the example: http://www.nabble.com/file/7618/testDocument.xml testDocument.xml Source Code of the example: http://www.nabble.com/file/7617/errorMsg.zip errorMsg.zip -- View this message in context: http://www.nabble.com/ClassCastException-while-using-same-custom-jar-in-2-service-units-tf3506609s12049.html#a9793635 Sent from the ServiceMix - User mailing list archive at Nabble.com.
