Ik probeer een MBD in de embedded oc4j server van jdeveloper aan de praat te krijgen. Uiteraard wil dit niet lukken, vandaar dit topic. bij het starten krijg ik een No javax.jms.Destination found error (zie hieronder)
Door te googlen kwam ik het volgende tegen:
j2ee/home/config/server.xml:
<jms-config path="./jms.xml"/> is uncommented
j2ee/home/config/jms.xml:
<queue name="Demo Queue" location="jms/demoQueue">
<description>A dummy queue</description>
</queue>
<topic name="Demo Topic" location="jms/demoTopic">
<description>A dummy topic</description>
</topic>
Dit zou moeten kloppen IMHO.
de error:
Door te googlen kwam ik het volgende tegen:
j2ee/home/config/server.xml:
<jms-config path="./jms.xml"/> is uncommented
j2ee/home/config/jms.xml:
<queue name="Demo Queue" location="jms/demoQueue">
<description>A dummy queue</description>
</queue>
<topic name="Demo Topic" location="jms/demoTopic">
<description>A dummy topic</description>
</topic>
Dit zou moeten kloppen IMHO.
de error:
de code:06/09/21 09:40:55 WARNING: Application.setConfig Application: current-workspace-app is in failed state as initialization failedjava.lang.InstantiationException: Error initializing ejb-modules: No javax.jms.Destination found at the specified destination-location (jms/demoTopic) for MessageDrivenBean MessageLoggerBean
2006-09-21 09:40:55.817 WARNING J2EE JNDI0001 Resource Environment reference ts not found. Allowing J2EEContext creation to continue anyway.
2006-09-21 09:40:55.825 ERROR J2EE EJB3027 [current-workspace-app] An error occured deploying EJB module: java.lang.InstantiationException: No javax.jms.Destination found at the specified destination-location (jms/demoTopic) for MessageDrivenBean MessageLoggerBean
Sep 21, 2006 9:40:55 AM com.evermind.server.Application setConfig
WARNING: Application: current-workspace-app is in failed state as initialization failedjava.lang.InstantiationException: Error initializing ejb-modules: No javax.jms.Destination found at the specified destination-location (jms/demoTopic) for MessageDrivenBean MessageLoggerBean
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
| package ejb.message;
import java.util.Date;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
import javax.jms.Message;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "connectionFactoryJndiName", propertyValue = "jms/TopicConnectionFactory"),
@ActivationConfigProperty(propertyName = "destinationName", propertyValue = "jms/demoTopic"),
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "RECIPIENT = 'MDB'")
})
/**
* This is a very simple example of a Message-Driven Bean. It listens to the
* configured JMS Queue or Topic and gets notified via an invocation of it's
* onMessage() method when a message has been posted to the Queue or Topic. This
* bean simply prints out the contents of the message.
*/
public class MessageLoggerBean {
@Resource
javax.ejb.TimerService ts;
public void onMessage(Message message) {
System.out.println("onMessage() - " + message);
try {
String subject = message.getStringProperty("subject");
String inmessage = message.getStringProperty("message");
System.out.println("Message received\n\tDate: "
+ new java.util.Date() + "\n\tSubject: " + subject
+ "\n\tMessage: " + inmessage + "\n");
System.out.println("Creating Timer a single event timer");
// Created a single event timer that expires after 30 secs
ts.createTimer(30000, subject);
System.out.println("Timer created by MDB at: "
+ new Date(System.currentTimeMillis()) + " with info: "
+ subject);
}
catch (Throwable ex) {
ex.printStackTrace();
}
}
@Timeout
public void myTimeout(Timer timer) {
// Implement Your Business Logic Here
System.out.println("EJB 3.0: Timer with MDB");
System.out.println("Timeout method called at: "
+ new Date(System.currentTimeMillis()));
return;
}
} |