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.
Similar Messages
-
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,
StephanCorrection:
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 -
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 -
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. -
JMS Receiver FCC Problem After Upgraded from SP19 to SP22 in XI3.0
Hello,
I am facing a problem in my Receiver JMS adapter in FCC just after the upgrading it from SP19 to SP22 in XI 3.0 by our basis consultant. Before that everything was working perfect in DEV.
I am getting the below mentioned error in CC monitoring.
> MP: Exception caught with cause com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.NullPointerException''; nested exception caused by: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.NullPointerException'
This problem is happening in other scenario too in our DEV system.
But at the same time since we have not applied any upgrade in QA therefore same scenario is working fine.
Regards,
SarveshOk Friends...
I got the solution from SAP.. there was a problem in the SP22 for XI 3.0 which I donloaded from Service Market Place. Now I have applied the correct SP22 to my system and now it is working fine...
I hope this may help you...
Regards,
Sarvesh -
JMS Listener configuration problem
I am installing IDM6.0 and trying to use the password synch feature with Active Directory. Below are my environment details
tomcat 5.0.28 on linux
Sun Message Queue 3.6 for JMS
When I am configuring the JMS Listener adapter I am getting the below error. I have installed the Sun Message Queue and storing the administered objects in a file.
Test connection failed for resource(s):
JMS Listener: javax.naming.NameNotFoundException
If anyone has ever done that earlier it will be very helpful for me.
Thanks in advanceJust an update on my last comment
I had tested this on the windows box. The problem may not be there in the Linux -
JMS cluster configuration problem
Problem description:
I have a OC4J cluster with two OC4J instances (referred to as I1 and I2) each having their own JMS Server (referred to JMS1 and JMS2). For certain messaging scenarios (not all) it is necessary that I1 puts a message on a queue of I2.
In order to do that I use the following configuration:
I2 -> jms.xml
<jms-server host="[ALL]" port="9127">
<queue-connection-factory location="xyz.ConnectionFactory" host="I1" />
<queue name="queue1" location="xyz.queue" persistence-file="queue1.file"/>
I1 -> jms.xml
<jms-server host="[ALL]" port="9127">
<queue-connection-factory location="xyz.ConnectionFactory" />
<queue name="queue1" location="xyz.queue" persistence-file="queue1.file"/>
When I try to send a message from I2 to I1, using the connection factory stored under xyz.ConnectionFactory I get the following exception:
Caused by: javax.transaction.RollbackException at com.evermind.server.ApplicationServerTransaction.handleCommitSystemException(ApplicationServerTransaction.java:749) at com.evermind.server.ApplicationServerTransaction.twoPhaseCommit(ApplicationServerTransaction.java:688) at com.evermind.server.ApplicationServerTransaction.commitBasedOnResourceCount(ApplicationServerTransaction.java:514) at com.evermind.server.ApplicationServerTransaction.doCommit(ApplicationServerTransaction.java:246) at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:126)
at com.evermind.server.ApplicationServerTransactionManager.commit(ApplicationServerTransactionManager.java:433) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:757)
... 45 more
Caused by: oracle.as.j2ee.transaction.tpc.ConnectionLostException: Handing off to RecoveryManager due to lost connection to resource or RMERR. Branch: [null, Xid( Global Id da.f9.b0.f7.ff.ff.ff.ff.0a.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00, Format Id 4660, Branch Id e8.df.1f.91.00.00.00.00.00.00.00.00.00.00.00.01), null, state={ACTIVE}, exception error code=-3]
at oracle.as.j2ee.transaction.tpc.Coordinator.lostResourceCleanup(Coordinator.java:628)
at oracle.as.j2ee.transaction.tpc.Coordinator.checkForLostConnection(Coordinator.java:600)
at oracle.as.j2ee.transaction.tpc.Coordinator.actOnEligibleBranch(Coordinator.java:553)
at oracle.as.j2ee.transaction.tpc.Coordinator.doRollback(Coordinator.java:499)
at oracle.as.j2ee.transaction.tpc.Coordinator.doRollbackWithRollbackException(Coordinator.java:229)
at oracle.as.j2ee.transaction.tpc.Coordinator.doPrepare(Coordinator.java:216)
at oracle.as.j2ee.transaction.tpc.Coordinator.doResolve(Coordinator.java:278)
at oracle.as.j2ee.transaction.tpc.Coordinator.resolve(Coordinator.java:115)
at oracle.as.j2ee.transaction.tpc.TwoPhaseCommitEngine.commit(TwoPhaseCommitEngine.java:93)
at com.evermind.server.ApplicationServerTransaction.twoPhaseCommit(ApplicationServerTransaction.java:686)
... 50 more
Question:
1: Do I use the right configuration for above messaging scenario (the Oracle documentation I’ve read about this subject (High Availability Guide) is very vague) ?
2: So yes, what do I do wrong?
Any help would be greatly appreciated!Above problem could be resolved.
1. The problem only occured when sending a message within a transaction. Without transaction everything worked fine.
2. Due to this strange behaviour we assumed that this is a bug - and it was. This bug has the issue nummer: 5331629. In version 10.1.3.1.0 this issue is resolved. We tested it and indeed it worked as excpected. -
All,
We're running into some strange problems synchronizing Toplink caches via JMS.
In our environment, we have two different applications running under the same app server - different code in general, but they use the same Toplink mapping and mapped classes. Each of these connects to the database independently of the other using Toplink. We've configured sessions.xml to keep the caches between the two synchronized.
Now when an object is updated on one side or the other, the message gets sent out across JMS. However, when both applications read the message back in, we get strange errors like this one:
ServerSession(1204462)--Thread[PointcastTopicConnection,5,main]--EXCEPTION [TOPLINK-10000] (TopLink - 9.0.3.5 (Build 436)): oracle.toplink.exceptions.JMSProcessingException
EXCEPTION DESCRIPTION: (There is no English translation for this exception.)
INTERNAL EXCEPTION: javax.jms.MessageFormatException: Unable to deserialize object: java.lang.ClassCastException: Assigning instance of class oracle.toplink.internal.sessions.ObjectChangeSet to field oracle.toplink.internal.sessions.ObjectReferenceChangeRecord#newValue
Has anyone seen something like this before? We're using Toplink 9.0.3.5 with OC4J 9.0.2.2 (build 021224.1834).
(Apologies if this isn't Toplink-related. It's hard to tell if this is the App Server or Toplink failing here)
Thanks
- DonI found this on http://download.oracle.com/docs/cd/B10464_05/web.904/b10313/cache.htm
Note:
When you select JMS as the transport mechanism in the clustering-service element, OracleAS TopLink ignores the discovery setting.
Does ignoring the discovery setting mean that it is not used?
Thanks. -
JMS EBCDIC BytesMessage Problem
We are using the strict JMS API to send message to MQ which will kick off an IMS transaction. We are connecting to IMS using the OTMA bridge. We are trying to send a BytesMessage which kicks off the transaction successfully and a BytesMessage is returmed to our local queue with the resulting message String from IMS transaction. When we go to pull the
We get a garbage message along the lines of:
�����������@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....
AppServer: Linux box running WAS 5.1
Mainframe: z/OS box
Does anybody know what needs to be set before the message is sent and what needs to be done after we get the message in order for us to get the message string into a UTF format that isn't garbled?
// setting the following JMS props
msg.setStringProperty("JMS_IBM_Format", "MQIMSVS");
msg.setStringProperty("JMS_IBM_Character_Set", "819");
// pulling out the message body
BytesMessage bymRecv = (BytesMessage)recv.receive(5000);
// retrieve the message body
byte msgInBytes[];
ByteArrayOutputStream bout;
int lenRead;
msgInBytes = new byte[100];
lenRead = bymRecv.readBytes(msgInBytes, 100);
bout = new ByteArrayOutputStream();
bout.write(msgInBytes, 0, lenRead);
outputString = bout.toString("CP1047"); // not sure if this is right
Or, if we are doing this completely wrong, does anybody have any suggestions.
Thanks!Above problem could be resolved.
1. The problem only occured when sending a message within a transaction. Without transaction everything worked fine.
2. Due to this strange behaviour we assumed that this is a bug - and it was. This bug has the issue nummer: 5331629. In version 10.1.3.1.0 this issue is resolved. We tested it and indeed it worked as excpected. -
Hi all
I have a problem with MQJMS...I am successful in putting the message to the queue and also reading it...but the problem is that i was trying to put a string message in the queue...but i am not able to read the original string from the message.this is the code i used....
Putting the message in the queue
String Buffer = "Message";
boolean transacted = false;
session = qconnection.createQueueSession( transacted, Session.AUTO_ACKNOWLEDGE);
BytesMessage message =
session.createBytesMessage();
message.setJMSType("DATAGRAM");
message.setStringProperty("Fmt","PLAINTEXT");
message.writeBytes(Buffer.getBytes());
qSender = session.createSender(ioQueue);
qSender.send(message);
Reading the message from the queue
QueueReceiver queueReceiver = session.createReceiver(ioQueue);
Message msg = queueReceiver.receive(Long.parseLong(pollTime));
If I try to print the msg i am getting the details as
JMS Message class: jms_bytes
JMSType: String
JMSDeliveryMode: 2
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: ID:414d5120454149544553544d47522020456e8f002004d901
JMSTimestamp: 1165040197487
JMSCorrelationID:null
JMSDestination: queue://EAITESTMGR/BALU.IN
JMSReplyTo: null
JMSRedelivered: false
JMSXDeliveryCount:1
JMS_IBM_MsgType:8
Fmt:PLAINTEXT
JMSXAppID:java
JMS_IBM_Format:
JMS_IBM_Encoding:273
JMS_IBM_PutApplType:6
JMS_IBM_Character_Set:UTF8
JMSXUserID:eaijdev
JMS_IBM_PutTime:06163748
JMS_IBM_PutDate:20061202
Integer encoding: 1, Floating point encoding 256
54484953204d45535341474520495320564941204a4d53204348414e4e454c
But the thing i need is to get the same string value ie Message
Anyone out there could please help me out with this
Thanks in advance
BalagopalSee: http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/jms_tutorialTOC.html
BTW you are diplaying the toString() value of the Message object itself. You need to call the Message class's method to get the message out of the Message object. -
JMS Messaging Bridge Problems with WLS 8.1 sp2
Thank you in advance for your help.
I am trying to configure a JSM Messaging Bridge to connect an MQ Q to a Weblogic
Q. I have this working wonderfully in an environment without clustering but once
I try to deploy to a cluster, I am having two major problems.
1) When the managed servers are restarted, the messaging bridges immediately complain
about not being able to find the resource adaptor. After I manually un-target
the messaging bridge from the cluster and re-target them, they find the resource
adaptor but cannot connect to the source... which leads to my next problem.
2) The messaging bridges cannot connect to the source destination whether it is
an MQ Q or a Weblogic JMS Q does not matter. Here are the log entries that I
see relative:
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! Got Notification:weblogic.management.AttributeAddNotification:
Deployments from <null> to [Caching Stub]Proxy for eBusDev02:Location=secaServer01,Name=seca_OES_ADV_REPLY
Messaging Bridge,Type=MessagingBridgeConfig - weblogic.management.AttributeAddNotification[source=eBusDev02:Location=secaServer01,Name=secaServer01,Type=ServerConfig].>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! creating bridge seca_OES_ADV_REPLY Messaging
Bridge.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! Bridge seca_OES_ADV_REPLY Messaging Bridge
is deployed as a migratable.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging RUNTIME! Initializging bridge seca_OES_ADV_REPLY Messaging
Bridge as a migratable.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! Bridge seca_OES_ADV_REPLY Messaging Bridge's
source configurations are:
AdapterJNDIName=eis.jms.WLSConnectionFactoryJNDIXA
Classpath=null
ConnectionURL = file:/e:/private/JNDI/eBusDev02
DestinationType = Queue
DestinationJNDIName = jms.oes.MQ-ADV-REPLYQ
InitialContextFactory = com.sun.jndi.fscontext.RefFSContextFactory
ConnectionFactoryJNDIName = jms.oes.MQ-QCF
.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! Bridge seca_OES_ADV_REPLY Messaging Bridge's
target configurations are:
AdapterJNDIName=eis.jms.WLSConnectionFactoryJNDIXA
Classpath=null
ConnectionURL = t3://30.135.10.63:8103,30.135.10.63:8104
DestinationType = Queue
DestinationJNDIName = jms/oes/ADV-REPLYQ
InitialContextFactory = weblogic.jndi.WLInitialContextFactory
ConnectionFactoryJNDIName = jms/oes/QCF
.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging STARTUP! Bridge seca_OES_ADV_REPLY Messaging Bridge
is successfully initialized.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging RUNTIME! Bridge seca_OES_ADV_REPLY Messaging Bridge
has been successfully initialized as a migratable.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging RUNTIME! Activating bridge seca_OES_ADV_REPLY Messaging
Bridge.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '1' for queue: 'weblogic.admin.RMI'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging RUNTIME! Bridge seca_OES_ADV_REPLY Messaging Bridge
has been successfully activated..>
####<Apr 1, 2004 4:38:44 PM EST> <Info> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '22' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-200033>
<Bridge "seca_OES_ADV_REPLY Messaging Bridge" is obtaining connections to the
two adapters.>
####<Apr 1, 2004 4:38:44 PM EST> <Debug> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '22' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-200006>
<Messaging bridge debugging RUNTIME! Bridge seca_OES_ADV_REPLY Messaging Bridge
Getting source connection.>
####<Apr 1, 2004 4:38:44 PM EST> <Info> <MessagingBridge> <dv2kwls03> <secaServer01>
<ExecuteThread: '22' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-200042>
<Bridge seca_OES_ADV_REPLY Messaging Bridge failed to connect to the source destination
and will try again in 15 seconds. (java.lang.NullPointerException)>
I know the queues are up and I am pretty sure my MQ client configuration is correct.
Is there anyway to get more information about the NullPointerException or the
error being encountered?
Given that you have ruled out message backlogs, my first suspicion is that the leak has something to do with connection allocation. Does JMS stats reveal an application generated connection leak? Check to see if the current number of connections/sessions stays steady.
If this doesn't help, you can use a third party tool like OptimizeIt to get periodic snap-shots of memory usage and identify the leaked object (or create a reproducer and have customer support do it). A possible work-around is to modify your app to pool JMS connections/sessions for re-use - greatly reducing the number of connections created per day.
Tom -
Rs.getObject() problems
Environment:
WebLogic 6.1sp1
AIX 4.3.3.0
java full version "J2RE 1.3.0 IBM build ca130-20010615a"
Oracle server 8.1.7.0.0
Oracle client 8.1.7.0.0
In certain cases when we call ResultSet.getObject() on an Oracle column defined
as a NUMBER(10) which contains a NULL, we get the following:
java.sql.SQLException: java.lang.NumberFormatException - ''
at weblogic.jdbc.oci.ResultSet.getObject(ResultSet.java(Compiled Code))
at weblogic.jdbc.pool.ResultSet.getObject(ResultSet.java(Compiled Code))
at ReadServlet.unpackResultSet(ReadServlet.java(Compiled Code))
at ReadServlet.process(ReadServlet.java(Compiled Code))
at ReadServlet.doPost(ReadServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java(Compiled
Code))
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java(Compiled
Code))
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java(Compiled Code))
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
We can consitently reproduce this problem with a given set of Oracle rows, and
changing the column value from NULL to 0 sometimes makes the problem go away,
but not always!
Is the above a known issue?
We've seen some newsgroup posts that suggest moving to Oracle's thin driver as
a workaround for similar issues; is this still the recommendation?Hello Doug,
There is a known problem in the Oracle jdriver referenced as CR055435 and fixed.
CR055435: JDriver for Oracle fails to retrieve correct number of null values when the data base table has
more than 500 rows.
I suggest to you to contact BEA support to request a patch.
Regards
Doug Bloebaum wrote:
Environment:
WebLogic 6.1sp1
AIX 4.3.3.0
java full version "J2RE 1.3.0 IBM build ca130-20010615a"
Oracle server 8.1.7.0.0
Oracle client 8.1.7.0.0
In certain cases when we call ResultSet.getObject() on an Oracle column defined
as a NUMBER(10) which contains a NULL, we get the following:
java.sql.SQLException: java.lang.NumberFormatException - ''
at weblogic.jdbc.oci.ResultSet.getObject(ResultSet.java(Compiled Code))
at weblogic.jdbc.pool.ResultSet.getObject(ResultSet.java(Compiled Code))
at ReadServlet.unpackResultSet(ReadServlet.java(Compiled Code))
at ReadServlet.process(ReadServlet.java(Compiled Code))
at ReadServlet.doPost(ReadServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java(Compiled
Code))
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java(Compiled
Code))
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java(Compiled
Code))
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java(Compiled Code))
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
We can consitently reproduce this problem with a given set of Oracle rows, and
changing the column value from NULL to 0 sometimes makes the problem go away,
but not always!
Is the above a known issue?
We've seen some newsgroup posts that suggest moving to Oracle's thin driver as
a workaround for similar issues; is this still the recommendation?--
Roula Korkmaz
Developer Relations Engineer
BEA Support -
Hi all
I have a problem with MQJMS...I am successful in putting the message to the queue and also reading it...but the problem is that i was trying to put a string message in the queue...but i am not able to read the original string from the message.this is the code i used....
Putting the message in the queue
String Buffer = "Message";
boolean transacted = false;
session = qconnection.createQueueSession( transacted, Session.AUTO_ACKNOWLEDGE);
BytesMessage message =
session.createBytesMessage();
message.setJMSType("DATAGRAM");
message.setStringProperty("Fmt","PLAINTEXT");
message.writeBytes(Buffer.getBytes());
qSender = session.createSender(ioQueue);
qSender.send(message);
Reading the message from the queue
QueueReceiver queueReceiver = session.createReceiver(ioQueue);
Message msg = queueReceiver.receive(Long.parseLong(pollTime));
If I try to print the msg i am getting the details as
JMS Message class: jms_bytes
JMSType: String
JMSDeliveryMode: 2
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: ID:414d5120454149544553544d47522020456e8f002004d901
JMSTimestamp: 1165040197487
JMSCorrelationID:null
JMSDestination: queue://EAITESTMGR/BALU.IN
JMSReplyTo: null
JMSRedelivered: false
JMSXDeliveryCount:1
JMS_IBM_MsgType:8
Fmt:PLAINTEXT
JMSXAppID:java
JMS_IBM_Format:
JMS_IBM_Encoding:273
JMS_IBM_PutApplType:6
JMS_IBM_Character_Set:UTF8
JMSXUserID:eaijdev
JMS_IBM_PutTime:06163748
JMS_IBM_PutDate:20061202
Integer encoding: 1, Floating point encoding 256
54484953204d45535341474520495320564941204a4d53204348414e4e454c
But the thing i need is to get the same string value ie Message
Anyone out there please help me out with this
Thanks in advance
BalagopalWhy dont you send a TextMessage instead of a BytesMessage? Something like:
String message = "Hi, what's up?";
TextMessage textMessage = queueSession.createTextMessage(message);
queueSender.send(textMessage);And then at the receiver's end:
QueueReceiver queueReceiver = session.createReceiver(ioQueue);
Message message = queueReceiver.receive(Long.parseLong(pollTime));
if (message instanceof TextMessage) {
* Since message is an instance of TextMessage, cast it to TextMessage to get access to
* APIs available on TextMessage
TextMessage textMessage = (TextMessage) message;
System.out.println("Message received: " + textMessage.getText());
} -
JMS JNDI configurtaration problem
IHAC where we are connecting PeopleSoft Integration Broker. Unfortunately PIB doesn't support LDAP for JNDI (go figure). So I have to use a .bindings file.
Problem is, when I run the HelloWorldMessageJNDI I get the following error:
Using file:///tmp/mq for Context.PROVIDER_URL
Looking up Connection Factory object with lookup name: CSoutboundQCF Connection Factory object found.
Looking up Queue object with lookup name: CSoutboundQ Failed to lookup Queue object.
Please make sure you have created the Queue object using the command:
imqobjmgr -i add_q.props
The exception details:
javax.naming.NameNotFoundException: CSoutboundQ
at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
at javax.naming.InitialContext.lookup(Unknown Source)
at HelloWorldMessageJNDI.<init>(HelloWorldMessageJNDI.java:187)
at HelloWorldMessageJNDI.main(HelloWorldMessageJNDI.java:120)It's looks almost as the same as my problem in web app., when I forgot wrote tags <resource-env-ref in web.xml..
e.g. web.xml
<resource-env-ref>
<resource-env-ref-name>jms/MainQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
<resource-ref>
<res-ref-name>jms/MainQueueConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
</resource-ref>
.... -
Hi guys,
I want to receive messages on a timeout basis. However, my code always stuck at a certain point. Here is my source code:
import javax.jms.*;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.spi.NamingManager;
import java.util.Hashtable;
public class JmsRecv {
public static void main(String[] args) throws JMSException, NamingException {
Context JndiContext = createContextForWeblogic(args[0]);
QueueConnectionFactory TheQueueConnectionFactory = (QueueConnectionFactory) JndiContext.lookup("weblogic.jms.ConnectionFactory");
Queue q = (Queue) JndiContext.lookup("Queue_A");
QueueConnection qc = TheQueueConnectionFactory.createQueueConnection();
qc.start();
QueueSession qs = qc.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
QueueReceiver qr = qs.createReceiver(q, null);
Message mrecv = null;
long elapsed = 0;
int index = 1;
while (mrecv == null && elapsed < 200) {
long start = System.currentTimeMillis();
mrecv = qr.receive(10);
elapsed = System.currentTimeMillis() - start;
System.out.println("index=" + index++ + " elapsed=" + elapsed);
qr.close();
qs.close();
qc.close();
static Context createContextForWeblogic(String connectionURL) {
Context ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, connectionURL);
try {
ctx = NamingManager.getInitialContext(env);
} catch (Exception e) {
e.printStackTrace();
MSFException msfException = new MSFException(e.getMessage());
msfException.initCause(e);
throw msfException;
return ctx;
}And the result is always:
index=1 elapsed=31
index=2 elapsed=16
index=3 elapsed=15
index=139 elapsed=16
index=140 elapsed=15
index=141 elapsed=9391
It always stops at index 141. Why the jms receive with timeout works initially then doesn't work as expected? Any ideas?? I have a similar problem with send too. Send works quickly initially but at a certain point sending takes too much time. Thanks.
Gurkantry moving
long start = System.currentTimeMillis();
outside your while loop. That is your starting point and it should change after you start. But having it in the loop resets it.
Maybe you are looking for
-
Can I use Google Sync to transfer only my contacts from my IPhone 4 to my gmail account? I do not want to sync info from Gmail to the IPhone. Can the sync work only one-way? I have 0 contacts & 0 calendar events on my gmail account. I opened the Gmai
-
Looking for a script to automate renaming layer objects, not the layer itself!
Hey there everyone, I was wondering if there is a possibility to create/have a script for an automated renaming of several named layer objects in Indesign (CS6). The situation, I'm facing is a document for a templating process with at least 80 layers
-
Controlling Apple Chess from the command line
Hello is it possible to control Apple Chess with the command line? I would like to get two computers to play against each other over a wireless connection, either airport of bluetooth. Any other suggestions would be great! Thanks, Tim
-
Hey i want a method to return a JButton like so: public JButton createButton(); // Make the actual button on the screen and pass it back to main button = new JButton(""); // Creates the button return button; // Returns the button to main so only a fe
-
Required Copy Sales Order using API
Hello Everyone, I got a requirement to copy a sales order using API. Did anyone tried this? If possible give me API name or the script. Thanks in advance. Thanx and Regards, Akil