users@glassfish.java.net

Re: SEVERE: UTIL6550: Error in local string manager - ...

From: <forums_at_java.net>
Date: Mon, 16 May 2011 08:51:05 -0500 (CDT)

Hi sm157516,
You are right. The adding resource issue has been resolved and the
application client has successfully send all Vehicle objects the
JmsVehicleMDB but resulted in the following exception:

[code]    WARNING: MQJMSRA_MR2001: run:Caught Exception from
onMessage():Redelivering:
    javax.ejb.EJBException: message-driven bean method public abstract
void     javax.jms.MessageListener.onMessage(javax.jms.Message) system
exception
    Caused by: java.lang.NullPointerException
   at ejb.JmsVehicleMDB.onMessage(JmsVehicleMDB.java:36)[/code]
 
Below is the content of JmsVehicleMDB.java & AddVehicleAppClient.java:

[code]15 @MessageDriven(mappedName = "jms/vehicleQueue", activationConfig = 
{
16         @ActivationConfigProperty(propertyName =
"acknowledgeMode", propertyValue = "Auto-acknowledge"),
17         @ActivationConfigProperty(propertyName =
"destinationType", propertyValue = "javax.jms.Queue")
18     })
19
20 public class JmsVehicleMDB implements MessageListener {
21
22     @EJB
23     private VehicleRemote vehiclebean;
24
25     public JmsVehicleMDB() {
26     }
27
28     public void onMessage(Message message) {
29
30         ObjectMessage om = (ObjectMessage) message;
31         Serializable objectData = null;
32         try {
33             objectData = om.getObject();
34             String objectName =
om.getStringProperty("ObjectName");
35             System.out.println("objectName:" + objectName);
36             if (objectName.equals("Vehicle.class"))
37             {
38                 Vehicle retrievedVehicle = (Vehicle)
objectData;
39             //  vehiclebean.createVehicle(retrievedVehicle);
40                
vehiclebean.saveOrUpdateVehicle(retrievedVehicle);
41              }
42          }

public class AddVehicleAppClient {
    @EJB
    private static VehicleRemote vehicleBean;

    @Resource(mappedName = "jms/vehicleQueueConnectionFactory")
    private static ConnectionFactory vehicleQueueConnectionFactory;
    @Resource(mappedName = "jms/vehicleQueue")
    private static Queue vehicleQueue;

    public localImportVehicle() {
    }

    public static void main(String[] args) {
         Vehicle vehicle = new Vehicle();
         vehicle.setMaker(“Toyota”);
         vehicle.setModel(“Lexus”);
         sendVehicleJMSMessageToMyQueue(vehicle);
     }

    public Message createVehicleJMSMessageForjmsMyQueue(Session session,
Object messageData) throws JMSException {
        // TODO create and populate message to send
        ObjectMessage objectMessage = session.createObjectMessage();
        objectMessage.setObject((Vehicle)messageData);
        return objectMessage;
    }

    public void sendVehicleJMSMessageToMyQueue(Object messageData) throws
JMSException {
        Connection connection = null;
        Session session = null;
        try {
            connection =
vehicleQueueConnectionFactory.createConnection();
            session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            MessageProducer messageProducer =
session.createProducer(vehicleQueue);
           
messageProducer.send(createVehicleJMSMessageForjmsMyQueue(session,
messageData));
            …….
    }[/code]

All these codes used to work in Java EE 5 (GF2.1) container.

Any idea on where the issue lies?

Thank you very much again,

Crystal
 


--
[Message sent by forum member 'crytal123']
View Post: http://forums.java.net/node/801806