Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

InstantiationException: No destination location set for message-driven bean

843830Apr 27 2007 — edited Dec 18 2007
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 15 2008
Added on Apr 27 2007
4 comments
1,022 views