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.
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 -
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/ -
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.
-
JMS Uniform Distribute Queue Unit Of Order, problem when one node goes down
Hi ,
I have the following code which post a message (with Unit of Order set ) to a Uniform Distribute Queue in a cluster with two member servers (server1 and server2).
--UDQ is targeted to a subdeployment that is mapped to two JMS servers pointing to each member servers
--Connection Factory is using default targeting ( i tried mapping to Sub deployment also)
javax.naming.InitialContext serverContext = new javax.naming.InitialContext();
javax.jms.QueueConnectionFactory qConnFactory = (javax.jms.QueueConnectionFactory)serverContext.lookup(jmsQConnFactoryName);
javax.jms.QueueConnection qConn = (javax.jms.QueueConnection)qConnFactory.createConnection();
javax.jms.QueueSession qSession = qConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
javax.jms.Queue q = ( javax.jms.Queue)serverContext.lookup(jmsQName);
weblogic.jms.extensions.WLMessageProducer qSender = (weblogic.jms.extensions.WLMessageProducer) qSession.createProducer(q);
qSender.setUnitOfOrder("MyUnitOfOrder");
javax.jms.ObjectMessage message = qSession.createObjectMessage();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("something", "SomeObject");
message.setObject(map);
qSender.send(message);
} catch (Exception e) {
Steps followed:
1. Post a message from "server1"
2. Message picked up by "server2"
3. Everything fine
4. Shutdown "server2"
5. Post a message from "server1"
6. ERROR: "hashed member of MyAppJMSModule!MyDistributedQ is MyAppJMSModule!MyJMSServer-2@MyDistributedQ which is not available"
WebLogic version : 10.3.5
Is there a way (other than configuring Path Service ) to make this code work "with unit of order" for a UDQ even if some member servers go down ?
Thanks very much for your time.If you want to avoid use of the Path Service, then the alternative is to make the destination members highly available. This will help ensure that the host member for a particular UOO is up.
One approach to HA is to configure "service migration". For more information see the Automatic Service Migration white-paper at
http://www.oracle.com/technology/products/weblogic/pdf/weblogic-automatic-service-migration-whitepaper.pdf
In addition, I recommend referencing Best Practices for JMS Beginners and Advanced Users
http://docs.oracle.com/cd/E17904_01/web.1111/e13738/best_practice.htm#JMSAD455 to help with WL configuration in general.
Hope this helps,
Tom -
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.
RFinally 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! -
One vote for a javax.jms.MapMessage
I need to send and receive MapMessages to integrate with other Java clients in my Flex app however i have seen that in the documentation message-type parameter of the jms property of a message destination only accepts javax.jms.TextMessage and javax.jms.ObjectMessage.
If implementing a MapMessage would not be too difficult and someone can point me in the right direction i would be happy to contribute to the project.
MaxHi Max,
This would be a great enhancement to JMSAdapter and I don't think it'll be hard. These are the classes you need to touch.
-JMSSettings.setMessageType should support the new message type.
-JMSProducer.validate should support the new message type.
-JMSProducer should have a new abstract method called sendMapMessage.
-JMSQueueProducer and JMSTopicProducer should provide the implementation for sendMapMessage.
I think this should be it! Once you get this working, please open an enhancement request to BlazeDS and provide your code. And let us know the bug number here so we can vote for it.
-Mete -
Hi,
i want to pass some kind of object argument using jms ObjectMessage and receive it from OSB proxy service.
I create proxy service as messaging service. but i have no idea with Message Type.
What kind of message type i should use to read java Object message?
Is it possible ?
actually, i am using OSB proxy service as Message receiver.
then when i receive message, i need to read message from soap body and pass as arguments in business service.
Is it possible to achieve this?
With Regards,
WPHi Wai Phyo,
waiphyo wrote:
yeah that is true.
but i still have no idea how to wrap xml into soap body.
that's easy there are several ways for doing it, that's one of the easiest:
http://static.springsource.org/spring-ws/sites/1.5/reference/html/client.html
waiphyo wrote:
and how to make message transformation in proxy services layer.
to transform messages you have to use a mix and match of OSB "Message Processing" actions
http://download.oracle.com/docs/cd/E13171_01/alsb/docs30/userguide/modelingmessageflow.html#wp1070403
and either XQuery or XSLT or both called within your proxy actions.
Regards,
Tony -
Import javax.jms cannot be resolved
This is error i am getting The import javax.jms cannot be resolved even though
my class path contains mail.jar and activation.jar.
please suggest me, to resolve above error
Thanks in advancesir
These below import packages are not resloved by class path
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicPublisher;
import javax.jms.TopicSession;
and below packages are resolved
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException; -
My Code is mentioned below
public class PMLCommandDTO implements Serializable {
ConfigureTagFilter cfgTagFltrObj;
WriteTagData writeTagDataObj;
ExtensionCommand extnCmdObj;
// all getter setter method.
}Now I set ConfigureTagFilter object (which is not serialized) to the
PMLCommandDTO class.
PMLCommandDTO serializedObj;
serializedObj = new PMLCommandDTO();
serializedObj.setCfgTagFltrObj(cfgTagFltrObj);Now Can I my "serializedObj" is serialized and can I use it to
javax.jms.ObjectMessage ---- > setObject(Serializable) method.Cross post, already being responded in
http://forum.java.sun.com/thread.jspa?threadID=5214314&tstart=0
db -
hi all!
i'm working on developing a standalone client for a handheld device running under a J2ME/PersonalJava 3.1 environment connecting to oracle 10.2.0.1.0
my goal is to:
# create a topic subscriber that will handle notifications broadcast on the topic (obviously many devices will be subscribing to the topic)
# keep the client code as portable as possible by using JMS interfaces
these are the classes that i have in my classpath:
* $ORACLE_HOME/jdbc/lib/classes12.jar
* $ORACLE_HOME/jdk/jre/lib/ext/jta.jar
* $ORACLE_HOME/jlib/jndi.jar
* $ORACLE_HOME/rdbms/jlib/aqapi12.jar
* $ORACLE_HOME/rdbms/jlib/jmscommon.jar
here is a sample class to listen to the topic:
import oracle.jms.AQjmsOracleDebug;
import oracle.jms.AQjmsSession;
import oracle.jms.AQjmsTopicConnectionFactory;
import oracle.AQ.AQDriverManager;
import org.apache.log4j.Logger;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import java.io.Serializable;
import java.net.InetAddress;
import java.sql.Connection;
import java.sql.DriverManager;
public class TopicAttachment implements MessageListener {
private final Logger log = Logger.getLogger(getClass());
private final Connection dbConnection;
public TopicAttachment(Connection dbConnection) {
this.dbConnection = dbConnection;
public void attach() throws Exception {
TopicConnection connection = AQjmsTopicConnectionFactory.createTopicConnection(dbConnection, true);
connection.setClientID(InetAddress.getLocalHost().getHostAddress());
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic orderCounts = ((AQjmsSession) session).getTopic("STOREORD", "T_ORDER_COUNTS");
TopicSubscriber subscriber = session.createSubscriber(orderCounts);
subscriber.setMessageListener(this);
connection.start();
public void onMessage(Message message) {
try {
ObjectMessage om = (ObjectMessage) message;
Serializable notification = om.getObject();
log.info("Received notification: " + notification);
// TODO: Handle notification in background thread
} catch (Exception ex) {
log.error("Failure processing notification", ex);
public static void main(String[] args) throws Exception {
System.setProperty("oracle.jms.useEmulatedXA", "false");
System.setProperty("oracle.jms.useNativeXA", "false");
AQDriverManager.disableOciAQ();
AQjmsOracleDebug.setDebug(true);
AQjmsOracleDebug.setTraceLevel(AQjmsOracleDebug.AQ_ORA_TR6);
Class.forName("oracle.jdbc.driver.OracleDriver");
TopicAttachment attachment = new TopicAttachment(DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xxxx", "storeord", "xxxx"));
attachment.attach();
}there are two points where my portability constraints are violated, but that's ok for now.
when i run the example, this is what i get:
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr ctor (user jdbc conn): connection: oracle.jdbc.driver.T4CConnection@d1fa5
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: enter
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: The connection class: oracle.jdbc.driver.T4CConnection
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr ctor (user jdbc conn): exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnectionn ctor (user jdbc conn): connection: oracle.jdbc.driver.T4CConnection@d1fa5 type: 20
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnection.setCompliant: Current <compliant> is set to:true
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.getConnection: use the external connection with usage check
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.getConnection: passed usage check, creating from exteranl connection
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.constructor: dbversion=10201
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setDBRatio: enter
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setRatio: The DB csid = 178
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setRatio: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: entry
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: oracle.jms.useEmulatedXA is off
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.constructor1: oci enabled = false
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnection:createTopicSession: Created session
main AQOracleSession.getQueue: Secure queue table: NO
main AQOracleQueue.getProperty: return cached prop
main AQOracleSession.getQueueTable: Payload type: RAW
main AQOracleSession.getQueueTable: Secure queue table: NO
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.chopit: TSUB_1_b2b5787a678d40f0a2e589f89e6348fc -> TSUB_1_b2b5787a678d40f0a2e589f
java.lang.NullPointerException
at oracle.jms.AQjmsSession.getAQJmsSelector(AQjmsSession.java:2550)
at oracle.jms.AQjmsSession.createDurableSubscriber(AQjmsSession.java:2520)
at oracle.jms.AQjmsSession.forceCreateOldSubscriber(AQjmsSession.java:2924)
at oracle.jms.AQjmsSession.createSubscriber(AQjmsSession.java:2240)
at com.containerstore.device.notification.TopicAttachment.attach(TopicAttachment.java:35)
at com.containerstore.device.notification.TopicAttachment.main(TopicAttachment.java:64)
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:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Exception in thread "main" i've tried many different incarnations of this basic setup with the same results. it always fails with a NPE when creating the subscriber. i've even used the more AQ specific classes/methods like TopicReceiver with the same results.
is what i'm trying to accomplish even possible?
thanks!Don't let the fact that I've been doing AQ for years and no one else has responded throw you. <g>
When I see things like this:
public static void main(String[] args) throws Exception {
System.setProperty("oracle.jms.useEmulatedXA", "false");
System.setProperty("oracle.jms.useNativeXA", "false");it is hard to not read it as Java. -
Hallo,
Thx for the great fop feature Apex provides in the apex_3.1\apex\utilities\fop.
I wanted to install it on JBoss and got it to run (see the description below). It currently works but I got always an error message in the JBoss log.
Maybe someone has some hints on this for me:
Servlet.service() for servlet jsp threw exception:
java.lang.IllegalStateException: getOutputStream() has already been called for this response.Add the missing Oracle XML Parser v2 (you may find them e.g. in JDeveloper/lib) libraries (lib/xmlparserv2.jar, lib/xml.jar) by opening the fop.war with your favorite zip program (e.g. rename fop.war to fop.zip) and saving the libraries WEB-INF/lib. Then copy the fop.war to the e.g. jboss\server\default\deploy directory. Maybe you have to restart your application server (dependent on your settings). Then try http://your-hostname:your-port/fop/apex_fop.jsp (e.g. http://127.0.0.1:8080/fop/apex_fop.jsp) to see if your work was successful.
Manage Service / Instance Settings / Report Printing
Print Server: Standard Support
Print Server Host Address: 127.0.0.1
Print Server Port:8080
Print Server Script: /fop/apex_fop.jsp
<%@ page import='java.io.*'%>
<%@ page import='org.xml.sax.InputSource'%>
<%@ page import='org.apache.fop.apps.Driver'%>
<%@ page import='org.apache.fop.apps.Options'%>
<%@ page import='oracle.xml.parser.v2.XMLDocument'%>
<%@ page import='oracle.xml.parser.v2.XSLProcessor'%>
<%@ page import='oracle.xml.parser.v2.XSLStylesheet'%>
<%@ page import='oracle.xml.parser.v2.DOMParser'%>
<%
// see http://xml.apache.org/fop/output.html for all output types
XMLDocument v_doc;
XSLStylesheet v_xsl = null;
String v_fop;
DOMParser parser = new DOMParser();
XSLProcessor processor = new XSLProcessor();
String v_encode = "UTF-8";
String p_xsl = request.getParameter("template");
String p_xml = request.getParameter("xml");
/* transform an XML source to XSLFO using an XSL transformation */
v_xsl = new XSLStylesheet(new java.io.StringReader(p_xsl),null);
parser.parse(new java.io.StringReader(p_xml));
v_doc = parser.getDocument();
ByteArrayOutputStream v_out = new ByteArrayOutputStream();
processor.processXSL(v_xsl, v_doc, v_out);
v_fop = new String(v_out.toByteArray(),v_encode);
/* The FOP process */
Driver driver = new Driver();
driver.setRenderer(Driver.RENDER_PDF);
driver.setInputSource(new InputSource(new StringReader(v_fop)));
ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
driver.setOutputStream(outBuffer);
driver.run();
OutputStream outStream = response.getOutputStream();
response.setContentType("application/pdf");
response.setContentLength(outBuffer.size());
outStream.write(outBuffer.toByteArray());
outStream.flush();
%>I don't really understand you description. Is JMSPayload an extension of javax.jms.ObjectMessage, or is that the object you are serializing and storing in the javax.jms.ObjectMessage? I suspect the latter. If so, I think the:
ObjectMessage objMessage = (ObjectMessage) arg0;
should instead be:
Object obj = ( (ObjectMessage) arg0).getObject();
Then you can check if "obj" is an instance of JMSPayload. -
Generate Serializable data types with WSDLC
Hello everyone,
I'll was pretending to send a through a JMS ObjectMessage a type generated from WSDL with the wsdlc ant task. Unfortunately the generated types are not serializable and so I'm unable to send the message. It's really ackward to manualy change all of them so I would like to know if it's possible to instruct wsdlc to generate serializable data types. I'm using Weblogic 11gR1PS1. If it's not possible what do you recommend ?
Currently the tasks are configured like this:
<taskdef name="wsdlc" classpathref="weblogic.classpath" classname="weblogic.wsee.tools.anttasks.WsdlcTask" />
<wsdlc srcWsdl="ejbModule/META-INF/wsdl/DataCatalog.wsdl" destJwsDir="gen" destImplDir="gen" packageName="br.com.allwayx.schema" type="JAXWS">
Obs: I noticed that If I use a binding element inside the task passing any xjb file the wsdlc task generates a pair of Entity interface - EntityImpl implementation class. It stays like this:
<wsdlc srcWsdl="ejbModule/META-INF/wsdl/DataCatalog.wsdl" destJwsDir="gen" destImplDir="gen" packageName="br.com.allwayx.schema" type="JAXWS">
<binding dir="${binding.declaration.dir}" includes="${binding.declaration.file}" />
</wsdlc>
Still I would like to keep the old way, without the binding element which generates just a concrete class for each element. Maybe this is a bug?
Thank you !
Edited by: Lupan on 28/04/2010 13:13Hi Lupan,
Currently I believe there is no way to instruct WSDLC task to generate the Serializable data types.
There was already a BUG opened with BEA for WLS -9.0 following are the BUG details:
http://download.oracle.com/docs/cd/E13222_01/wls/docs100/issues/known_resolved.html
CR228385
Description:
The Web Service Description Language (WSDL) compiler does not generate serializable data types, so data cannot be passed to remote EJBs or stored in a JMS destination.
You should contact the Oracle Weblogic Support to get the current status of the BUG.
Thanks,
Sandeep -
I am trying to enqueue an XMLType value and have some questions.
I tried to use a JMS ObjectMessage. But when I tried to setObject with the XMLType value, I get the following error:
oracle.jms.AQjmsException: JMS-157: IO Exception
Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
I looked at the demos that came with the Oracle installation and found one which uses the AdtMessage with XMLType values. However, when I looked at the Javadoc for the classes related to the AdtMessage type, there were notes indicating that the methods would be deprecated sometime in the future.
So, my questions are:
1. Is using any of the JMS Message types out of the question for XMLType? If not, which Message type should I use? And what payload type should I use for the queue table? I know that I can convert the value to a byte array, but I was hoping to still persist the value as an XMLType. Is that possible? I've been trying to locate the Javadoc for the oracle.AQ packages, but have been unable to.
2. If I do need to use the AdtMessage type, should I be concerned about the deprecation warnings? Is it the case that these methods will merely be replaced by others? Or that support for this functionality will be going away?
Thanks so much for your help.Code i used to complete the jms option with xml
dbms_aqadm.create_queue_table(
queue_table => 'change_q_tab',
multiple_consumers => FALSE,
storage_clause => 'TABLESPACE &x_tablespace',
sort_list => 'PRIORITY,ENQ_TIME',
message_grouping => DBMS_AQADM.NONE,
queue_payload_type =>'sys.aq$_jms_text_message',
comment => 'Creating queue table');
dbms_aqadm.create_queue(
queue_name => 'COST_CHANGE_Q',
queue_table => 'change_q_tab',
max_retries => 2,
comment => 'cost change queue');
PROCEDURE enqCostChange(
p_cost_change IN VARCHAR2
,p_priority IN NUMBER default LOW_PRIORITY
IS
PROC_NM constant VARCHAR2(30) := 'enqCostChange';
v_enqueue_opt DBMS_AQ.enqueue_options_t;
v_message_props DBMS_AQ.message_properties_t;
v_message_handle RAW(16);
-- for JMS
v_cost_change sys.aq$_jms_text_message;
v_agent sys.aq$_agent := sys.aq$_agent(' ', null, 0);
BEGIN
-- Construct the message for ENQ operation.
--JMS Construction
v_cost_change := sys.aq$_jms_text_message.construct;
v_cost_change.set_replyto(v_agent);
v_cost_change.set_type('mcd://xmlns');
v_cost_change.set_text(p_cost_change);
-- Set proper options and properties
v_enqueue_opt.visibility := DBMS_AQ.ON_COMMIT;
v_message_props.PRIORITY := p_priority ;
DBMS_AQ.enqueue (
queue_name => 'COST_CHANGE_Q',
enqueue_options => v_enqueue_opt,
message_properties => v_message_props,
payload => v_cost_change,
msgid => v_message_handle );
END enqCostChange;
Maybe you are looking for
-
Not a clear video..Why??
Why does my video that I am creating doesn't have the clear picture as the original video shown in the organizer? Please help I have been working on this video a long time and when I view it the picture is not good at all. I even tried making a DVD
-
How to disable selection of End Date depending on start Date.
Hello, I have 2 DatePicker controls 1) Start Date 2) End Date When I select a start date in date picker depending on that it should disable the selection of dates less than Start date in End date Date Picker. Could anyone please provide soluti
-
Sales order Payment term modify Userexit
Hi Experts, I am working on sales order VBKD modify userexit, in this based on customer, customer group & one maintained z field from MARA they created Ztable to pick Payment term. For line item which doesn't have payment term (KONP-Z
-
Number of Instances of Stateless Session Bean
For a servlet(not SingleThreadModel) not hosted in a distributed environment(the default),the servlet container must use only one instance per servlet declaration. All instances of a stateless session bean are equivalent. In this case, why do the EJB
-
If i erased and sync will my ios 7 also will be gone? thx!
help me please thx! for me theres nothing to erase in my iphone only few app thats ok for me but im asking is if i erased and sync to my new cumputer will my ios 7 will be gone also? thx