JMS QueueBrowser returns void enumeration

It seems that oc4j 9.0.3 is not returning correctly the queue elements via QueueBrowser.getEnumeration(). The enumeration has no elements even when the queue has many of them. Here it is a code snippet:
Context context = new InitialContext();
// Lookup the managed connection factory for a Queue
QueueConnectionFactory queueFactory = (QueueConnectionFactory)context.lookup("java:comp/env/jms/BgPrintQueueFactory");
// Create a connection to the JMS provider
QueueConnection queueConnection = queueFactory.createQueueConnection();
queueConnection.start();
// Create a Queue session
QueueSession session = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
// Lookup the destination you want to publish to
Queue queue = (Queue)context.lookup("java:comp/env/jms/BgPrintQueue");
// Create a browser
QueueBrowser qbrowser = session.createBrowser(queue);
// get elements in queue
Enumeration enum = qbrowser.getEnumeration();
Am I doing something wrong or is there any problem with the oc4j classes implementing the queue or the browser? If so, any alternative to plug an external QueueBrowser into oc4j?
Thanks,
Modulab

I am using oc4j 9.0.3 and running the lightweight oc4j JMS implementation.
The following post on the general Oracle 9iAS forum seems to suggest there are some jms features not implemented in the lightweight jms implementation:
Re: Oracle Light weight JMS & Oracle9iAS 9.0.4
1.Is the QueueBrowser one of these non-implemented features?
2.If so, is oc4j9.0.4 fixing it and when is it to be released? (I expect something less vague than "later that year").
3.Is the lightweight implementation documented? How can I know which features are running ok and which aren't?
Thanks,
Modulab

Similar Messages

  • Returning an Enumeration....

    public java.util.Enumeration getFtpInfo() {
            try {
               return ftp.getFeatures();
            } catch (FtpException ex) {
                ex.printStackTrace();
        }The above method is supposed to return an Enumeration object however because the getFeatures() method throws an exception it must be caught. The problem I have is that the compiler complains and says "return satatement missing".... but it is there !! I am thinking this might be because if an exception is caught then the return statement is never executed. How can I then add another return statement? ..
    Thanks in advance

    You need to return something.
    return the object outside of your try/catch block.
    This means using a temp object as a place holder so you can return it.

  • Is there an error in EJB ql? method returning void - should be int

    Hi, I have this problem.
    I am trying to return a value of type int, but when i call it, i get an error void expected. Any idea where i am wrong?
    Thanks in advance
    ---call method----------
    int q;
    q = lookupClientFacade().UserId(username);
    ---Method------------
    public int UserId(String username) {
    //Id integer value of user is found according to username
    // input String username
    //output Integer id
    //q = null;
    Integer q = null;
    q = (Integer) em.createQuery("SELECT c.cNo from CLIENT WHERE c.cUserName = :sessionName")
    .setParameter("sessionName",username).getSingleResult();
    // convert type Integer to int
    int i = 1;;
    i = q.intValue();
    return i;
    }

    This is the exact error.
    found : void
    required: int
    q = lookupClientFacade().UserId(username);
    1 error

  • Malloc() function in C -- returns void or character pointer?

    I've been learning about the free store and heap memory and what not, and I've got two books telling me two different things. One is telling me that the malloc() function returns a void pointer (note: this book has been wrong before) and the other is telling me that it always returns a character pointer. Which is correct? Thanks!

    Tron55555 wrote:
    when you say "if it's declared as returning a char pointer", are you referring to a theoretical scenario with a different compiler that has declared malloc as returning a char pointer instead of a void pointer? Do I have your meaning right?
    Yes. I think void* is standard, but I recall seeing it declared otherwise. The runtime library is written by programmers and a little time spent in this forum should convince you that programmers don't always agree on what's correct.
    This seems to be the case with Xcode, right?
    Yes. That's why I referred you to the manual page from the Darwin layer. The manual installed there should reflect the current version of gcc, which is the C compiler under Xcode. From the occasional unfortunate experience, we also know that "should" doesn't always equate to "is". But just use that manual and you'll do fine.
    Until I read about this in my other book, I never used casts with the malloc function and it always worked fine. Do you think it would be good programming practice for me to get used to writing the function with a cast in case I ever come across a compiler that requires it? I mean it couldn't hurt to write it that way right, even if I am using a compiler that declares malloc as returning a void pointer and doesn't require a cast?
    This is more a question of programming style. Type casts turn off the compiler's type checking. So in most cases, type casts are to be avoided. In the case of malloc, everyone knows the game, so an optional type cast depends on what you consider good style. The goal of all the style rules, from indenting to commenting, is to make it easy for someone else to read your code and understand it well enough to make a required change. So we ask ourselves, "What would I like to see 10 years from now when I won't even believe I wrote this stupid code?".
    \- Ray
    p.s.: Et's excellent point about byte alignment is a wonderful example of how a type cast can get you on the fast track to trouble. Casting a pointer returned from malloc is fine. But casting a pointer after it's been used could cause a problem. Byte alignment in this case means that an int can't start on an odd numbered memory location (I think it might need to be an address divisible by 4 on a 32-bit machine, but that's an Et question--especially as he's responsible for adding the subject of byte alignment to your thread). - R

  • Void and return help

    whats the difference of using void and using the return?
    i used last time the void and return, but the outputs of the two are the same

    CodeSniffer wrote:
    raychen wrote:
    Using return within a method that returns void is just a quick way to go all the way to the end of the method. It is a goto in disguise, but sometimes it may make your code cleaner.yeah, thats what i saw when im trying to figure out whats the diff of the twoAsking about the difference between void and return is like asking about the difference between being bald and leaving your house. The two are not in any way related, and there's no context in which you can choose between one and the other.
    You're going to have to clarify your question.
    Do you know what void means?
    Do you know what return does?
    If you answered yes to both, then I really have no idea what you're confused about.

  • How to define a function that returns a void?

    Hi all,
    How can I define a custom function that returns a void?
    My understanding is simple UDF can only return a string.
    Is there any way around this limitation?
    Thanks.
    Ron

    > Hi,
    > User Defined Function in XI always return a String.
    >
    > If you requirement is that you want to perfrom some
    > operation in an user defined function, one option is
    > to move it to the Java Section in your mapping and do
    > it in the intialization / clean up section.
    >
    > Else, wite a UDF that will return a Blank string as
    > the output, and map it to the root node of the
    > target.
    >
    Hi all,
    Thank you all for your kind responses.
    The scenario I have is I need to insert the value of a particular field into a database table. E.g. MessageId, to keep track of the messages going through XI.
    Naturally, such operations return void. These operations are already encapsulated in a custom jar file.
    My purpose of using a UDF is solely to invoke the operation.
    But I realized I each UDF has to have a return type, and the output of this UDF must be mapped to a node in the outgoing message.
    Currently, my UDF returns an empty string, by using the implementation as below, I manage to perform my desired operation without affecting the result:
    MessageId -- UDF -- CONCAT -
    InstitutionCD_Transformed
    InstitutionCode_____
    But as you can see, this is not an elegant way of doing things.
    That's why I'm seeking alternative solutions for this problem.
    Bhavesh, you mentioned something about doing the operation in the initialization/cleanup section.
    Can you please explain more?
    Thanks.
    Ron

  • Send message only if not alredy in jms

    Hi
    I have messages in my queue, before sending messages into the queue i want the client to test if the message already exist there and only then to send the messages. Is that possible?

    Yes, use a QueueBrowser to browse, but not remove, items on the queue. You can apply a message selector if you want to only select certains items to browse, e.g.
    Queue queue = ...
    QueueSession session = ...
    QueueBrowser browser = session.createBrowser(queue, "MyProperty = 'some value'");
    Enumeration e = browser.getEnumeration();
    // iterate over the enumeration if you need to check further message details,
    // or simply find out if the enumeration has more elements if you're message
    // selector is selective enough...See http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/QueueBrowser.html for more info.

  • A RunTime exception in JMS

              I am using weblogic server 6.0 service pack 2.
              The problem is in runtime exception in JMS.
              Here is an exception I am getting:
              java.lang.RuntimeException: Client possibly malfunctioning as RuntimeException thrown
              from the onMessage routine of the client
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1938)
              at weblogic.jms.client.JMSSession.run(JMSSession.java:881)
              at weblogic.jms.backend.BEServerSession.execute(BEServerSession.java:83)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              This occurs in the line
              >bsender = bsession.createSender(bqueue);
              of the class, in the onMessage method.
              What is the reason for the exception? What can be done to fix it? I just need to
              process several messages in parallel.
              I have a startup class RateQuoteJMSResponse, that calls JMS.
              This happens only when I have a message listeners pool. When I did not use the pool,
              it worked OK. But I want to allow processing messages in parallel, and as I understand,
              there is no other option except using ServerSessionPool.
              When I tried to do that just with QueueReceiver, it worked OK:
                        qreceiver = qsession.createReceiver (queue);
                        qreceiver.setMessageListener (this);
                        qcon.start();
              However, that way messages were not processed in parallel.
              Here is my code:
              package com.bbb.object.jms;
              import java.io.*;
              import java.util.*;
              import javax.jts.*;
              import javax.naming.*;
              import javax.jms.*;
              import com.bbb.object.*;
              import com.bbb.object.RateQuote.*;
              import org.apache.crimson.tree.*;
              import org.w3c.dom.*;
              import weblogic.jms.extensions.JMSHelper;
              import weblogic.jms.ServerSessionPoolFactory;
              public class RateQuoteJMSResponse implements MessageListener
                   private final static String JNDI_FACTORY="weblogic.jndi.WLInitialContextFactory";
                   private final static String JMS_FACTORY="weblogic.closs.jms.QueueConnectionFactory";
                   private final static String SESSION_POOL_FACTORY="weblogic.jms.ServerSessionPoolFactory:ClossJMSServer";
                   private final static int ALL_OCCUPIED = -1;
                   private static REServer servers [];
                   private static REServersThrottle throttle;
                   private QueueConnectionFactory qconFactory;
                   private QueueConnection qcon;
                   private QueueSession qsession;
                   private QueueSession bsession;
                   //private QueueReceiver qreceiver;
                   private QueueSender bsender = null;
                   private Queue queue;
                   private Queue bqueue;
                   private ServerSessionPoolFactory sessionPoolFactory;
                   private ServerSessionPool sessionPool;
                   private ConnectionConsumer consumer;
                   private int findUnoccupiedServer ()
                        for (int ii = 0; ii < servers.length; ii++)
                             if (servers[ii].isActive () && !servers [ii].isOccupied ())
                                  return ii;
                        return ALL_OCCUPIED;
                   private synchronized void updateServers (ActiveServers activeServers)
                        for (int ii = 0; ii < servers.length; ii++)
                             boolean wasActive = servers[ii].isActive ();
                             boolean nowActive = activeServers.isAlive (servers[ii].getHostName ());
                             if (wasActive && !nowActive)
                                  throttle.removeResource ();
                                  Logging.debugInfoLog ("Resource removed");
                             else if (!wasActive && nowActive)
                                  throttle.addResource ();
                                  Logging.debugInfoLog ("Resource added");
                             servers [ii].setActive (nowActive);
                   // MessageListener interface
                   //public void processMessage (Message msgIn)
                   public void onMessage (Message msgIn)
                        Logging.debugInfoLog ("Starting onMessage");
                        ActiveServers activeServers = null;
                        try
                             activeServers = new ActiveServers();
                        catch (Exception ignored) {}
                        Logging.debugInfoLog ("Active Servers file read");
                        updateServers (activeServers);
                        Logging.debugInfoLog ("Servers updated");
                        throttle.getResource ();
                        Logging.debugInfoLog ("Resource got");
                        try
              Logging.debugInfoLog ("0");
                        String msgTextIn;
                             ObjectMessage msgOut;
                             RateQuoteGetBase rateQuoteGet;
                             RateQuoteGetXML rateQuoteGetXML;
              Logging.debugInfoLog ("1");
                             if (msgIn == null)
              Logging.debugInfoLog ("2");
                                  rateQuoteGet = new RateQuoteGetBase ("Cannot receive a rate quote back from JMS.");
                                  msgTextIn = "";
                             else
              Logging.debugInfoLog ("3");
                                  if (msgIn instanceof TextMessage)
                                  msgTextIn = ((TextMessage)msgIn).getText();
                                  else
                                  msgTextIn = msgIn.toString();
              Logging.debugInfoLog ("4");
                                  bqueue = (Queue) msgIn.getJMSReplyTo ();
              Logging.debugInfoLog ("8");
                                  bsender = bsession.createSender(bqueue);
              Logging.debugInfoLog ("9");
                                  bsender.setDeliveryMode (javax.jms.DeliveryMode.NON_PERSISTENT);
              Logging.debugInfoLog ("10");
                                  Logging.debugInfoLog ("Prepareing to find unoccupied server");
                                  int selectedServer = findUnoccupiedServer ();
                                  Logging.debugInfoLog ("Unoccupied server found: " + selectedServer);
                                  if (selectedServer == ALL_OCCUPIED)
                                       rateQuoteGet = new RateQuoteGetBase ("No nonoccupied rating engines found.");
                                       msgTextIn = "";
                                  else
                                       servers [selectedServer].setOccupied ();
                                       Logging.debugInfoLog ("Set occupied: " + selectedServer);
                                       String hostname = servers [selectedServer].getHostName ();
                                       int portId = servers [selectedServer].getPortId ();
                                       rateQuoteGet = new RateQuoteGetBase (hostname, portId);
                                       rateQuoteGetXML = new RateQuoteGetXML (new RateQuoteGet (rateQuoteGet));
                                       rateQuoteGetXML.prepareXML ();
                                       servers [selectedServer].setUnOccupied ();
                                       Logging.debugInfoLog ("Set unoccupied: " + selectedServer);
                                       if (!rateQuoteGetXML.hasErrorOccured ())
                                            rateQuoteGet.sendXML (msgTextIn);
                                            rateQuoteGet.prepareXML ();
                             Logging.debugInfoLog("Message Received: " + msgTextIn );
                             msgOut = bsession.createObjectMessage ();
                             msgOut.setObject (rateQuoteGet);
                             bsender.send (msgOut, javax.jms.DeliveryMode.NON_PERSISTENT,
                                            javax.jms.Message.DEFAULT_PRIORITY, 18000000L);
                        Logging.debugInfoLog("Message Sent Back: " + rateQuoteGet.getXML());
                             Logging.debugInfoLog ("End of massage sent back");
                             rateQuoteGet.debugPrint ();
                        catch (JMSException jmse)
              Logging.debugInfoLog ("5");
                        jmse.printStackTrace();
              Logging.debugInfoLog ("6");
                        try
                             if (bsender != null)
                                  bsender.close ();
                        catch (JMSException ignored) {}
                        finally
                             bsender = null;
              Logging.debugInfoLog ("7");
                        try
                             throttle.freeResource ();
                             Logging.debugInfoLog ("Resource freed");
                             Logging.debugInfoLog ("Finishing onMessage");
                        catch (Exception ignored) {}
              * Create all the necessary objects for receiving
              * messages from a JMS queue.
                   public void init(Context ctx, String queueName, int countListeners) throws NamingException,
              JMSException
                        //Logging.debugInfoLog ("Class name: " + this.getClass().getName());
                        qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
                        qcon = qconFactory.createQueueConnection();
                        qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                        bsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
                        try
                        queue = (Queue) ctx.lookup(queueName);
                        catch (NamingException ne)
                             ne.printStackTrace ();
                             //queue = (Queue) ctx.lookup (queueName);
                        //queue = qsession.createQueue (queueName);
                             //queue = JMSHelper.createPermanentQueueAsync(ctx, "closs", "ClossJMSServer",
              queueName, JNDI_FACTORY);
                             //JMSHelper.createPermanentQueueAsync(ctx, "ClossJMSServer", queueName, JNDI_FACTORY);
                             //queue = qsession.createQueue("ClossJMSServer/" + queueName);
                             //queue = createPermanentQueueAsync(ctx, jmsServerName, queueName, jndiName);
                        //ctx.bind(queueName, queue);
                        //qreceiver = qsession.createReceiver (queue);
                        //qreceiver.setMessageListener (this);
                        qcon.start();
                        sessionPoolFactory = (ServerSessionPoolFactory) ctx.lookup (SESSION_POOL_FACTORY);
                        sessionPool = sessionPoolFactory.getServerSessionPool (     qcon,
                                                                          countListeners,
                                                                          false,
                                                      Session.AUTO_ACKNOWLEDGE,
                                                      this.getClass().getName());
                        ConnectionConsumer consumer = qcon.createConnectionConsumer (queue, "", sessionPool,
              3*countListeners);
              * Close JMS objects.
                   public void close()
                        try
                             //if (qreceiver != null)
                             //     qreceiver.close();
                             if (consumer != null)
                                  consumer.close();
                        catch (JMSException ignored){}
                        //qreceiver = null;
                        consumer = null;
                        try
                             if (qsession != null)
                                  qsession.close();
                        catch (JMSException ignored){}
                        qsession = null;
                        try
                             if (bsender != null)
                                  bsender.close();
                        catch (JMSException ignored){}
                        bsender = null;
                        try
                             if (bsession != null)
                                  bsession.close();
                        catch (JMSException ignored){}
                        bsession = null;
                        try
                             if (qcon != null)
                                  qcon.close();
                        catch (JMSException ignored){}
                        qcon = null;
              * Receive a JMS message.
                   //public Message receive() throws JMSException
                   //     return qreceiver.receive ();
                   public static void main (String[] args) throws Exception
                        Message msg;
                        int len = args.length;
                        if (len %2 != 0 || len == 0)
                        Logging.debugInfoLog("Usage: java RateQuoteJMSResponse hostname portid hostname
              portid ...");
                        return;
                        int reCount = len/2;
                        throttle = new REServersThrottle (0);
                        servers = new REServer [reCount];
                        for (int ii = 0; ii < reCount; ii++)
                             servers [ii] = new REServer (args [2*ii], args [2*ii + 1]);
                        //Logging.debugInfoLog ("Arguments: " + args[0] + " " + args[1]);
                        InitialContext ic = getInitialContext (ClickProperties.getInitialContext());
                        RateQuoteJMSResponse qr = new RateQuoteJMSResponse ();
                        qr.init (ic, ClickProperties.getJMSQueue(), reCount);
                        Logging.debugInfoLog("JMS Rating Engine Responser Is Ready To Receive Messages.");
                        // Wait until a "quit" message has been received.
                        //synchronized (qr)
                   //     while (true)
                        //          msg = qr.receive ();
                        //          Logging.debugInfoLog ("Message received");
                        //          qr.processMessage (msg);
                        //qr.close();
                   private static InitialContext getInitialContext (String url) throws NamingException
                        Hashtable env = new Hashtable();
                        env.put (Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
                        env.put (Context.PROVIDER_URL, url);
                        return new InitialContext(env);
              And here is the output from weblogic console:
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Active Servers file rea
              d>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Throttle max increased
              to: 1>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Resource added>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Servers updated>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Throttle count increase
              d to: 1>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <Resource got>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <0>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <1>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <3>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <4>
              <May 15, 2002 11:11:57 AM EDT> <Debug> <Debug Info Log> <8>
              java.lang.RuntimeException: Client possibly malfunctioning as RuntimeException t
              hrown from the onMessage routine of the client
              at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1938)
              at weblogic.jms.client.JMSSession.run(JMSSession.java:881)
              at weblogic.jms.backend.BEServerSession.execute(BEServerSession.java:83)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              [config.xml]
              

              Thanks. It creates a new class each time onMessage () is called. I thought it uses
              an existing instance of the class.
              "Zach" <[email protected]> wrote:
              >You need to trap the exception inside the onMessage so you can see the
              >exception that is being thrown by the bsession.createSender call. This
              >stack trace doesn't give enough information. It is just a message saying
              >your code failed to handle and leaked an exception out of the onMessage.
              >If that is the line that failed, then try catch around it and look at the
              >stack trace for that exception.
              >
              >_sjz.
              >
              >"Alexander Rabinowitz" <[email protected]> wrote in message
              >news:[email protected]...
              >>
              >> I am using weblogic server 6.0 service pack 2.
              >> The problem is in runtime exception in JMS.
              >> Here is an exception I am getting:
              >> java.lang.RuntimeException: Client possibly malfunctioning as
              >RuntimeException thrown
              >> from the onMessage routine of the client
              >> at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:1938)
              >> at weblogic.jms.client.JMSSession.run(JMSSession.java:881)
              >> at
              >weblogic.jms.backend.BEServerSession.execute(BEServerSession.java:83)
              >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >>
              >> This occurs in the line
              >>
              >> >bsender = bsession.createSender(bqueue);
              >>
              >> of the class, in the onMessage method.
              >>
              >> What is the reason for the exception? What can be done to fix it? I just
              >need to
              >> process several messages in parallel.
              >
              >
              >
              

  • Does weblogic automatically pools Foreign JMS Connections ?

    I cofigured MQ Series connection factories and queues in my weblogic using Foreign JNDI provider feature.
    I am sending messages to MQ using common JMS approach
         public void sendMessage(List lnTransactionList) throws JMSException {
              XAQueueConnection conn = null;
              try {
                   conn = mqConnectionFactory.createXAQueueConnection("", "");
                   QueueSession session = conn.createQueueSession(false,
                             Session.AUTO_ACKNOWLEDGE);
                   TextMessage message = session.createTextMessage();
                   sender.send(message);
              } catch (JMSException ex) {
                   throw ex;
              } finally {
                   conn.close();
    I know that by default weblogic does some pooling for JMS connections and sessions.
    Does it work for third-party JMS Connections ?
    I checked class names for XAQueueConnection, QueueSession, Queue that weblogic returns for my MQ JNDI objects.
    All of them are from IBM libraries.
    So I think that default pooling doesn`t work in this case.

    Yes, third party pooling is supported and heavily leveraged. JMS resources are automatically pooled when a JMS connection factory is accessed via a standard EJB or Servlet "resource reference" (it is not enough simply to specify a foreign JMS server mapping). You can verify pooling is working by monitoring the stats on the foreign vendor itself, or by monitoring the pool Stats.
    Similar to WebLogic JDBC connection pools, pooled JMS resources still implement all of the public interfaces of a foreign vendor and redirect method invocations on these interfaces to the underlying class. This includes proprietary interfaces.
    Doc links:
    Pooling/Wrapping/Res-Refs:
    http://download.oracle.com/docs/cd/E15523_01/web.1111/e13727/j2ee.htm#g1329180
    FAQ entry on same:
    http://download.oracle.com/docs/cd/E15523_01/web.1111/e13727/interop.htm#i1009836
    Tom

  • Down Casting a Enumeration

    I tried the following code snippet.
    import java.util.*;
    class Strings implements Enumeration {
    public boolean hasMoreElements() { return false;}
    public Object nextElement() {return null;}
    public class MainClass
    public static void main(String args[])
    Vector VectorObj = new Vector();
    VectorObj.add("One");
    VectorObj.add("Two");
    VectorObj.add("Three");
    Strings StringObj = (Strings) VectorObj.elements();
    It compiles properly but i get the following run time exception:
    java.lang.ClassCastException: java.util.Vector$1
    what could be the problem? Do i need to do anything extra for the downcast?
    TIA,
    Babu

    Had a look into the implementation of Vector.elements(). The inner class in elements() was causing the problem.
    public Enumeration elements() {
    return new Enumeration() {
    int count = 0;
    public boolean hasMoreElements() {
    return count < elementCount;
    public Object nextElement() {
    synchronized (Vector.this) {
    if (count < elementCount) {
    return elementData[count++];
    throw new NoSuchElementException("Vector Enumeration");
    Thanks,
    Babu

  • Pointer to void != pointer to function

    Hello C experts,
    this is a simple question about SunStudio's understanding of function pointers (it might have been asked before):
    Why is the following C code giving me a warning on all Sun compilers:
    # cat funcptr.c
    int main() {
        void (*func)() = (void*)0;
        return 0;
    # cc -c funcptr.c
    "funcptr.c", line 2: warning: assignment type mismatch:
         pointer to function() returning void "=" pointer to voidIs the warning emitted by Sun compiler a bug (over-cautions). Other compiler's don't warn here.
    Of course, I could use 0 or NULL as rvalue but I'm just wondering...
    Jochen

    Thanks everybody for your opinions.
    @Stephen:
    I wasn't aware that data pointers and function pointers may differ in any aspect. In fact, I only know data models that talk about 'pointer' width in general, like LP64 (64-bit wide long- and pointertypes), ILP32 (32-bit wide int-, long- and pointer-types), .. I'm especially surprised to hear that casting between data/function pointers will result in undefined behavior.
    Anyway, to properly 'fix' the code above, I must cast the zero to a function pointer (with matching signature) instead of a void pointer. This compiles w/o a warning:
        void (*func)() = (void (*)())0;Thanks for clarification.
    Jochen

  • JMS Correlation ID in JMS Receiver Adapter

    Hi ,
    I am working in PI7.1 on IDOC to JMS interface,
    I want set IDOC number as Correlation ID in JMS queue ,
    I did following Correlation steps ,
    1. Set JMSCorrelation ID to PI Conversation ID
    2. Checked JMS CorrelationID of request
    3.Value to PI Conversation ID
    In Adavanced Tab
    Checked Use Adapter specific Message attributes
    Checked Fial if Adapter specific Message attributes missing
    Checked JMS Message Correlation ID
    Additional Parameter
    DCJMSCorreleationID String
    I have created user defined function , Not using BPM , i don't have correlation ID in target field data type
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
    return conf.put(key, idoc_number); 
    I tested UDF with mapping to target field, UDF is working .
    But in JMS Correlation ID value is null
    I am getting error in Communication Channel  monitor if ticked check box of fail If adapter-specific message attributes
    Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Dynamic header records are missing/incorrect specified in message: 000c2901-fc48-1def-82f9-4b126dff2151. Erroneous/Unspecified headers are: DCJMSCorreleationID
    1/27/10 11:02:36 PM 000c2901-fc48-1def-82f9-4b126dff2151 Dynamic record/records: DCJMSCorreleationID, that correspond to the JMS property/properties: JMSCorrelationID, respectively is/are either missing from the message: 000c2901-fc48-1def-82f9-4b126dff2151, or have invalid types specified in the channel configuration

    Hi Swetha ,
    Thanks for your response ,
    I created user defined function with one parameter , no input parmeter .
    My root node of IDOC as Structure type ,
    In UDF , i have not mapped the IDOC number
    public String CorrelationID(String messageId, Container container) throws StreamTransformationException{
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
    return conf.put(key, messageId);
    messageId  I need map in additonal parameter .
    Thanks ,
    Laxman.
    DCJMSCorreleationID     messageId

  • Set IDOC number as Correlation ID in JMS Receiver Adapter

    Hi ,
    I am working in PI7.1  on IDOC to JMS interface,
    I want set  IDOC number as Correlation ID in JMS queue ,
    I did following Correlation steps ,
    1. Set JMSCorrelation ID to PI Conversation ID
    2. Checked JMS CorrelationID of request
    3.Value to PI Conversation ID
    In Adavanced Tab
    Checked Use Adapter specific Message attributes
    Checked  Fial if  Adapter specific Message attributes missing
    Checked JMS Message Correlation ID
    Additional Parameter
    DCJMSCorreleationID     String
    I have created user defined function ,  Not using BPM , i don't have correlation ID in target field data type
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
    return conf.put(key, messageId);
    please help to how to use UDF in mapping for mapping which field .
    Thanks ,
    Laxman.

    Hi Swetha ,
    Thanks for your response ,
    I created user defined function with one parameter , no input parmeter .
    My root node of IDOC as Structure type ,
    In UDF , i have not mapped the IDOC number
    public String CorrelationID(String messageId, Container container) throws StreamTransformationException{
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSCorreleationID");
    return conf.put(key, messageId);
    messageId  I need map in additonal parameter .
    Thanks ,
    Laxman.
    DCJMSCorreleationID     messageId

  • ClassCastException with javax.jms.ObjectMessage

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

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

  • How to get something in return?

    I'm passing values to my component for an insert into db.
    Since this is an insert, my function doesn't return anything,
    so I wrote <cfreturn true>
    without putting cfreturn I would get an error.
    This is fine except that I need my function to return
    something, just as an indication to the calling template that the
    inserting process is done.
    How can i do that?

    mega_L,
    Please post the contents of your component and the code
    calling the component.
    Can you give us some more information on what you're trying
    to accomplish with your component?
    quote:
    This is fine except that I need my function to return
    something, just as an indication to the calling template that the
    inserting process is done.
    Why would using a function returning void not be appropriate
    for your situation? Even if the function doesn't return a value the
    calling page will normally wait for the function to finish before
    continuing processing unless your using cfthread or something
    similar.
    Should your component throw an exception if the query fails
    or just return an indication of failure to the calling page?

Maybe you are looking for

  • Report workload by calculating how many versions of SharePoint list items created in a certain time period

    I have a total of 66 SharePoint 2010 lists - yes, 66! - each lists contains between 1500 and 3200 list items.  My employees update these various list items throughout their workday.  Each update to a list item creates a new version of the list item. 

  • SAP PI or BizTalk ?

    I am evaluating the internal and external integration scenarios for a large company to help them when they should use SAP PI and when to use BizTalk. In this sense, i have made some comparison and would like to share them with you. Any other comments

  • Worried About My Mini

    "After reading this: Memory available to Mac OS X may vary depending on graphics needs. Minimum graphics memory usage is 80MB, resulting in 432MB of system memory available." I'm getting worried about my upcomming mini. I'm planning to purchase a mac

  • I am using a Conditiona​l Retrieval Trigger but only recording data around a very narrow band relative to the set point. Any thoughts? Thanks

    Since I am pretty new to LabView, I have tried to build this with examples given and have things running my way except for this trigger problem. I would like to have my acquisition channel serve as my trigger channel and only log data after this poin

  • Missing Master Control

    I finally got pacman working today, so I went ahead and installed ALSA and X, as per the Beginners Guide, but when I go into "alsamixer", I ahve no Master channel. I don't have any sound, even after unmuting every other channel. I'm using onboard sou