Hi,

The reason why this occured was that i had activemq jars in a common
classloader but not lingo jar. When the jar was loaded in two separate
classloaders the JVM would have two copies of RemoteInvocation class which
would return false on a instandeof compariasion. The soloution was to put
the jar along with the activemq jar in the common classloader.

regards,
-Kristoffer


kristoffer wrote:
> 
> Thanks for your answer. That's what is suspected. So my options are to use
> tcp between modules that run in the same JVM but in diffrent classloaders,
> or put activemq + deps in a shared classloader. Hmm..
> 
> Anyway i tried this out a bit and it works when sending strings.  When i
> try to send a Serializable object it also works, but as soon as i do
> parallel requests i get this exception:
> 
> ALLVARLIG: error dispatching message:
> java.lang.RuntimeException: Invalid message will be discarded:
> ActiveMQObjectMessage {commandId = 7, responseRequired = true, messageId =
> ID:artimus-3
> 897-1161358090985-3:11:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:artimus-3897-1161358090985-3:11:1:1, destinati
> on = topic://ericsson.ConsumerTopic, transactionId = null, expiration =
> 1161358135891, timestamp = 1161358105891, arrival = 0, correlationId =
> null, r
> eplyTo = null, persistent = true, type = null, priority = 4, groupID =
> null, groupSequence = 0, targetConsumerId = null, compressed = false,
> userID =
> null, content = [EMAIL PROTECTED],
> marshalledProperties = [EMAIL PROTECTED],
> dataStructure =
>  null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true}
>         at
> org.logicblaze.lingo.jms.marshall.DefaultMarshaller.onInvalidMessage(DefaultMarshaller.java:148)
>         at
> org.logicblaze.lingo.jms.marshall.DefaultMarshaller.readRemoteInvocation(DefaultMarshaller.java:92)
>         at
> org.logicblaze.lingo.jms.JmsServiceExporterMessageListener.onMessage(JmsServiceExporterMessageListener.java:99)
>         at
> org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
>         at
> org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
>         at
> org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
>         at
> org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:693)
>         at
> org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
>         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)
> 
> I browsed the lingo source and found this:
> 
> public RemoteInvocation readRemoteInvocation(Message message) throws
> JMSException {
>     handleInvocationHeaders(message);
>     if (message instanceof ObjectMessage) {
>         ObjectMessage objectMessage = (ObjectMessage) message;
>         Object body = objectMessage.getObject();
>         if (body instanceof RemoteInvocation) {
>             return (RemoteInvocation) body;
>         }
>     }
>     return onInvalidMessage(message);
> }
> 
> So it seems that the message i send is either not a ObjectMessage or the
> body is not a RemoteInvocation object. But it is a bit strange, since this
> works when doing single shot requests. 
> 
> I connect using on the client using:
> vm://localhost?marshal=true&broker.useJmx=false&broker.persistent=false
> 
> Any ideas why this is happening?
> 
> cheers,
> -Kristoffer
> 
> 
> gnodet wrote:
>> 
>> The vm transport works only inside one classloader,
>> so you need to put these in a shared classloader
>> for you scenario to work.
>> 
>> On 10/20/06, kristoffer <[EMAIL PROTECTED]> wrote:
>>>
>>> I did some test for this but my initial idea did not work (maybe for
>>> obvious
>>> reasons).
>>>
>>> This is how i understand what is happening:
>>> Seems as if the service modules are not able to connect to the broker
>>> because of classloader visibility since they are in separate WARs (this
>>> is
>>> how vm:// works?). These service modules then instead try to create
>>> their
>>> own embeded brokers. The brokers will throw exceptions all over the
>>> place
>>> with conflicting journals.
>>>
>>> However, i managed to get this to work, by putting activemq (4.0.2) and
>>> most
>>> of its dependencies (spring,xbeans etc) in system classpath. All service
>>> modules seem to connect to _the_ broker and are able to communicate
>>> between
>>> eachother properly.
>>>
>>> Do i really have to restrict myself and put these jars in system
>>> classpath
>>> to get this to work? What am I doing wrong? (Is vm:// is infact a
>>> classloader:// transport?)
>>>
>>> One idea I have is to make the (unwanted) creation of brokers (in the
>>> service modules) to be non-persistent by providing some configuration in
>>> order to avoid the journal conflicts. Would this work?
>>>
>>> I dont want to have a monolithic design where i put all my modules in a
>>> single WAR. I also want to avoid putting things in system classpath when
>>> rolling out the product in production.
>>>
>>> cheers,
>>> -Kristoffer
>>>
>>>
>>> kristoffer wrote:
>>> >
>>> > Hi,
>>> >
>>> > Im designing a modular system inside a servlet container were i want
>>> > modules (deployed as WARs, thus separte classloaders) to communicate
>>> with
>>> > eachother through JMS. In order to do this effeciently I was thinking
>>> of
>>> > using Jencks to utilize JCA for this nice pooling, transaction and
>>> > workmanager support. I dont want embedded brokers in these service
>>> > modules, if it is possible?
>>> >
>>> > Can I deploy a broker as a separate WAR module (and classloader),
>>> which
>>> > exposes a vm:// transport to the service modules? Reading from the
>>> > documentation it seems as if this would work, as long as i send
>>> > ObjectMessage messages between the service modules. Is this correct?
>>> >
>>> > I was also thinking of using Lingo so that i can have message driven
>>> pojos
>>> > interfaces between the service modules. Does lingo always use
>>> > ObjectMessage to communicate with the broker, or is there some way i
>>> can
>>> > force this behaviour?
>>> >
>>> > One "problem" i realized (not really related to this) is that since
>>> the
>>> > broker WAR need to be deployed before the service modules i need some
>>> > mechanism of setting deployment dependencies between the broker and
>>> > service modules. Possibly between service modules aswell. I know
>>> weblogic
>>> > and Jboss have a loadorder feature, but have yet to find one in for
>>> > example jetty or tomcat? Anyone have a tip?
>>> >
>>> > As a future requirement i want to be able to scale up with multiple
>>> > servlet containers that should share load between eachother, both on
>>> HTTP
>>> > request level (with a loadbalancer), but also between brokers.
>>> >
>>> > Please correct me if i missunderstood how to use activemq in the best
>>> way.
>>> >
>>> > keep up the good work!
>>> >
>>> > cheers,
>>> > -Kristoffer
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Jecks%2C-Lingo-and-vm%3A---tf2479865.html#a6917416
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> -- 
>> Cheers,
>> Guillaume Nodet
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Jecks%2C-Lingo-and-vm%3A---tf2479865.html#a6950176
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to