JMSRouter issue
beve Dec 10, 2006 1:40 PMHi,
had a problem getting the JMSRouter to work. The first problem i ran into was the following:
15:35:47,509 ERROR [ActionProcessingPipeline] Premature termination of action processing pipeline [Ljava.lang.String;@1f82ab4]. ActionProcessor [org.jboss.soa.esb.actions.routing.JMSRouter] method not found java.lang.NoSuchMethodException: org.jboss.soa.esb.actions.routing.JMSRouter.<init>(org.jboss.soa.esb.helpers.ConfigTree) at java.lang.Class.getConstructor0(Class.java:2647) at java.lang.Class.getConstructor(Class.java:1629) at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:75) at java.lang.Thread.run(Thread.java:595)
I added the missing constructor as follows:
private ConfigTree configTree; public JMSRouter(String actionName, List<KeyValuePair> properties) throws ConfigurationException, NamingException, JMSException { createJMSRouter( properties ); } public JMSRouter(ConfigTree configTree) throws NamingException, JMSException, ConfigurationException { this.configTree = configTree; List<KeyValuePair> properties = new ArrayList<KeyValuePair>(); ConfigTree[] confProperties = configTree.getAllChildren(); for (int x = 0; x < confProperties.length; x++) { String attrName = confProperties[x].getAttribute("name"); String attrValue = confProperties[x].getAttribute("value"); properties.add( new KeyValuePair( attrName, attrValue ) ); } createJMSRouter( properties ); } private void createJMSRouter(List<KeyValuePair> properties) throws ConfigurationException, NamingException, JMSException { this.properties = properties; String queueName = KeyValuePair.getValue("jndiName", properties); if(queueName == null) { throw new ConfigurationException("JMSRouter must specify a 'jndiName' property."); } queueSetup = new JMSSendQueueSetup(queueName); }
After this was added a got the following exception :
19:19:53,401 ERROR [ActionProcessingPipeline] Process method threw Exception java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:89) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.NullPointerException at org.jboss.soa.esb.actions.routing.JMSRouter.process(JMSRouter.java:137) ... 6 more
Please note that the line numbers may not match the current svn code, but line 137 is the following line in my code(JMSRouter process method):
Object oCurr = ActionUtils.getTaskObject(message); if(!(oCurr instanceof Serializable)) { throw new ActionProcessingException("Cannot send Object [" + oCurr.getClass().getName() + "] to destination [" + queueSetup.queueName + "]. Object must be serializable."); }
When I made the following change to FileGatewayListener.PackageFileContents things seem to work:
public Message process (Object obj) throws Exception { if (! (obj instanceof File)) throw new Exception ("Object must be instance of File"); Message message = MessageFactory.getInstance().getMessage(); ActionUtils.setTaskObject(message, getFileContent((File)obj)); //message.getBody().setContents(getFileContent((File)obj)); return message; }
The bold line is the one I added and the line that is commented out is the original.
Don't know if this is a valid solution but it seems to work for me.
/Daniel