InstantiationException: No destination location set for message-driven bean

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

[waitingfor 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 setfor

message-driven bean LogBean

java.lang.InstantiationException: No destination location setfor

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 setfor 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 Containersfor 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")

})

publicclass LogBeanimplements MessageListener{

public LogBean(){

System.out.println("LogBean created");

}

publicvoid onMessage(Message msg){

if (msginstanceof TextMessage){

TextMessage tm = (TextMessage) msg;

try{

String text = tm.getText();

System.out.println("Received new message : " + text);

}catch (JMSException e){

e.printStackTrace();

}

}

}

@PreDestroy

publicvoid remove(){

System.out.println("LogBean destroyed.");

}

}

LogClient.java

package mdbpkg;

import javax.jms.*;

import javax.naming.InitialContext;

publicclass LogClient{

publicstaticvoid 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.

[8307 byte] By [anurag_patila] at [2007-11-27 2:39:55]
# 1

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

mcleoma at 2007-7-12 3:02:19 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

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.

=)

Waza at 2007-7-12 3:02:19 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...