Re: How to deploy JiBX Maven project from Ant specifications
Hi again John, Sorry for the late answer, I just made a new project which should be an exact (Maven) copy of the Ant project I posted a link to. I did this to make sure that I wasn't wasting you time with a "renaming" error from my part. I got the same error though. Line 51 is the exception itself: catch (Exception e) {throw new JiBXException("Error marshalling XML to Object",e); >> Could you get the XML the method is seeing logged perhaps, or the value of the src parameter? Maybe inspect the cause and message of the exception in catch block? These are good ideas, but I don't know how to do it. Java's "println" does not work, so it is possible til write directly to the ServiceMix console, so we can see the content of the variables we're interested in? Kind regards Kenneth H
Re: How to deploy JiBX Maven project from Ant specifications
Glad you got a bit farther. The exception cites line 51, which line is that from your method? I agree there doesn't look like much to go on from the exception. Could you get the XML the method is seeing logged perhaps, or the value of the src parameter? Maybe inspect the cause and message of the exception in catch block? From: Kenneth Henriksen To: Maven Users List Sent: Wed, December 16, 2009 7:04:42 PM Subject: Re: How to deploy JiBX Maven project from Ant specifications Thank you for your answer John. I believe the TerrorMapping.xml is now included. I still get this error when deploying on ServiceMix though: javax.jms.JMSException: Error sending JBI exchange at org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:575) at org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:505) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876) at java.lang.Thread.run(Thread.java:619) Caused by: org.jibx.runtime.JiBXException: Error marshalling XML to Object at terror.util.JiBXUtil.marshalDocument(JiBXUtil.java:51) at terror.util.TerrorJMSMarshaler.populateMessage(TerrorJMSMarshaler.java:19) at org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.createExchange(DefaultConsumerMarshaler.java:99) at org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:544) ... 10 more The queue I'm sending the "TerrorTypeRequest1" object to is defined like this: xmlns:fork="http://henriksenweb.com/FORK";> . The "JiBXUtil.marshalDocument" function is defined like this: public static Source marshalDocument(Object src, String encoding) throws JiBXException { Source result = null; try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); IMarshallingContext ctx = BindingDirectory.getFactory(src.getClass()).createMarshallingContext(); ctx.marshalDocument(src, "UTF-8", null, bOut); result = new StreamSource(new ByteArrayInputStream(bOut.toByteArray())); } catch (Exception e) { throw new JiBXException("Error marshalling XML to Object",e); } return result; } The relevant part of the TerrorMapping.xml: http://henriksenweb.com/terror";> http://henriksenweb.com/terror"; default="elements"/> And finally the object I'm sending is an instance of the (simple) class "TerrorType1Request": import java.io.Serializable; import java.util.Date; public class TerrorType1Request implements Serializable { private static final long serialVersionUID = -507216273438778375L; private String requestID; private String numberPlate; private String carType; private int buildYear; private boolean companyCar; private Date startDate; public String getRequestID() { return requestID; } public void setRequestID(String requestID) { this.requestID = requestID; } public String getNumberPlate() { return numberPlate; } public void setNumberPlate(String numberPlate) { this.numberPlate = numberPlate; } public String getCarType() { return carType; } public void setCarType(String carType) { this.carType = carType; } public int getBuildYear() { return buildYear; } public void setBuildYear(int buildYear) { this.buildYear = buildYear; } public boolean isCompanyCar() { return companyCar; } public void setCompanyCar(boolean companyCar) { this.companyCar = companyCar; } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } } So where does it go wrong? Could it be something about namespaces? I don't think the exception is telling me much. Kind regards, Kenneth H
Re: How to deploy JiBX Maven project from Ant specifications
Thank you for your answer John. I believe the TerrorMapping.xml is now included. I still get this error when deploying on ServiceMix though: javax.jms.JMSException: Error sending JBI exchange at org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:575) at org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:505) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876) at java.lang.Thread.run(Thread.java:619) Caused by: org.jibx.runtime.JiBXException: Error marshalling XML to Object at terror.util.JiBXUtil.marshalDocument(JiBXUtil.java:51) at terror.util.TerrorJMSMarshaler.populateMessage(TerrorJMSMarshaler.java:19) at org.apache.servicemix.jms.endpoints.DefaultConsumerMarshaler.createExchange(DefaultConsumerMarshaler.java:99) at org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:544) ... 10 more The queue I'm sending the "TerrorTypeRequest1" object to is defined like this: http://servicemix.apache.org/jms/1.0"; xmlns:fork="http://henriksenweb.com/FORK";> . The "JiBXUtil.marshalDocument" function is defined like this: public static Source marshalDocument(Object src, String encoding) throws JiBXException { Source result = null; try { ByteArrayOutputStream bOut = new ByteArrayOutputStream(); IMarshallingContext ctx = BindingDirectory.getFactory(src.getClass()).createMarshallingContext(); ctx.marshalDocument(src, "UTF-8", null, bOut); result = new StreamSource(new ByteArrayInputStream(bOut.toByteArray())); } catch (Exception e) { throw new JiBXException("Error marshalling XML to Object",e); } return result; } The relevant part of the TerrorMapping.xml: http://henriksenweb.com/terror";> http://henriksenweb.com/terror"; default="elements"/> And finally the object I'm sending is an instance of the (simple) class "TerrorType1Request": import java.io.Serializable; import java.util.Date; public class TerrorType1Request implements Serializable { private static final long serialVersionUID = -507216273438778375L; private String requestID; private String numberPlate; private String carType; private int buildYear; private boolean companyCar; private Date startDate; public String getRequestID() { return requestID; } public void setRequestID(String requestID) { this.requestID = requestID; } public String getNumberPlate() { return numberPlate; } public void setNumberPlate(String numberPlate) { this.numberPlate = numberPlate; } public String getCarType() { return carType; } public void setCarType(String carType) { this.carType = carType; } public int getBuildYear() { return buildYear; } public void setBuildYear(int buildYear) { this.buildYear = buildYear; } public boolean isCompanyCar() { return companyCar; } public void setCompanyCar(boolean companyCar) { this.companyCar = companyCar; } public Date getStartDate() { return startDate; } public void setStartDate(Date startDate) { this.startDate = startDate; } } So where does it go wrong? Could it be something about namespaces? I don't think the exception is telling me much. Kind regards, Kenneth H
Re: How to deploy JiBX Maven project from Ant specifications
Hey Kenneth, there is a JiBX Maven plugin you could try. In this example POM snippet below from one of my projects, the binding files are kept in src/main/resources. You could put your insuranceMapping.xml in the includes directly or use a wildcard: org.jibx maven-jibx-plugin 1.2.1 src/main/resources *-binding.xml true process-classes bind JiBX dependency: org.jibx jibx-bind 1.2.1 Hope this helps From: Kenneth Henriksen To: users@maven.apache.org Sent: Wed, December 16, 2009 2:33:24 PM Subject: How to deploy JiBX Maven project from Ant specifications Hi, I'm building a Maven project by looking at this project build by Ant: http://soa.dzone.com/articles/pattern-based-development-with-0?page=0,3 Everything works fine, except that I can't figure out where to put the "InsuranceMapping.xml" file used by JiBX. It is not referenced anywhere except in the original Ant build.xml script seen hereunder ("." infront of "param" is to make sure the whole post is shown): <.param name="servicemix-conf" value="servicemix/insurance-jms-su" /> <.param name="service-dest-file" value="insurance-jms-su.zip" /> <.param name="jibx-mapping" value="jibx/InsuranceMapping.xml" /> <.param name="include-classes" value="esb/dzone/servicemix/model/*" /> <.param name="include-resource-dir" value="servicemix/insurance-jms-su/resources" /> <.param name="servicemix-conf" value="servicemix/insurance-file-su" /> <.param name="service-dest-file" value="insurance-file-su.zip" /> <.param name="include-classes" value="esb/dzone/servicemix/model/*" /> <.param name="jibx-mapping" value="jibx/InsuranceMapping.xml" /> <.param name="include-resource-dir" value="servicemix/insurance-file-su/resources" /> How du I do the same thing in my Maven project. Shoud the "InsuranceMapping.xml" be referenced from some POM file? Kind regards, Kenneth H
How to deploy JiBX Maven project from Ant specifications
Hi, I'm building a Maven project by looking at this project build by Ant: http://soa.dzone.com/articles/pattern-based-development-with-0?page=0,3 Everything works fine, except that I can't figure out where to put the "InsuranceMapping.xml" file used by JiBX. It is not referenced anywhere except in the original Ant build.xml script seen hereunder ("." infront of "param" is to make sure the whole post is shown): <.param name="servicemix-conf" value="servicemix/insurance-jms-su" /> <.param name="service-dest-file" value="insurance-jms-su.zip" /> <.param name="jibx-mapping" value="jibx/InsuranceMapping.xml" /> <.param name="include-classes" value="esb/dzone/servicemix/model/*" /> <.param name="include-resource-dir" value="servicemix/insurance-jms-su/resources" /> <.param name="servicemix-conf" value="servicemix/insurance-file-su" /> <.param name="service-dest-file" value="insurance-file-su.zip" /> <.param name="include-classes" value="esb/dzone/servicemix/model/*" /> <.param name="jibx-mapping" value="jibx/InsuranceMapping.xml" /> <.param name="include-resource-dir" value="servicemix/insurance-file-su/resources" /> How du I do the same thing in my Maven project. Shoud the "InsuranceMapping.xml" be referenced from some POM file? Kind regards, Kenneth H