CreateQueueConnection produce null

Hi all,
I've been having trouble with my codes. The codes is like below. The purpose of this code is to established a connection with a JMS server, so I can retrieve messages in the queue.
The problem is, createQueueConnection always produce null. I have no idea why this is happening. This code is working in the 10.21.75.114 server, or in another server (10.21.75.131), but not in my machine (172.30.202.58). I've tried connecting to the server using telnet and it works.
I know that it's probably a network problem, but is there any possibility of a library or code problem?
import javax.jms.JMSException;
import javax.jms.JMSSecurityException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
public class TesterJava implements MessageListener {
     private static QueueConnectionFactory qConnFactory;
private static InitialContext initContext;
     private QueueConnection qConn;
private QueueReceiver qReceiver;
private Queue queue;
public TesterJava () {
          super();
     public void open () throws NamingException, JMSException, JMSSecurityException {
     System.out.println ("qConnFactory "+ qConnFactory);
     if (qConnFactory != null)     
               qConn = qConnFactory.createQueueConnection();
          //System.out.println(qConn);
     public void onMessage (Message msg) {
private InitialContext getInitialContext () throws NamingException {
          Hashtable env = new Hashtable ();
          System.out.println (Context.INITIAL_CONTEXT_FACTORY);
          System.out.println (Context.PROVIDER_URL);     
          env.put (Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
          env.put (Context.PROVIDER_URL, "t3://10.21.75.114:6543");
          return new InitialContext (env);     
private void openContext () throws NamingException, JMSException {
          if (initContext==null) {
     initContext = getInitialContext();
     System.out.println(initContext);
if (qConnFactory==null) {
               qConnFactory = (QueueConnectionFactory)initContext.lookup("amdocs.ChangeOTAParamsJMSFactory");
               System.out.println ("qconnFact: "+ qConnFactory);
private void closeContext () throws NamingException {
          initContext.close ();
     private void close () throws JMSException{
          qConn.close ();          
     public static void main (String[] args) {
          TesterJava tester = new TesterJava();
     try {     
          tester.openContext();
          tester.open();
          tester.close();
          tester.closeContext();
          catch (Exception e)
               e.printStackTrace();
}

Hi all,
I've been having trouble with my codes. The codes is like below. The purpose of this code is to established a connection with a JMS server, so I can retrieve messages in the queue.
The problem is, createQueueConnection always produce null. I have no idea why this is happening. This code is working in the 10.21.75.114 server, or in another server (10.21.75.131), but not in my machine (172.30.202.58). I've tried connecting to the server using telnet and it works.
I know that it's probably a network problem, but is there any possibility of a library or code problem?
import javax.jms.JMSException;
import javax.jms.JMSSecurityException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
public class TesterJava implements MessageListener {
     private static QueueConnectionFactory qConnFactory;
private static InitialContext initContext;
     private QueueConnection qConn;
private QueueReceiver qReceiver;
private Queue queue;
public TesterJava () {
          super();
     public void open () throws NamingException, JMSException, JMSSecurityException {
     System.out.println ("qConnFactory "+ qConnFactory);
     if (qConnFactory != null)     
               qConn = qConnFactory.createQueueConnection();
          //System.out.println(qConn);
     public void onMessage (Message msg) {
private InitialContext getInitialContext () throws NamingException {
          Hashtable env = new Hashtable ();
          System.out.println (Context.INITIAL_CONTEXT_FACTORY);
          System.out.println (Context.PROVIDER_URL);     
          env.put (Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
          env.put (Context.PROVIDER_URL, "t3://10.21.75.114:6543");
          return new InitialContext (env);     
private void openContext () throws NamingException, JMSException {
          if (initContext==null) {
     initContext = getInitialContext();
     System.out.println(initContext);
if (qConnFactory==null) {
               qConnFactory = (QueueConnectionFactory)initContext.lookup("amdocs.ChangeOTAParamsJMSFactory");
               System.out.println ("qconnFact: "+ qConnFactory);
private void closeContext () throws NamingException {
          initContext.close ();
     private void close () throws JMSException{
          qConn.close ();          
     public static void main (String[] args) {
          TesterJava tester = new TesterJava();
     try {     
          tester.openContext();
          tester.open();
          tester.close();
          tester.closeContext();
          catch (Exception e)
               e.printStackTrace();
}

Similar Messages

  • Basic Table UI produces null pointer exception

    Hi,
    I am developing a software that heavily uses JTables with Jlabels rendered as its cells. The software works well except that it sometimes produces a NullPointerException like:
    java.lang.NullPointerException
    at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.setValueIsAdjusting(BasicTableUI.java:481)
    at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.adjustFocusAndSelection(BasicTableUI.java:521)
    at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseReleased(BasicTableUI.java:536)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    My problem is that I couldn't find where this exception is taking place and it sometimes makes the application stop.
    many thanks

    Hi Kris,
    I'm just down the M4 in Eton Wick ;)
    It would be helpful to know which of the lines is throwing the NPE.
    A suggestion for you as well. Instead of coding:
    if (someValue.equals("VALUEA"))which could throw an NPE if someValue is null, do this instead:
    if ("VALUEA".equals(someValue))That's probably not your issue, but something I often flag up in a code review.
    Best,
    john

  • Query producing null results

    I have the following update statement:
    update Position set value=(select price from SecuMaster where SecuMaster.cusip = Position.cusip and SecuMaster.dealernumber='ID' and SecuMaster.dealernumber=Position.dealernumber and SecuMaster.price is not null)* Position.sharesThe problem is if there is no SecuMaster.price for the current Position.cusip, I get the null return.
    I want to prevent the null from being used.
    is there any way to avoid this, some sort of conditional in sql?

    iketurner wrote:
    I have the following update statement:
    Helps to format lines so that they are more readable.
    >
    update Position set value=(
    select price from SecuMaster
    where SecuMaster.cusip = Position.cusip
    and SecuMaster.dealernumber='ID'
    and SecuMaster.dealernumber=Position.dealernumber
    and SecuMaster.price is not null)* Position.shares
    The problem is if there is no SecuMaster.price for the current Position.cusip, I get the null return.
    I want to prevent the null from being used.
    is there any way to avoid this, some sort of conditional in sql?Currently the situation is that every row is gettng updated. So obviously the column
    must be set to something.
    Value needs to be set to something correct? So do you just not want to overwrite it
    or do you want something else there?
    Note that problems like this usually require information about which database and version is in use.

  • Deserializer producing nulls instead of objects

    I'm using JAX RPC RI and generating my client code using the java service code, not the wsdl. In one of my test calls, I'm trying to return a custom object. One of the members of that object is an ArrayList of another type of custom object. Once the object is deserialized, the ArrayList is empty. I've also tried replacing the ArrayList with a regular array, and in that case I end up with an array of the correct length, but with all the elements null. I've snooped on the SOAP traffic (using a cool tool: http://capescience.capeclear.com/articles/using_nettool/) and the XML being returned from the service looks correct. The object looks thusly:
    class ComplexA {
    ArrayList _listOfBs;
    public ArrayList getListOfBs() {
    return _listOfBs;
    public void setListOfBs( ArrayList list ) {
    _listOfBs = list;
    class ComplexB {
    ... more members
    Both classes follow all the rules of JavaBeans. Also, I can correctly pass ComplexB objects. It's only when they're inside an ArrayList inside ComplexA that they get lost. I've looked at the code generated by wscompile and it looks OK. I really wish they would release the JAX RPC source. Unfortunately, I haven't been able to boil this problem down to a simple code example. Most things work, just this one problem does not.
    One other thing: Running this through the debugger, I can see that the ComplexBs get constructed during deserialization, so something is breaking down when they are supposed to be added to a new ArrayList.

    OK, I figured out what was going wrong. Part of it was the way I was testing the deserialization. Part of it was how deserialization is done.
    I had assumed that when the deserializer called my setFoo( ArrayList ) method, that the List would already be populated, so I was printing the size of the list to stdout from inside setFoo and if it was 0, I was assuming it had failed. The trouble is that the deserializer does the following instead:
    ArrayList newFoo = new ArrayList();
    newComplexA.setFoo( newFoo );
    newFoo.add( ...first item in list... );
    newFoo.add( ...second item in list... );
    In other words, it populates the array after it passes it to you. That's OK as long as you are saving a reference to that array. But I was using the array as a convenient way to pass the contents of my object and my setter was reading the array and populating an internal variable based on that. So when the deserializer post-populated the array, I missed out on those changes.

  • Php array returning "null" to flash

    my php seems to have trouble with an array that comes from a
    datagrid from flash. I then proceed to
    read the array and update the database but this doens't seem
    to work cause I can't get to the objects in the array.
    My return value to flash only produces "null"

    You have to serialize the array prior to sending it to your
    php script. Use Alessandro Crugnola's SerializerClass to
    serialize/and unserialize the array.
    http://www.sephiroth.it/test/unserializer/

  • Delete file from original location and when copied size of file increases.

    hi !
    I have 2 exe's both of 1.15MB which I want to move to another folder. The files are copied to the folder but the size of exe increases to around 350MB each. What can be the problem ?
    BufferedOutputStream bos=new BufferedOutputStream(new FileOutputStream(filename));
    int o=bis.read();
    do{bos.write(o);}while (o!=-1);
    boolean del=this.fpara.delete();
    System.out.println(del);          Also, the file is not deleted from the original location even though I have used the delete function. The last line produces null output.

    And do follow coding conventions
    {color:0000ff}http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html{color}
    If your original source is all jammed up like the snippet you posted, I'm not surprosed that you can't spot your mistakes.
    db
    Edited by: Darryl.Burke on Mar 9, 2008 12:40 AM

  • I am not able to create a JMS connection from a custom component in UCM

    I am trying to create a custom component which makes a JMS connection and inserts messages in JMS Queue.
    THe JMS server is hosted on Weblogic Application Server.
    When the code runs I am getting the factory object and the queue object.
    But when I try to get a connection it throws an error as pasted below.
    WHen I googled the same error It has shown a simliar problem in TOmcat in sun thread
    It said two jar files xerces.jar and xml-apis.jar are obsolete.
    I replaced with the new version.
    still the same problem occurred
    Please help
    Pasting the code and exception here
    Code __________________________________________
    import java.util.Date;
    import java.util.Hashtable;
    import javax.jms.*;
    import javax.naming.*;
    import weblogic.jms.client.WLConnectionImpl;
    import weblogic.jms.extensions.*;
    import javax.rmi.PortableRemoteObject;
    public class SimpleProducer {
    public static void drive() {
    final int NUM_MSGS;
         NUM_MSGS = 93;
    Context jndiContext = null;
    Hashtable<String, String> ht;
              ht = new Hashtable<String, String>();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://punitp52975d:7001");
    try {
         jndiContext = new InitialContext(ht);
    } catch (NamingException e) {
    System.out.println("Could not create JNDI API context: " +
    e.toString());
    System.exit(1);
    ConnectionFactory connectionFactory = null;
    Destination dest = null;
    try {
                   Object home = jndiContext.lookup("CNFT"); // where iiopTestDS is jndi name for my DataSource.
    connectionFactory =(ConnectionFactory)PortableRemoteObject.narrow(home , ConnectionFactory.class);
         Object home1 = jndiContext.lookup("QUEUE2"); // where iiopTestDS is jndi name for my DataSource.
    dest =(Destination)PortableRemoteObject.narrow(home1 , Destination.class);
         /*connectionFactory = (ConnectionFactory) jndiContext.lookup(
    "CNFT");
    dest = (Destination) jndiContext.lookup("QUEUE2");
    System.out.println("connectionFactory,dest "+connectionFactory+dest);*/
    } catch (Exception e) {
    System.out.println("JNDI API lookup failed: " + e.toString());
    e.printStackTrace();
    System.exit(1);
    //WLConnectionImpl connection = null;
    WLConnection connection = null;
    WLMessageProducer producer = null;
    try {
                   System.out.println("Getting Connection "+(WLConnection) connectionFactory.createConnection());
    //connection = (WLConnection) connectionFactory.createConnection();
                   System.out.println("Connection created");
    WLSession session =
    (WLSession) connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
    producer = (WLMessageProducer) session.createProducer(dest);
    WLMessage message = (WLMessage) session.createTextMessage();
    //TextMessage message = session.createTextMessage();
    for (int i = 91; i < NUM_MSGS; i++) {
    ((TextMessage) message).setText("This is message " + (i + 1));
    Long l = new Date().getTime();
    message.setLongProperty("ReleasedDate",l );
    System.out.println("Sending message: " + ((TextMessage) message).getText());
    producer.send(message);
    producer.send(session.createMessage());
    } catch (Exception e) {
    System.out.println("Exception occurred: " + e.toString());
    } catch (Throwable et) {
    System.out.println("Exception occurred: " + et.toString());
    et.printStackTrace();
    finally {
    if (connection != null) {
    try {
    connection.close();
    } catch (Exception e) {
                             System.out.println("*************Instantiating Producer***************");
    Exception_________________________________________________________________
    Exception occurred: java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
    java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()Ljavax/xml/validation/Schema;
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:124)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:115)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:143)
    at weblogic.xml.jaxp.WebLogicSAXParserFactory.<init>(WebLogicSAXParserFactory.java:62)
    at weblogic.rmi.internal.wls.WLSRMIEnvironment.getSAXParser(WLSRMIEnvironment.java:136)
    at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:170)
    at weblogic.rmi.internal.DescriptorManager.getDescriptorAsMap(DescriptorManager.java:159)
    at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:104)
    at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:85)
    at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:51)
    at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:37)
    at weblogic.rmi.internal.OIDManager.makeServerReference(OIDManager.java:194)
    at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:175)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
    at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:223)
    at weblogic.rmi.internal.OIDManager.initializeDGCServer(OIDManager.java:231)
    at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:144)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
    at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
    at weblogic.rmi.extensions.server.ServerHelper.exportObject(ServerHelper.java:223)
    at weblogic.corba.server.naming.ReferenceHelperImpl.exportObject(ReferenceHelperImpl.java:233)
    at weblogic.rmi.extensions.PortableRemoteObject.exportObject(PortableRemoteObject.java:34)
    at weblogic.messaging.dispatcher.DispatcherImpl.export(DispatcherImpl.java:85)

    This is probably related to this other issue http://www.adobeforums.com/webx/.59b7fbab/0.
    Jasmin

  • Extremely low message throughput with MQ 3.6

    We performed some load tests to determine maximum throughput of the Sun JMS framework when used in conditions similar to our application.
    The achieved throughput is extremely low: around 10 messages / second while we expected around 100. Could you please verify what may be the reason?
    We encountered one particular problem: the time of closing JMS producers increases much during the test. Message throughput decreases proportionally. Time periods of other phases of the JMS API usage remain constant. What can be the reason?
    detailed information:
    Our configuration used:
    server machine:
    cpu: Intel Celeron 2.8 Ghz
    ram: 1GB
    os: CentOS release 4.4 (Final), 2.6.9-42.0.3.EL
    application server: Sun Java System Application Server Enterprise Edition 8.1 2005Q2 UR2
    java version: 1.5.0_04
    we use default imqbroker configuration
    client machine:
    Intel Celeron 2Ghz
    ram: 512MB
    os: Fedora Core release 3, 2.6.12-1.1381_FC3
    java version: 1.4.02
    Test description (find attached test unit sources presenting our way of using JMS API):
    Load test is performed by running a number of concurrent test units against the JMS broker. Number of units is constant in time. Additionally, every unit test at the end of its life cycle launches another unit to keep long test time perspective.
    Each test unit is self-contained. It contains of a producer and a consumer (MessageListener). It sends messages to itself . Also each message unit sleeps for some time to simulate message processing.
    Messages are non-persistent, no durable subscriptions are used. All units are using one shared Queue for whole messaging. Message selectors are utilized to guarantee that messages are delivered to intended receiver.
    By this test we wanted to determine a maximum value of message throughput for which all messages are delivered successfully and in some reasonable time (say less than 1 minute).
    Some variations of test units are possible, e.g. JMS connections and/or sessions can be open/closed for every sent message or shared among multiple producers. But (contrary to our expectations) we encountered no visible differences in message throughput and message delivery time.
    Code of test units:
    Sender.java
    package pl.ericpol.jmstest;
    import javax.jms.Connection;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    public class Sender{
         private UnitTest unitTest = null;
         private Connection connection = null;
         private Session session = null;
         private MessageProducer producer = null;
         private String selector = null;
         public Sender(Connection con, Session session, MessageProducer producer, String selector, UnitTest unitTest){
         public void send() {
              try {
                   boolean closeSession = false;
                   boolean closeProducer = false;
                   if(this.session == null){
                        this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                        closeSession = true;
                   if(this.producer == null){
                        this.producer = this.unitTest.createProducer(this.session);
                        closeProducer = true;
                   this.producer.send(this.unitTest.createMessage(this.session, this.selector));
                   if(closeProducer){
                        this.producer.close();
                        this.producer = null;
                   if(closeSession){
                        this.session.close();
                        this.session = null;
              } catch (JMSException e) {
                   e.printStackTrace();
    Receiver.java
    package pl.ericpol.jmstest;
    import javax.jms.Connection;
    import javax.jms.ConnectionFactory;
    import javax.jms.Destination;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageConsumer;
    import javax.jms.MessageListener;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    public class Receiver extends Thread implements MessageListener{
         private Connection connection = null;
         private Session session = null;
         private Destination destination = null;
         private MessageConsumer consumer = null;
         private Connection sendConnection = null;
         private Session sendSession = null;
         private MessageProducer producer = null;
         private String qname = null;
         private String selector = null;
         private int messagesToReceive = -1;
         private int delay = -1;
         private UnitTest unitTest = null;
         private boolean active = true;
         private long[][] localStats = null;
         private Boolean monitor = new Boolean(true);
         public Receiver(ConnectionFactory cf, Connection sendConnection, Session sendSession, MessageProducer producer,
                   String code, UnitTest unit){
              try {
                   this.connection = cf.createConnection();
                   this.session = this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                   this.destination = this.session.createQueue(this.qname);
                   this.consumer = this.session.createConsumer(this.destination, UnitTest.KEY + " = '" + code + "'");
                   this.consumer.setMessageListener(this);
                   this.connection.start();
                   this.producer = producer;
                   this.sendSession = sendSession;
                   this.sendConnection = sendConnection;
              } catch (JMSException e) {
                   e.printStackTrace();
              } catch (NumberFormatException e1) {
                   e1.printStackTrace();
         public void run() {
              if(this.consumer == null){
              } else {
                   this.sleep(0);
                   this.close();
                   TestManager.getInstance().unitTestFinished();
         public synchronized void onMessage(Message arg0) {
              Message message = arg0;
              if(this.active){
                   if(message == null){
                   } else {
                        if(message instanceof TextMessage){
                                  this.registerDeliveryTime(this.localStats.length - this.messagesToReceive, message);
                                  this.sleep(this.delay);
                                  synchronized(this.monitor){
                                       if(--this.messagesToReceive == 0){
                                            this.unitTest.messagesReceived();
                                       } else {
                                            if(this.active){
                                                 this.send();     
                        } else {
              } else {
              if(! this.active){
                   this.notify();
         public synchronized void deactivate(){
         public int getMessagesToReceive(){
              return this.messagesToReceive;
         private void send(){
              try {
                   boolean closeSession = false;
                   boolean closeProducer = false;
                   if(this.sendSession == null){
                        this.sendSession = this.sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                        closeSession = true;
                   if(this.producer == null){
                        this.producer = this.unitTest.createProducer(this.sendSession);
                        closeProducer = true;
                   this.producer.send(this.unitTest.createMessage(this.sendSession, this.selector));
                   if(closeProducer){
                        this.producer.close();
                        this.producer = null;
                   if(closeSession){
                        this.sendSession.close();
                        this.sendSession = null;
              } catch (JMSException e) {
                   e.printStackTrace();
         private synchronized void sleep(int delay){
         private void registerDeliveryTime(int index, Message message){
         private synchronized void close(){
              try {
                   if(this.producer != null){
                        this.producer.close();
                   if(this.sendSession != null){
                        this.sendSession.close();
                        this.sendSession = null;
                   if(this.sendConnection != null){
                        this.sendConnection.close();
                        this.sendConnection = null;
                   if(this.consumer != null){
                        this.consumer.close();
                        this.consumer = null;
                   if(this.session != null){
                        this.session.close();
                        this.session = null;
                   if(this.connection != null){
                        this.connection.close();
                        this.connection = null;
              } catch (JMSException e) {
                   e.printStackTrace();
    TestUnit.java
    package pl.ericpol.jmstest;
    import java.util.HashMap;
    import java.util.Iterator;
    import javax.jms.Connection;
    import javax.jms.DeliveryMode;
    import javax.jms.JMSException;
    import javax.jms.MessageProducer;
    import javax.jms.Session;
    import javax.jms.TextMessage;
    import com.sun.messaging.ConnectionFactory;
    import com.sun.messaging.QueueConnectionFactory;
    public class UnitTest extends Thread{
         public static final String KEY = "Type";
         private ConnectionFactory cf = null;
         private Connection sendConnection = null;
         private Session sendSession = null;
         private MessageProducer producer = null;
         private int delay = -1;
         private int messagesPerCall = -1;
         private int loop = -1;
         private int timeOut = -1;
         private int maxLoops = -1;
         private boolean waitingFlag = false;
         private boolean messagesReceived = false;
         public UnitTest(int loop){
              try {               
                   this.cf = new QueueConnectionFactory();
                   this.applyProps(this.cf, Properties.getInstance().getSunProps());
                   this.sendConnection = this.cf.createConnection();
                   if(sharedProducer){
                        this.sendSession = this.sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                        this.producer = this.createProducer(this.sendSession);
                   } else if(sharedSession){
                        this.sendSession = this.sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
                   this.sendConnection.start();
              } catch (NumberFormatException e){
                   MyLogger.logger.error("number format exception!!");
              } catch (JMSException e) {
                   e.printStackTrace();
         public void run(){
              String selector = String.valueOf(Randomizer.getRandInt(Integer.MAX_VALUE));
              Receiver receiver = new Receiver(this.cf, this.sendConnection, this.sendSession, this.producer, selector, this);
              receiver.start();
              long startTime = System.currentTimeMillis();
              this.send(selector);
              synchronized (this) {
                   if(! this.messagesReceived){
                        this.sleep(this.timeOut);     
              long finishTime = System.currentTimeMillis();
              receiver.deactivate();
              if(++this.loop < this.maxLoops && TestManager.getInstance().getStatus()){
                   UnitTest newTest = new UnitTest(this.loop);
                   newTest.start();
              } else {
                   TestManager.getInstance().workerFinished();
         public void messagesReceived(){
         private synchronized void sleep(int delay){
         private void applyProps(ConnectionFactory cf, HashMap props){
         private void send(String selector){
              Sender sender = new Sender(this.sendConnection, this.sendSession, this.producer, selector, this);
              sender.send();
         public MessageProducer createProducer(Session session){
              MessageProducer producer = null;
              String qname = (String) Properties.getInstance().getOtherProps().get(Properties.JMS_QUEUE_NAME);
              try {
                   producer = session.createProducer(session.createQueue(qname));
                   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
              } catch (JMSException e) {
                   e.printStackTrace();
              return producer;
         public TextMessage createMessage(Session session, String selector){
              try {
                   TextMessage message = session.createTextMessage();
                   message.setStringProperty(UnitTest.KEY, selector);
                   String messageLenAsString = (String) Properties.getInstance().getOtherProps().get(Properties.JMS_MESSAGE_LENGTH);
                   int messageLen = Integer.parseInt(messageLenAsString);
                   StringBuffer buf = new StringBuffer();
                   buf.append(selector).append("-");
                   for(int i = 0; i < messageLen; i++){
                        buf.append("x");
                   message.setText(buf.toString());
                   return message;
              } catch(NumberFormatException e){
                   MyLogger.logger.error("bad message length!!");
              } catch (JMSException e) {
                   e.printStackTrace();
              return null;
    }

    If you go here:
    http://www.sun.com/software/solaris/get.jsp
    and
    1.Check Sun Java Enterprise (or the Sun Java Application Platform Suite),
    2.Click Get Download and Media
    3. Then select Systems for windows (the bar at the top)
    I beleive you can get Message Queue 3.6 SP3 from it, by only installing the Message Queue component.
    Note: it is a large download (500 Mb for Application Platform), especially for Sun Java Enterprise...
    TE

  • How to configure my MDB serve only one message at a time?

    Hi All,
    I have requirement where I need to develope a MDB iin weblogic. This MDB has to serve only one message at a time. If the send second message is sent while the first one is running the second message has to sit in queue and start processing once the first message is finished.
    Is there any way to configure via annotations or in weblogic server settings ?
    Any help would be really appreciated...
    Thank you,
    K.

    Here is my client code to send the message
    Connection connection = null;
    javax.jms.Session session = null;
    MessageProducer producer = null;
    try
    connection = lpConnectionFactory.createConnection();
    session = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
    // Create a MessageProducer from the Session to the Validation Queue
    producer = session.createProducer(myQueue);
    ((WLMessageProducer)producer).setUnitOfOrder();
    // Create a message
    ObjectMessage message = session.createObjectMessage();
    message.setObject(params);
    message.setStringProperty(MyServiceConstants.OPERATION, operation);
    // Send the message to the queue
    producer.send(message);
    finally
    if (producer != null)
    producer.close();
    if (session != null)
    session.close();
    if (connection != null)
    connection.close();
    Following is the weblogic-ejb-jar.xml
    <?xml version="1.0"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC
    "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN"
    "http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>TestMDB</ejb-name>
    <message-driven-descriptor>
         <pool>
              <max-beans-in-free-pool>1</max-beans-in-free-pool>
              <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
         </pool>
    </message-driven-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>

  • Automatic use of toString() in println

    Hi.
    A novice here preparing for the Java 2 Programmer exam. Came across a question in one of the books and I'm left slightly confused about something which I can't get answered. Here goes...
    class ToString
         public static void main( String[] args ) {
              MyClass[] arr = new MyClass[5];
              arr[0] = new MyClass();
              System.out.println(arr[0]);
              System.out.println(arr[0].toString());
              System.out.println(arr[1]);     // line 8
              System.out.println(arr[1].toString());     // line 9
    class MyClass {
         public String toString() { return "my own implementation of toString"; }
    When run produces...
    my own implementation of toString
    my own implementation of toString
    null
    java.lang.NullPointerException
         at ToString.main(ToString.java:9)
    My question is why line 8 prints null, but line 9 does not. Well, the other way around really, I understand why line 9 produces an exception, but how does line 8 manage to produce null output?
    I was under the impression that when an object is used in a println method that it's toString() method is invoked, if it doesn't have one then the toString() method on the Object class is invoked. If this is the case then surely line 8 is equivalent to line 9, unless java just sees the "." in line 9 against a null reference and throws it out because of that.
    Thanks.

    Because it actially calls String.valueOf(argument). Which is defined roughly as
    public static String valueOf(Object object) {
        return object == null ? "null" : object.toString();

  • SDO_UTIL.SIMPLIFY seems to be rather unhappy with my polygon

    Hi folks,
    Not sure if this is a bug or just how things are. I have a polygon that is valid, looking like an upside Q - i.e. a ring-like polygon with a big hole in the middle. On 10.2.0.4, when I run SDO_UTIL.SIMPLIFY with a 20 meter threshold, it returns NULL. A threshold of 80 returns a line whilst a threshold of 10 returns a reasonable result. But NULL? I don't see anything in the documentation about this.
    Next I tried the exact same thing on 11.1.0.7 and rather than NULL, I get ORA-13199 instead. This seems like an improvement. So I assume what produces NULL on 10g throws an error on 11g. I guess we call that progress and move on - any plans to backport this behavior to 10g?
    But back to the results. Looking through
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28400/sdo_util.htm#sthref2702
    I don't see any mention that a legal function result can be ORA-13199. So is this a bug? Or are some threshold values "just not gonna" work and always return an error by design?
    Thanks!
    Paul
    SELECT
    SDO_UTIL.SIMPLIFY(
    SDO_GEOMETRY(
    2003,
    8265,
    NULL,
    SDO_ELEM_INFO_ARRAY(
    1,
    1003,
    1,
    63,
    2003,
    1
    SDO_ORDINATE_ARRAY(
    -80.6678363850029,
    27.1544468240932,
    -80.6676581190441,
    27.1544578908543,
    -80.6673811848868,
    27.1545404243406,
    -80.6669873181666,
    27.1546888239902,
    -80.6669011856599,
    27.154727424447,
    -80.6667227848805,
    27.1548484903997,
    -80.6666243193133,
    27.1549804918455,
    -80.6665567184542,
    27.1551016239273,
    -80.6665443185942,
    27.1552556914498,
    -80.6666181177095,
    27.1555144243224,
    -80.6667779183997,
    27.1559106917256,
    -80.6668025185416,
    27.1560536914105,
    -80.6668271189153,
    27.1560868245381,
    -80.6668579182135,
    27.1560866907775,
    -80.6669009855045,
    27.1560592917636,
    -80.6669071190522,
    27.1559382250141,
    -80.6669871190558,
    27.1559106906018,
    -80.6673439852962,
    27.1559052909276,
    -80.6673931847717,
    27.1558888246279,
    -80.6674363186955,
    27.1558722246153,
    -80.6675469848459,
    27.1557622244607,
    -80.6678731857396,
    27.155575091261,
    -80.6679839844916,
    27.1554870246634,
    -80.6680947191472,
    27.1553660239724,
    -80.668279384442,
    27.1550798248074,
    -80.66834698489,
    27.1549642916886,
    -80.6683593847143,
    27.1548432242984,
    -80.6683101849162,
    27.1547276237897,
    -80.6681687190595,
    27.1545734909874,
    -80.6679841179111,
    27.1544468907341,
    -80.6678363850029,
    27.1544468240932,
    -80.6670609857901,
    27.1558170906695,
    -80.6669317858199,
    27.1558172245472,
    -80.6668271853341,
    27.1557840250493,
    -80.6666919857747,
    27.1552446911476,
    -80.6667105183963,
    27.155134623902,
    -80.6668213180802,
    27.1549420246816,
    -80.6670549849476,
    27.154793491146,
    -80.6674795852521,
    27.1546338906477,
    -80.6678303186443,
    27.154556890968,
    -80.6679287847641,
    27.1545568916289,
    -80.6681071851569,
    27.1546450245379,
    -80.6681933180075,
    27.1547606247241,
    -80.6682117191289,
    27.1548872243023,
    -80.6681931847942,
    27.1549532242227,
    -80.6681809185176,
    27.1549918246254,
    -80.6678917187281,
    27.1553990242445,
    -80.6677069852055,
    27.155542091489,
    -80.667479384833,
    27.1556740913815,
    -80.667270184745,
    27.1558170915238,
    -80.6670609857901,
    27.1558170906695
    ),20,0.001) from dual

    Hi folks,
    Not sure if this is a bug or just how things are. I have a polygon that is valid, looking like an upside Q - i.e. a ring-like polygon with a big hole in the middle. On 10.2.0.4, when I run SDO_UTIL.SIMPLIFY with a 20 meter threshold, it returns NULL. A threshold of 80 returns a line whilst a threshold of 10 returns a reasonable result. But NULL? I don't see anything in the documentation about this.
    Next I tried the exact same thing on 11.1.0.7 and rather than NULL, I get ORA-13199 instead. This seems like an improvement. So I assume what produces NULL on 10g throws an error on 11g. I guess we call that progress and move on - any plans to backport this behavior to 10g?
    But back to the results. Looking through
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28400/sdo_util.htm#sthref2702
    I don't see any mention that a legal function result can be ORA-13199. So is this a bug? Or are some threshold values "just not gonna" work and always return an error by design?
    Thanks!
    Paul
    SELECT
    SDO_UTIL.SIMPLIFY(
    SDO_GEOMETRY(
    2003,
    8265,
    NULL,
    SDO_ELEM_INFO_ARRAY(
    1,
    1003,
    1,
    63,
    2003,
    1
    SDO_ORDINATE_ARRAY(
    -80.6678363850029,
    27.1544468240932,
    -80.6676581190441,
    27.1544578908543,
    -80.6673811848868,
    27.1545404243406,
    -80.6669873181666,
    27.1546888239902,
    -80.6669011856599,
    27.154727424447,
    -80.6667227848805,
    27.1548484903997,
    -80.6666243193133,
    27.1549804918455,
    -80.6665567184542,
    27.1551016239273,
    -80.6665443185942,
    27.1552556914498,
    -80.6666181177095,
    27.1555144243224,
    -80.6667779183997,
    27.1559106917256,
    -80.6668025185416,
    27.1560536914105,
    -80.6668271189153,
    27.1560868245381,
    -80.6668579182135,
    27.1560866907775,
    -80.6669009855045,
    27.1560592917636,
    -80.6669071190522,
    27.1559382250141,
    -80.6669871190558,
    27.1559106906018,
    -80.6673439852962,
    27.1559052909276,
    -80.6673931847717,
    27.1558888246279,
    -80.6674363186955,
    27.1558722246153,
    -80.6675469848459,
    27.1557622244607,
    -80.6678731857396,
    27.155575091261,
    -80.6679839844916,
    27.1554870246634,
    -80.6680947191472,
    27.1553660239724,
    -80.668279384442,
    27.1550798248074,
    -80.66834698489,
    27.1549642916886,
    -80.6683593847143,
    27.1548432242984,
    -80.6683101849162,
    27.1547276237897,
    -80.6681687190595,
    27.1545734909874,
    -80.6679841179111,
    27.1544468907341,
    -80.6678363850029,
    27.1544468240932,
    -80.6670609857901,
    27.1558170906695,
    -80.6669317858199,
    27.1558172245472,
    -80.6668271853341,
    27.1557840250493,
    -80.6666919857747,
    27.1552446911476,
    -80.6667105183963,
    27.155134623902,
    -80.6668213180802,
    27.1549420246816,
    -80.6670549849476,
    27.154793491146,
    -80.6674795852521,
    27.1546338906477,
    -80.6678303186443,
    27.154556890968,
    -80.6679287847641,
    27.1545568916289,
    -80.6681071851569,
    27.1546450245379,
    -80.6681933180075,
    27.1547606247241,
    -80.6682117191289,
    27.1548872243023,
    -80.6681931847942,
    27.1549532242227,
    -80.6681809185176,
    27.1549918246254,
    -80.6678917187281,
    27.1553990242445,
    -80.6677069852055,
    27.155542091489,
    -80.667479384833,
    27.1556740913815,
    -80.667270184745,
    27.1558170915238,
    -80.6670609857901,
    27.1558170906695
    ),20,0.001) from dual

  • 1.5.1: Bug with single keystroke bind value being displayed but ignored

    I just ran into a bug with using with bind values (run as statements) using SQL Developer 1.5.1.54.40, JDK 1.6.0_04, Win XP SP 2.
    If the bind value was previously Null (NULL checkbox checked), then typing one (and only one!) character into the Value field displays the character and deselects the NULL checkbox but is ignored when running the statement - the bind variable is treated as Null. Running the statement again redisplays the bind dialog and the NULL checkbox is deselected but there is no value in the Value field.
    For example: select rpad(dummy, :length, dummy) from dual;
    When running this as a statement and typing a value between 0 and 9 into the Value field results in null (ie select rpad(dummy, null, dummy) from dual). Running again and leaving the Null checkbox unchecked and typing the single character again produces the correct result (ie 9 produces 9 Xs). Running again and checking the Null checkbox and typing the single character again produces null again.
    This only occurs where you type a single key stroke in your bind value. If you type two characters and then delete one, the bind value is used correctly.
    theFurryOne

    Bug 7229257 - entering only one character in bind dialog value field is ignored
    logged.
    -Raghu

  • Trouble with droptarget

    This is from the Flash 8 Doc on dragging MovieClips
    It doesn’t work because it’s suppose to be in a
    onClipEvent
    Why isn’t the Doc updated I find this a lot in Move
    Clip examples
    garbage_mc.onPress = function() {
    this.startDrag(false);
    garbage_mc.onRelease = function() {
    this.stopDrag();
    if (eval(this._droptarget) == trashcan_mc) {
    garbage_mc._visible = false;
    This is the same thing in onClipEvent it doesn’t work
    The eval droptarget isn’t working
    onClipEvent (mouseDown) {
    this.startDrag(false);
    onClipEvent (mouseUp) {
    this.stopDrag();
    if ( eval(this._droptarget) == trashcan_mc) {
    garbage_mc._visible = false;
    This is from an example I found on this Forum the eval drop
    target won’t work either
    on (press) {
    startDrag("");
    on (release) {
    stopDrag();
    if(eval(this._droptarget) == _root.Fire2_mc){
    Fire2_mc._visible = false;
    Help I know it has to be me but I can't see why it won't work
    or why the Doc examples are wrong I have done this in previous
    versions of Flash using the first example from the Doc

    kglad,
    Once again thanks, you nailed that problem!  I thought that (e.dropTarget.parent == DropZ) would produce either True or False, but it produces null if the item is dropped on to an empty stage.  I cleaned up the code a bit it now looks like this:
      function drop(e:MouseEvent) {
       e.target.stopDrag();
       if (e.target.dropTarget == null || e.target.dropTarget.parent != DropZ) {
        e.target.Die();
       } else {
        e.target.y = DropZ.y + 10;
        e.target.filters = null;

  • HELP-Why won't this function return a value

    I want to get this XML data OUT of the function, but it just
    won't work. What I am doing wrong??? Tracing "xmlList" gives me the
    output i want IN the function, but if I can't get it OUT. If i set
    the function to "String", I still can't get the function to return
    a value or anyway to get this data OUT of the function. Please
    help.
    var xml:XML;
    var xmlList:XMLList;
    var xmlLoader:URLLoader = new URLLoader;
    xmlLoader.load(new URLRequest("data/imagesT.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
    function xmlLoaded(event:Event):String
    xml = XML(event.target.data);
    xmlList = xml.children()[0].child(2);

    It won't though. Tracing xmlList outside (i.e. after it runs)
    the function produces null with the function set to void. Inside
    the function tracing producing the correct data.

  • Printing Table as Word Document

    Hi all,
    I recently moved to staging. I tried printing a table to a word file, but it returns weird characters and screws up all the format. How can I go about solving this problem?
    Thanks!

    I should have been more careful of the wording. I was trying to "export" a table either in PDF or word format. The PDF file works fine, but when if I export in Word file, I got an encoding problem that it returns something like this:
    %PDF-1.3
    4 0 obj
    << /Type /Info
    /Producer (null) >>
    endobj
    5 0 obj
    << /Length 631 /Filter /FlateDecode
    >>
    stream
    x]@ sn|p[] 7.
    NwIXNP = [3 p ip ? F4֒حxl:J R?铫%     (Ԋ(BEP     [
    which is totally not what should return from my table.

Maybe you are looking for

  • Tcode CS02 changed triggers idoc but not CS21 using BD21

    Hi when bom is changed using CS02 then when using BD21 triggers IDOC for the message type but when bom is changed using CS21 then it does not trigger idoc using BD21 I checked the code for BD21 message type function I found that change pointer (bdcp2

  • Screen enhancement with table control IW31, IW32, IW33.

    Hi Gurus, I am facing issues with enhancement implementation for Maintenance Orders transaction IW31, IW32, IW33. (SAP basis version 4.7) 1) I have implemented enhancement IWO10018 for creating an Enhancement tab in transactions Iw31/ 32/ 33. This ta

  • File format problem

    hey i have a camcord and i can hook it up to my mac, but my problems are that the video files come up to ".mod" and i need ".mov" ".mpg" etc to edit them. is there any movie program i can buy or use to convert, and i think i have seen IMovie 08 conve

  • How to open link in new tab with right click?

    I'd love to be able to right click, i.e., two finger tap on the magic trackpad, and have a link open in a new tab.  I know I can hold the command button to accomplish this, but then it takes two hands.  I tried the following on the command line which

  • Network sharing administrating

    Hello, I'm using network sharing to share my internet connection (I'm tethering and sharing the internet). I have a problem: _If I set up a password for the sharing, windows OS on other computers cannot connect._ I solved it using no password, but no