Consuming JMS ObjectMessages

Hi!
I have the following code that is meant to run through a loop until no more objectmessages are in the jms queue.
Messages are being correctly sent to the jms queue(to test this, i have replaced "receiveNoWait()" with receive() and "Reached here" is been printed to the screen for each object received, but loop does not break) but the loop is always breaking.
Can you help me fix this?
Thanks for your help in advance.
Context jndiContext = new InitialContext();
ConnectionFactory factory =(ConnectionFactory) jndiContext.lookup("jms/ConnectionFactory");
Destination dest = (Destination) jndiContext.lookup("jms/Queue");               connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);     
MessageConsumer consumer = session.createConsumer(dest);connection.start();
while (true){
     ObjectMessage m = (ObjectMessage consumer.receiveNoWait();
     if(m == null)
     break;
     System.out.println("Reached here");          
     }

If you want to drain a queue and be completely sure you get every possible message I'd recommend using the receive(timeout) method with some timeout of a second or two. This is because many JMS providers will make sure receiveNoWait() does not block at all - but that does not always mean that there is not a message on the queue. JMS is designed for high performance with as little blocking and latency as possible - providers typically do things asynchronously, so receiveNoWait() often just means there is no message available in this JVM; not that there is no message on the broker available.
receive(1000) will typically wait long enough to drain messages from the queue if they are available. Its kinda JMS provider dependent; but most providers should work with receive(1000); many won't for receiveNoWait()
James
http://logicblaze.com/

Similar Messages

  • Consume JMS Unit-Of-Work message through OSB proxy service

    Hi,
    Anyone know how to consume a JMS Unit-Of-Work (UOW) message using an OSB Proxy Service of JMS type?
    I can submit a unit-of-work JMS message (which consists of multiple constituent messages) using an OSB proxy & business service combination and setting the UOW transport headers appropriately. I can also separately produce and consume Java objects via a JMS queue where the consumption is done via OSB proxy (of java request message type), but these aren't UOW messages.
    Apparently as soon as it is a UOW message then the message consumed is an ObjectMessage ArrayList and one has to use the "Java" request message type for the JMS consumer proxy, but I'm unsure of how to create the concurrent client jar to use it in the same proxy service's JMS transport configuration in order to output the ObjectMessage ArrayList (UOW message). 
    Ideally I'd like to consume a single UOW XML message via an OSB JMS proxy service.
    Any pointers would be appreciated.
    R

    Finally got this working!!
    For posterity: Needed to insert Java Object JMS messages on the OSB JMS producer (Business Service) side with correct UOW jms transport header set in route node. Then consume the Unit-Of-Work message on the other side via jms proxy service with "java" request message type, with appropriate jar containing the Object class as the "Client jar" in the JMS Transport configuration. In the same JMS consumer proxy I had to do a java callout, passing the contents of $body, using java.util.ArrayList and javax.jms.ObjectMessage, as input into a method (.. decodeJavaMessage(ArrayList<ObjectMessage> ...)). In this java callout class you can get to each individual ObjectMessage via typecasting the get() method on the Arraylist to (ObjectMessage) and then just typecast the getObject() on this Objectmessage into your original Java Class (same as what you inserted onto queue originally).
    Hope this saves someone some time in future!

  • OSB: Proxy doesn't consume JMS messages

    Guys, I'm getting stuck with this one ...
    I've got four JMS proxy services. One of them uses Publish to enqueue a message into the three others. This way I get three copies of a single message, each in dedicated JMS queue. The same three JMS proxies are supposed to consume messages from JMS queues and process them. The configuration is the same for all three proxies and all three JMS queues. In fact all was cloned and the difference is only in suffix. So, I've got QueueA, QueueB, QueueC and ProxyA, ProxyB and ProxyC. So if I stick to these names, ProxyMain uses 3x Publish actions to enqueue a message into ProxyA, ProxyB and ProxyC at the same time. This is a proved solution and it has worked for years flawlessly!
    However, something weird happened a couple of days ago. All of a sudden, one of those three consuming JMS proxies doesn't consume anything. There's no issue on producing side (the first proxy) as the numbers of messages in all three queues are still increasing. Still, only messages from QueueA and QueueB are being consumed by ProxyA and ProxyB. The third queue (QueueC) doesn't have any consumer attached from ProxyC and I don't know why.
    I've already checked everything I know - proxy is enabled, there are no errors in logs related to the proxy or JMS, the issue is not reproducible in test environment with the same configuration, there are no JMS Quota or connection factory restrictions, consuming flag is enabled on queue ...
    The lack of errors in logs makes me feel like the ProxyC is connected to something else. However, the same proxy is used for producing messages (from ProxyMain) and messages are incoming to the queue so the endpoint set in proxy must be correct!
    Any help, hint or idea is appreciated ...

    The third queue (QueueC) doesn't have any consumer attached from ProxyC and I don't know whyTry renaming ProxyC to say ProxyC1 and activate the session. This will create a new underlying MDB for the jms proxy and you will see consumers getting set on the queue.. Faced this issue many times in our production environment and easiest workaround we found was to rename the proxy service [ toggling enable/disable proxy doesn't seem to have ny effect).. you can change the name to the original proxy once the consumers are set..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Consume JMS mesages in a batch

    Hi All,
    I want to consume JMS messges in a batch. Assume I have 100 messages in a queue, and i want to consume 25 messages first and execute the flow. Then i should pick another 25 messages and so on. Is there a way to achieve this? Please do let me know.
    Regards,
    Maanik.

    Hi,
    You have to create a work manager with its setting like min thread=1 and max thread=25 and refer that work manager in your queue.
    Second, you are never going to achieve 25 or 50 messages in bulk/batch. It will come one by one as jms queue means first in last out. setting it max thread=25, it will lead to processing of 25 concurrent messages.
    Rgrds

  • JMS ObjectMessage

    I successfully sent a JMS message using ObjectMessage. But when receiving, it halts at the point where I tried to get the Object out of the message.....
    Source
    =============
    public void onMessage(Message message)
    System.out.println("Message Received");
    if(message instanceof ObjectMessage)
    System.out.println("Message Type: ObjectMessage");
    try{
    System.out.println("1");
    ISCLPDocument _oISCLPDocument = (ISCLPDocument)((ObjectMessage)message).getObject();<-- stops here or "hangs"
    System.out.println("got ISCLPDocument Object");
    System.out.println("Message Type = " + _oISCLPDocument.getMessageType());
    }catch(Exception _oException)
    System.out.println("4");
    _oException.printStackTrace();
    }

    This was most likely caused by the fact that the message consumer had trouble de-serializing the content of the ObjectMessage. You need to make sure that: 1. the object contained in the ObjectMessage as well as all fields of this object are Serializable; 2. Each field of the object contained in the ObjectMessage was set to a value with the EXACTLY matching data type. Let me explain 2.
    I this something like this in my code:
    SerializableObjectToSend.lastUpdate = someObject.lastUpdate;
    where SerializableObjectToSend.lastUpdate was declared as java.util.Date, and someObject.lastUpdate was declared as java.sql.TimeStamp. This compiled fine because TimeStamp is a sub-class of Date. But during run time, the message consumer hung on the getObject() call. Reason: I was pretty sure that it had trouble de-serializing a java.sql.TimeStamp into a java.util.Date !! So I made the following change and everything worked fine:
    SerializableObjectToSend.lastUpdate = new java.util.Date(someObject.lastUpdate.getTime());
    Hope that helps.

  • Invoke Error while inserting consumed JMS Topic msg in table thru DBadapter

    Hi All,
    To brief abt my requirement, I am integrating Peoplesoft HRMS module with Oracle SOA i.e.,
    +
    1. PS HRMS module will publish a JMS msg into a JMS Topic
    2. I will consume the same msg using JMS adapter consume operation in my SOA project
    3. The Payload(msg) is coming into RECEIVE activity and thru ASSIGN activity invoking the DB adapter to insert the msg into a table.
    4. INVOKE activity is throwing the below error(along with the error, able to see the payload in INVOKE activity )
    <part name="summary"> +
    <summary>*Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: Mapping Not Found Exception. The mapping [EMPLID] for descriptor [class insert.Employee] could not be found. The input xml record had an element [Employee/EMPLID]. Most likely the wrong xml input variable (not matching the expected xsd) was passed to this invoke. Make sure that the input xml is valid relative to the xsd and that the mapping exists in the Mappings.xml. If an old version of the descriptor without this mapping has been loaded by the database adapter, you may need to bounce the app server. If the same descriptor is described in two separate Mappings.xml files, make sure both versions include this attribute/mapping. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution. *</summary>
    </part>
    Please, provide some suggestions.
    Regards,
    Satya

    Hi Satya,
    Try replacing the Assign activity with a Transform acitivity.
    Also please check the schema that comes of the DB adapter is having the similar sort of definition that you are getting in your input.
    What I mean is to check for length of fields, type of the fields etc.
    Thanks,
    Deepak.
    Edited by: DeepakDabbiru on Oct 23, 2012 3:29 AM

  • MDBs in 9.1 continue to consume JMS queues even after being deleted

    <b>We have an MDB application that reads a batch message off of a JMS queue, archives it in a database, parses the batch message into individual messages and writes them onto other JMS queues to be consumed by another application. Everything was running fine in Weblogic 8.1.5. However, due to problems with XA drivers and the MSDTC(predictable SQL server crashes), we decided to upgrade to Weblogic 9.1 to take advantage of the LLR option.</b>
              <b>First, we had an issue where our MDBs were causing the following exception:</b>
              <i>####<May 26, 2006 7:42:12 PM EDT> <Error> <JMX> <ist-clft2> <wltest1> <ExecuteThread: '1' for queue: 'default'> <<WLS Kernel>> <> <> <1148686932991> <BEA-149500> <An exception occurred while registering the MBean null.
              java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=wltest1,MessageDrivenEJBRuntime=RhapsodyMDB_DMBModule!JMSServer4@DMB_BEAN_QUEUE,Name=RhapsodyMDB_DMBModule!JMSServer4@DMB_BEAN_QUEUE,ApplicationRuntime=DataBrokerEAR1_2,Type=EJBPoolRuntime,EJBComponentRuntime=DataBrokerEJB new:[email protected] existing weblogic.ejb.container.monitoring.EJBPoolRuntimeMBeanImpl@7db003
                   at weblogic.management.jmx.ObjectNameManagerBase.registerObject(ObjectNameManagerBase.java:146)
                   at weblogic.management.mbeanservers.internal.WLSObjectNameManager.lookupObjectName(WLSObjectNameManager.java:133)
                   at weblogic.management.jmx.modelmbean.WLSModelMBeanFactory.registerWLSModelMBean(WLSModelMBeanFactory.java:86)
                   at weblogic.management.mbeanservers.internal.RuntimeMBeanAgent$1.registered(RuntimeMBeanAgent.java:104)
                   at weblogic.management.provider.internal.RegistrationManagerImpl.invokeRegistrationHandlers(RegistrationManagerImpl.java:205)
                   at weblogic.management.provider.internal.RegistrationManagerImpl.register(RegistrationManagerImpl.java:85)
                   at weblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelegate.java:320)
                   at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:257)
                   at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:222)
                   at weblogic.ejb.container.monitoring.EJBPoolRuntimeMBeanImpl.<init>(EJBPoolRuntimeMBeanImpl.java:32)
                   at weblogic.ejb.container.monitoring.MessageDrivenEJBRuntimeMBeanImpl.<init>(MessageDrivenEJBRuntimeMBeanImpl.java:49)
                   at weblogic.ejb.container.manager.MessageDrivenManager.initialize(MessageDrivenManager.java:503)
                   at weblogic.ejb.container.manager.MessageDrivenManager.setup(MessageDrivenManager.java:120)
                   at weblogic.ejb.container.manager.MessageDrivenManager.setup(MessageDrivenManager.java:146)
                   at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createMDManager(MessageDrivenBeanInfoImpl.java:1481)
                   at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createDDMDManagers(MessageDrivenBeanInfoImpl.java:1378)
                   at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.onDDMembershipChange(MessageDrivenBeanInfoImpl.java:1285)
                   at weblogic.jms.common.CDS$DD2Listener.listChange(CDS.java:454)
                   at weblogic.jms.common.CDSServer$DDHandlerChangeListener.statusChangeNotification(CDSServer.java:167)
                   at weblogic.jms.dd.DDHandler.callListener(DDHandler.java:318)
                   at weblogic.jms.dd.DDHandler.callListeners(DDHandler.java:344)
                   at weblogic.jms.dd.DDHandler.run(DDHandler.java:282)
                   at weblogic.jms.common.SerialScheduler.run(SerialScheduler.java:37)
                   at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
              >
              ####<May 26, 2006 7:42:13 PM EDT> <Info> <EJB> <ist-clft2> <wltest1> <ExecuteThread: '1' for queue: 'default'> <<WLS Kernel>> <> <> <1148686933069> <BEA-010060> <The Message-Driven EJB: RhapsodyMDB has connected/reconnected to the JMS destination: weblogic.jms.DMB_BEAN_QUEUE.></i>
              <b>
              Generally this happend after there were cluster communication issues. Multi-cast messages were lost and our MDB reconnects to the JMS queues as indicated by the below log:</b>
              <i>####<May 30, 2006 5:19:06 PM EDT> <Info> <EJB> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '54' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1149023946040> <BEA-010060> <The Message-Driven EJB: DataBrokerMDB has connected/reconnected to the JMS destination: weblogic.jms.PHINMS_DMB_QUEUE.>
              ####<May 30, 2006 5:19:10 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023950228> <BEA-000112> <Removing RAPBEA3S jvmid:720875810499147484S:cmts-rap-bea3:[7005,-1,-1,-1,-1,-1,-1]:DMBstg:RAPBEA3S from cluster view due to timeout.>
              ####<May 30, 2006 5:19:11 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023951009> <BEA-000115> <Lost 2 multicast message(s).>
              ####<May 30, 2006 5:19:11 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023951040> <BEA-000111> <Adding RAPBEA3S with ID 720875810499147484S:cmts-rap-bea3:[7005,-1,-1,-1,-1,-1,-1]:DMBstg:RAPBEA3S to cluster: DMBstg_cluster view.></i>
              <b>
              This would cause the queues to eventually have hundreds of consumers and cause the server to fail.
              Basically, it seems as though the MDBs that are supposed to stop continue and attempt to process, while new threads connect to the JMS queues.
              I tried undeploying our application and deleted it from the configuration. However there were consumers still on the respective queues and when I sent messages, I got an error indicating a "Class Not Found exception" due to the fact that the EJB was undeployed and deleted from the configuration, however the MDB component was not and continued to listen for messages. In 8.1.5, as soon as the application was undeployed, there were zero consumers on the JMS queues.
              I have read the posts about a soon to be released fix that would have the MDBs connect only to the queues locally and not go out the the cluster. Would this fix my issue?
              Is there something in the deployment descriptor to configure that will cause it to disconnect and now spawn so many consumers to the JMS queues?
              Why is it that the number of MDB consumers on the JMS queues stayed static in 8.1.5, but they are erratic in 9.1 even after I set our 9.1 server to use the 8.1.5 execute queue policy. Help would be much appreciated.</b>

    I recommend contacting customer support. There's a known problem with MDBs listening to distributed destinations that are local to the same cluster as the MDB, you're problem may be related (the clue is that the stack trace contains jms.dd.DDHandler.callListeners()). The problem is that the MDB connects to all physical queues in a distributed destination rather than just the local queue.
              Tom

  • ClassCastException with javax.jms.ObjectMessage

    Hello
              I have the following problem:
              I filled a JMS queue with ObjectMessages containing a so called container class (self written, plain old java class implementing serializable).
              I have also written a Servlet that runs in the same EAR like the EJB that fills the JMS queue. This servlet uses a JMS QueueBrowser to show the messages. It casts the Message to ObjectMessage, calls getObject() and casts again in my container class.
              Now when I shutdown the server, regenerate my source and restart the server, the last cast to my container class doesn't work anymore (ClassCastException). When I print out the hash value of the class (containerFromObjectMessage.getClass().hashCode() and Container.class.hashCode() those two hashcodes are different!
              Does anybody have an idea? Is there a switch that I have to set to my WLS 8.1 be a little less secure?
              Regards,
              Stephan

    Correction:
              This only happens when I don't restart my server. So when I hot deploy the EAR with the new compiled classes it doesn't work (ClassCastException). But when I restart the server the servlet runs fine.
              So there must be a cache in the server or something like that.
              Does anybody know any hints or tips to help me?
              Stephan

  • Not able to consume JMS Q by standalone App

    We are making use JMS Q to store the request and build another standalone job to consume it. But some time how our standalone app not able to retrieve message from Q and we need to restart the app many times then it will working fine. Do you have any idea of it? Should we update any weblogic patch?

    There are no errors /exceptions. The project is deployed, since it is a JMS adapter with consume operation it should poll the queue and get the message if it is available.
    This is the *.jca file for adapter.
    <adapter-config name="psoftconsume" adapter="Jms Adapter" wsdlLocation="psoftconsume.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/JMS/RemoteQueue" UIConnectionName="remotewls" UIJmsProvider="WLSJMS" adapterRef=""/>
    <endpoint-activation portType="Consume_Message_ptt" operation="Consume_Message">
    <activation-spec className="oracle.tip.adapter.jms.inbound.JmsConsumeActivationSpec">
    <property name="DestinationName" value="eis/JMS/RemoteQueue"/>
    <property name="UseMessageListener" value="false"/>
    <property name="PayloadType" value="TextMessage"/>
    </activation-spec>
    </endpoint-activation>
    </adapter-config>

  • Error when consuming JMS messages in clustered environment

    Hi ,
    I have the following setup:
    2 ManagedServers configured in a cluster: ManagedServer1a and ManagedServer2.
    JMSServer: Configured on ManagedServer1a.
    ConnectionFactory : Associated with the Cluster
    Queues and Topics : Associated with the JMSServer.
    PersistentStore: Associated with ManagedServer1a.
    Job Creator deployed on ManagedServer1a
    Job Consumer deployed on ManagedServer2.
    I see the following exception in the ManagedServer2 logs when it tries to consume the message.
    ========8<========8<========8<========8<========8<========8<========8<========8<========8<========8<
    <Mar 19, 2009 5:01:43 PM IST> <Warning> <RMI> <BEA-080005> <Exception thrown by
    rmi server: dispatch
    java.rmi.UnmarshalException: error unmarshalling arguments, count=410, lastMethodId15629, lastRequestType9; nested exception is:
    java.io.UTFDataFormatException.
    java.rmi.UnmarshalException: error unmarshalling arguments, count=410, lastMethodId15629, lastRequestType9; nested exception is:
    java.io.UTFDataFormatException
    at weblogic.messaging.dispatcher.DispatcherServerRef.invoke(DispatcherServerRef.java:232)
    at weblogic.messaging.dispatcher.DispatcherServerRef.handleRequest(DispatcherServerRef.java:141)
    at weblogic.messaging.dispatcher.DispatcherServerRef.access$000(DispatcherServerRef.java:34)
    at weblogic.messaging.dispatcher.DispatcherServerRef$2.run(DispatcherServerRef.java:111)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    Truncated. see log file for complete stacktrace java.io.UTFDataFormatException
    at weblogic.utils.io.ChunkedDataInputStream.readUTFFromChunk(ChunkedDataInputStream.java:298)
    at weblogic.utils.io.ChunkedDataInputStream.readUTF(ChunkedDataInputStream.java:178)
    at weblogic.workarea.spi.WorkContextEntryImpl.readEntry(WorkContextEntryImpl.java:92)
    at weblogic.workarea.WorkContextLocalMap.receiveRequest(WorkContextLocalMap.java:151)
    at weblogic.jms.common.JMSWorkContextHelper.readWorkContext(JMSWorkContextHelper.java:89)
    Truncated. see log file for complete stacktrace
    >
    <Mar 19, 2009 5:01:54 PM IST> <Warning> <Socket> <BEA-000449> <Closing socket as no data read from it during the configured idle timeout of 5 secs>
    ========8<========8<========8<========8<========8<========8<========8<========8<========8<========8<
    I also notice that after this the persistence store appears to be corrupted. I get the exception:
    ========8<========8<========8<========8<========8<=======
    <Mar 20, 2009 2:15:03 PM IST> <Error> <JMS> <BEA-040123> <Failed to start JMS Server "JDJMSServer" due to weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Unexpected store exception in messaging kernel recovery.
    weblogic.jms.common.JMSException: weblogic.messaging.kernel.KernelException: Unexpected store exception in messaging kernel recovery
    at weblogic.jms.backend.BackEnd.open(BackEnd.java:999)
    at weblogic.jms.deployer.BEAdminHandler.activate(BEAdminHandler.java:196)
    at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:239)
    at weblogic.management.utils.GenericServiceManager.activateDeployment(GenericServiceManager.java:131)
    at weblogic.management.internal.DeploymentHandlerHome.invokeHandlers(DeploymentHandlerHome.java:591)
    Truncated. see log file for complete stacktrace weblogic.messaging.kernel.KernelException: Unexpected store exception in messaging kernel recovery
    at weblogic.messaging.kernel.internal.PersistenceImpl.recover(PersistenceImpl.java:913)
    at weblogic.messaging.kernel.internal.KernelImpl.open(KernelImpl.java:239)
    at weblogic.jms.backend.BackEnd.open(BackEnd.java:997)
    at weblogic.jms.deployer.BEAdminHandler.activate(BEAdminHandler.java:196)
    at weblogic.management.utils.GenericManagedService.activateDeployment(GenericManagedService.java:239)
    Truncated. see log file for complete stacktrace
    weblogic.store.PersistentStoreException: [Store:280052]The persistent store was not able to read a record.
    at weblogic.store.internal.PersistentStoreRecordImpl.getData(PersistentStoreRecordImpl.java:66)
    at weblogic.messaging.kernel.internal.PersistenceImpl.recoverHeaders(PersistenceImpl.java:1226)
    at weblogic.messaging.kernel.internal.PersistenceImpl.recover(PersistenceImpl.java:888)
    at weblogic.messaging.kernel.internal.KernelImpl.open(KernelImpl.java:239)
    at weblogic.jms.backend.BackEnd.open(BackEnd.java:997)
    Truncated. see log file for complete stacktrace
    java.io.StreamCorruptedException: [Messaging:282000]Unsupported class version 48. Expected a value between 1 and 3 inclusive.
    ================8<================8<================8<================8<================8<
    Any clues on why this error occurs? And how to resolve it?

    Which WLS version are you using?
    CR293674 seems to for issue related to persistent store.
    In certain circumstances, the invocation of a WebLogic Web Service configured for reliable messaging will throw the following PersistentStoreRuntimeException error:
    weblogic.store.PersistentStoreRuntimeException: [Store:280051]The persistent store was not able to create a new record.
    Workaround or Solution:
    When starting the WebLogic Server instance to which the reliable Web Service is deployed, set the following property:
    -Dweblogic.wsee.exclude.properties=weblogic.wsee.ejb.target
    Refer: http://download.oracle.com/docs/cd/E11035_01/wls100/issues/known_resolved.html#wp1056965
    -Akshay

  • How to consume JMS message in oc4j from web logic server 11.1.1.3

    Hi all,
    I would like to know how to consume the JMS messages in oc4j instance from 11.1.1.3 (web logic). Can anyone guide me any documentation? Thanks.
    Soe

    Hi,
    Have a luk at the below link
    http://blogs.oracle.com/TechMusings/2008/08/connecting_to_weblogic_jms_pro.html
    you also have other options like creating foreigh JNDI or JMS bridge.

  • Producer and Consumer  JMS Connections

    Hello,
    I am writing a JMS provider and I notice that Flex creates a
    JMS connection for a Producer and another JMS connection for a
    Consumer in my test application. Is this normal behavior for Flex
    or do I have a problem with my provider that is causing this?
    Thanks,
    Chris Shafer, George Weiss Associates

    If your goal is to have one JMS Consumer which receives
    messages and broadcasts them to Flex clients, you can do this
    without using the JMS adapter. Write some Java code either as a
    "message driven bean" or using the JMS apis directly to grab the
    JMS messages. You can then convert these messages to flex messages
    and send them to an ActionScriptAdapter flex messaging destination.
    See the Feed.java sample for the code necessary to do this. The
    trickiest part of this is getting the JMS messages in the first
    place. We are working on packaging up our JMS consumer apis so you
    can do this more easily in a future release.

  • Java JMS ObjectMessage

    Hey there
    Been struggeling all day + yesterday on how to store a pdf-message into a (Glassfish) jms queue from a Replier-class, and then to retreive it in a Requestor class.
    The scenario:
    Requestor---sends file to jms/RequestQueue-->
    Replier----processes the file-->
    Replier---sends pdffile to jms/ReplyQueue-->
    Rquestor---retreives jms/RequestQueue and sends it to a browser->
    My issue is.
    The Replier
    String fil = "C:/PDFTEST/"+pdffile+".PDF";
    File file = new File(fil);
    ObjectMessage outMessage = session.createObjectMessage();
    outMessage.setObject(file);
    outMessage.setJMSCorrelationID(message.getJMSCorrelationID());
    replyProducer.send(outMessage);Everything seems to work from Requestor send to MQ, The Replier above gets the file to process, and to store the File as a ObjectMessage in MQ...But, when the Replier gets the file from MQ it can't get it out as a java.io.File.
    ErrorCode:
    java.lang.NullPointerException
         at com.edbteamco.common.servlet.OnlineFaktura.invoiceGET(OnlineFaktura.java:273)
         at com.edbteamco.common.servlet.OnlineFaktura.doGet(OnlineFaktura.java:108)The RequestorCode:
    queueConnection.start();    
    QueueReceiver queueReceiver = queueSession.createReceiver(repQueue, "JMSCorrelationID = '" + jmsCorrelationID + "'");    
    msgReceived = (ObjectMessage) queueReceiver.receive(10000);
    response.setContentType ("application/pdf");
    response.setHeader           ("Content-Disposition", "attachment; filename=\"testfilen.txt\"");
    response.setHeader("cache-control", "no-cache");
    InputStream in = new FileInputStream((File)message.getObject()); the line **InputStream in = new FileInputStream((File)message.getObject()); ** causes the error
    Anyone up for helping?:)

    Yes, he gave me the solution, but not how to implement it. I think the documentation is not verry good when it comes to handling files through jms.
    I've now tried the following:
    InputStream is = new FileInputStream(new File(".....filelocation....."));
    long length = file.length();
    byte[] bytes = new byte[(int)length];
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0)
        offset += numRead;
    BytesMessage outMessage = session.createBytesMessage();
    outMessage.setJMSCorrelationID(message.getJMSCorrelationID());
    outMessage.writeBytes(buffer);
    replyProducer.send(outMessage);And when I try to open that file up on my client, I get a nullPointerException:
    msgReceived = (BytesMessage) queueReceiver.receive(10000);
    // How to read the bytes right???
    ServletOutputStream outs = response.getOutputStream();
    while (true)
             try {
                  byte b = ((BytesMessage)message).readByte();
                  outs.write((int)b);
                  System.out.println("Byte: " + (int)b);
                  catch (MessageEOFException e) {
                       break;
    Please help
    Cincerely Paul

  • JMS ObjectMessage getObject() problem

    Does anyone know if one can get an object of a class that has a reference to an interface/abstract class from the ObjectMessage in JMS?
    For example, class A has a reference of an abstract class AA. When sending an object message in JMS,
    one creates an instance of A, A', and an instance of AB, AB', (which is a concrete implementation of abstract class AA), assigns AB' to A' via setter method and put A' into the object message and send it out.
    The problem I am having is on the receiving end. JMS throws IOException (wrapped within JMSException) when the receiving end tries to do getObject().
    Any pointer or enlightenment on this is greatly appreciated. Thanks in advance.

    I've done what you are talking about so it is possible. The trick is to ensure that all classes that are contained in the ObjectMessage, including class A and classes referred to by class A, are Serializable.

  • Re: Consuming jms queue synchronously in SOA11g

    Hi
    I have the below requirement
    In Queue total 5 messages are there, in those 3 are with same ID and 2 are with same ID.
    My requirement is that for the above 5 messages only two BPEL processes should be created for each ID.
    1st BPEL consumes 3 messages
    2nd BPEL consumes 2 messages
    Please give me idea to do this.
    Thanks in Advance
    Vamsi..

    Hello friend,
    So, according to your scenario...you are producing messages into the Queue using JMS Adapter Outbound Operation ( JMS adapter is on the references side)
    And as we know, in order to read the message from JMS Queue we use JMS Adapter and that would be inbound operation (JMS adapter is on the services side)
    So, when we define a JMS adapter in our composite as consume message operation...then the JMS adapter will be on the services side...then we declare our BPEL interface based on the WSDL of JMS Adapter (Consume operation). SO by default the interface of the BPEL would be one-way i.e., just fire and forget. So, lets say you wrote 10 messages to the Queue. So, the consuming BPEL would take all messages at a time...as you said there would be 10 instances....
    So, if you make the interface of the BPEL to synchronous and also you just need to reply back ( any dummy message) to JMS adapter....just keep a reply activity at the end of the BPEL ...so by doing this...unless and until it gets the response from the synchronous BPEL (consuming BPEL), the JMS adapter doesn't give the next message in the Queue to the BPEL...that means at any point of time only one BPEL instance would be running for you which is what we want to achieve...And you can see this clearly in the Queue in the weblogic admin console...This is called throttling the JMS adapter....This works...
    And one more important thing to be considered is...taking the synchronous process time out thing...as we know by default the client of the synchronous process cannot wait for more than 45 seconds...may be if you want more time to process ...you can change that in EM console...BPEL properties in SOA administration...
    I think it is syncMaxWaitTime..change that may be to 300...
    Try this...Hopefully this should work for you..and let us know ...
    Hope this helps...
    Thanks,
    N

Maybe you are looking for