4 Replies Latest reply on Dec 18, 2007 10:03 AM by 843830

    InstantiationException: No destination location set for message-driven bean

    843830
      I have Oracle JDeveloper Studio Edition Version 10.1.3.2.0.4066.

      I am having problem with my message-driven bean examples. I have two
      files, LogBean.java(MDB) and LogClient.java. Both the files are compiling
      successfully without any warnings and errors. However, when I am trying to
      run the program I am getting Exception: java.lang.InstantiationException: No
      destination location set for message-driven bean LogBean.

      This is Exception:

      [Starting OC4J using the following ports: HTTP=8989, RMI=23892, 
      JMS=9228.]
      
      D:\soft\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config>
      
      D:\soft\jdevstudio10132\jdk\bin\javaw.exe -client -classpath 
      D:\soft\jdevstudio10132\j2ee\home\oc4j.jar;D:\soft\jdevstudio10132\jdev\lib\jdev-oc4j-embedded.jar
       -Xverify:none -XX:MaxPermSize=256m 
      -DcheckForUpdates=adminClientOnly 
      -Doracle.application.environment=development 
      -Doracle.j2ee.dont.use.memory.archive=true 
      -Doracle.j2ee.http.socket.timeout=500 
      -Doc4j.jms.usePersistenceLockFiles=false 
      oracle.oc4j.loader.boot.BootStrap -config 
      D:\soft\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config\server.xml
      
      [waiting for the server to complete its initialization...]
      Apr 28, 2007 1:24:04 AM com.evermind.server.jms.JMSMessages log
      INFO: JMSServer[]: OC4J JMS server recovering transactions (commit 0) 
      (rollback 0) (prepared 0).
      Apr 28, 2007 1:24:04 AM com.evermind.server.jms.JMSMessages log
      INFO: JMSServer[]: OC4J JMS server recovering local transactions 
      Queue[jms/Oc4jJmsExceptionQueue].
      Apr 28, 2007 1:24:14 AM com.evermind.server.ejb.logging.EJBMessages 
      logException
      SEVERE: [current-workspace-app] An error occured deploying EJB module: 
      java.lang.InstantiationException: No destination location set for 
      message-driven bean LogBean
      java.lang.InstantiationException: No destination location set for 
      message-driven bean LogBean
           at com.evermind.server.ejb.deployment.MessageDrivenBeanDescriptor.initialize(MessageDrivenBeanDescriptor.java:241)
           at 
      com.evermind.server.ejb.deployment.BeanDescriptor.initialize(BeanDescriptor.java:278)
           at 
      com.evermind.server.ejb.deployment.MessageDrivenBeanDescriptor.initialize(MessageDrivenBeanDescriptor.java:263)
           at 
      com.evermind.server.ejb.deployment.EJBPackage.initialize(EJBPackage.java:999)
           at 
      com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:852)
           at 
      com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
           at com.evermind.server.Application.setConfig(Application.java:439)
           at com.evermind.server.Application.setConfig(Application.java:340)
           at 
      com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1853)
           at 
      com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1608)
           at 
      com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:990)
           at 
      com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
           at java.lang.Thread.run(Thread.java:595)
      07/04/28 01:24:14 WARNING: Application.setConfig Application: 
      current-workspace-app is in failed state as initialization failed. 
      java.lang.InstantiationException: Error initializing ejb-modules: No 
      destination location set for message-driven bean LogBean
      Apr 28, 2007 1:24:14 AM com.evermind.server.ServerMessages 
      warningApplicationInitializationFailed
      
      WARNING: Exception initializing deployed application: 
      current-workspace-app. Application: current-workspace-app is in failed state 
      as initialization failed
      Ready message received from Oc4jNotifier.
      Embedded OC4J startup time: 41594 ms.
      07/04/28 01:24:29 Oracle Containers for J2EE 10g (10.1.3.1.1)  initialized
      LogBean.java
      -----------------
      package mdbpkg;
      
      import javax.jms.*;
      import javax.ejb.*;
      import javax.annotation.PreDestroy;
      
      @MessageDriven(activationConfig = { 
              @ActivationConfigProperty(propertyName = "destinationType", 
                      propertyValue = "javax.jms.Topic") 
              })
      public class LogBean implements MessageListener {
          
          public LogBean() {
              System.out.println("LogBean created");
          }
          
          public void onMessage(Message msg) {
              if (msg instanceof TextMessage) {
                  TextMessage tm = (TextMessage) msg;
                  try {
                      String text = tm.getText();
                      System.out.println("Received new message : " + text);
                  } catch (JMSException e) {
                      e.printStackTrace();
                  }
              }
          }
          
          @PreDestroy
          public void remove() {
              System.out.println("LogBean destroyed.");
          }
      }
      LogClient.java
      ------------------

      package mdbpkg;
      
      import javax.jms.*;
      import javax.naming.InitialContext;
      
      public class LogClient {
      
          public static void main(String[] args) throws Exception {
              // Initialize JNDI
              InitialContext ctx = new InitialContext(System.getProperties());
      
              // 1: Lookup connection factory        
              TopicConnectionFactory factory = 
                  (TopicConnectionFactory) ctx.lookup("jms/TopicConnectionFactory");
              
              // 2: Use connection factory to create JMS connection
              TopicConnection connection = factory.createTopicConnection();
              
              // 3: Use connection to create a session
              TopicSession session = 
                  connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
              
              // 4: Lookup destination 
              Topic topic = (Topic)ctx.lookup("jms/Topic");        
              
              // 5: Create a message publisher 
              TopicPublisher publisher = session.createPublisher(topic);
      
              // 6: Create and publish a message
              TextMessage msg = session.createTextMessage();
              msg.setText("This is a test message.");
              publisher.send(msg);
              
              // finish
              publisher.close();
              System.out.println("Message published. Please check application server's console to see the response from MDB.");
          }
      }
      Please help.

      Thank you.
        • 1. Re: InstantiationException: No destination location set for message-driven bean
          843830
          I am no guru on MDBs and I am having problems getting the bean to pickup the message from the queue, however I have managed to deploy the EJB successfully and I believe the property that is missing is:

          @ActivationConfigProperty(propertyName = "DestinationName", propertyValue =
          "java:comp/resource/epsMDBRP/Topics/EPS_TOPIC")

          I have also found this to be a very good blog:

          http://mike-lehmann.blogspot.com/2006/09/simple-mdb-with-oracle-database-jms.html
          • 2. Re: InstantiationException: No destination location set for message-driven
            843830
            Hi all - i've just had this error - at the end of the day i had to shut down oc4j, delete the <j2ee_home>/applications/myapp and <j2ee_home>/application-deployments/myapp directories then start oc4j back up again, myapp.ear redeployed itself and the error message was gone.

            Waz.
            =)
            • 3. Re: InstantiationException: No destination location set for message-driven
              843830
              I had the same error and i am using JDev 10.1.3.3.. I think you might have to check the orion-ejb-jar.xml file and set the "message-destination" inside "<message-driven-deployment".. Something like :
              "<message-driven-deployment name="XXXX" destination-location="jms/demoQueue" .. />

              But now i'm facing another problem with it. After doing this, the exception has changed to a 'null pointer exception'.. I'm very new with MDBs and don't know what is happening.. Have been experimenting with all the tags in ejb-jar.xml and orion-ejb-jar.xml.. Still can't figure out what is wrong.. And when i search for the exception in Google, i can't find out any similar posts anywhere..

              I'll post the exception stack here for your reference.. If anyone can help me through this, it'd be really helpful.

              {code}
              com.evermind.server.ejb.logging.EJBMessages logException
              SEVERE: [current-workspace-app] An error occured deploying EJB module: java.lang.NullPointerException
              java.lang.NullPointerException
                   at com.evermind.server.ejb.MessageDrivenHome.lookupJMSResources(MessageDrivenHome.java:327)
                   at com.evermind.server.ejb.MessageDrivenHome.initialize(MessageDrivenHome.java:221)
                   at com.evermind.server.ejb.MessageDrivenHome.start(MessageDrivenHome.java:128)
                   at com.evermind.server.ejb.EJBPackageDeployment.startMessageDrivenHomes(EJBPackageDeployment.java:1182)
                   at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:1051)
                   at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:217)
                   at com.evermind.server.Application.setConfig(Application.java:438)
                   at com.evermind.server.Application.setConfig(Application.java:339)
                   at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1895)
                   at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1651)
                   at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1034)
                   at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
                   at java.lang.Thread.run(Thread.java:595)
              07/12/13 11:52:45 WARNING: Application.setConfig Application: current-workspace-app is in failed state as initialization failed.
              java.lang.InstantiationException: Error initializing ejb-modules: null
              {code}


              And I'm using EJB 2.0, and not 3.0.. So cannot set the properties using @ActivationConfigProperty.


              Thanks in advance

              Pravin
              • 4. Re: InstantiationException: No destination location set for message-driven
                843830
                Hi guys,

                Got that error solved. Don't know what the error was actually.. I just created a new EJB 3.0 and that too in a new application and it worked.. :)


                Pravin