Re: JAXB databinding causing build failure in itest/exceptions-simple-ws

2007-12-17 Thread Raymond Feng

Hi,

I just tried and it apparently works with IBM JDK and SUN JDK is not happy 
with it. But anyway, we now use the JAXB to serialize POJO into XML and vice 
versa. The POJOs have to follow JavaBean patterns as I described in the 
e-mail when I checked in the changes.


Now the question is how do we serialize the pure java exceptions (not 
generated from JAX-WS) into XML so that they can flow over SOAP. Maybe we 
have to create a speical databinding from exceptions and then have special 
transformers to deal with the Exception/XML transformations.


Thanks,
Raymond

- Original Message - 
From: "Simon Nash" <[EMAIL PROTECTED]>

To: 
Sent: Monday, December 17, 2007 2:24 PM
Subject: JAXB databinding causing build failure in 
itest/exceptions-simple-ws




I'm seeing the failure below when attempting to build
itest/exceptions-simple-ws from the latest trunk.

From the message and stack trace, it looks like the Exception2Exception
transformer that was previously using a POJO-JavaBean serializer has been
changed to use a JAXB serializer, and this is throwing a JAXB exception
because the business exception object contains an object whose class
doesn't have a no-arg constructor (java.lang.StackTraceElement).

Does anyone know what has changed here and the reason why?

  Simon

Here's the error:

---
 T E S T S
---
Running com.example.ExampleTestCase
17-Dec-2007 21:40:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
17-Dec-2007 21:40:27 org.apache.catalina.startup.ContextConfig 
defaultWebConfig

INFO: No default web.xml
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

1.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

2.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_2_

0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/resources/j2ee_web_services_1_1.xs

d
17-Dec-2007 21:40:27 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8085
17-Dec-2007 21:40:27 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8085
17-Dec-2007 21:40:27 org.apache.tuscany.sca.http.tomcat.TomcatServer 
addServletM

apping
INFO: Added Servlet mapping: 
http://EUREKA:8085/axis2/services/ExampleService
17-Dec-2007 21:40:28 
org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSy

ncMessageReceiver invokeBusinessLogic
SEVERE: org.apache.tuscany.sca.databinding.TransformationException: 
com.sun.xml.
bind.v2.runtime.IllegalAnnotationsException: 1 counts of 
IllegalAnnotationExcept

ions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[] 
java.lang.Throwable.getS

tackTrace()
at java.lang.Throwable
at java.lang.Exception
at com.example.BusinessException

org.osoa.sca.ServiceRuntimeException: 
org.apache.tuscany.sca.databinding.Transfo
rmationException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 
1 cou

nts of IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[] 
java.lang.Throwable.getS

tackTrace()
at java.lang.Throwable
at java.lang.Exception
at com.example.BusinessException

at 
org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(Runt

imeWireInvoker.java:127)
at 
org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(Runt

imeWireInvoker.java:89)
at 
org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker.invoke(Runt

imeWireInvoker.java:83)
at 
org.apache.tuscany.sca.core.assembly.RuntimeWireImpl.invoke(RuntimeWi

reImpl.java:127)
at 
org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider.invokeTa

rget(Axis2ServiceProvider.java:572)
at 
org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageR

eceiver.invokeBusinessLogic(Axis2ServiceInOutSyncMessageReceiver.java:59)
at 
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBus

inessLogic(AbstractInOutSyncMessa

Re: JAXB databinding causing build failure in itest/exceptions-simple-ws

2007-12-18 Thread Simon Nash


Raymond Feng wrote:


Hi,

I just tried and it apparently works with IBM JDK and SUN JDK is not 
happy with it. But anyway, we now use the JAXB to serialize POJO into 
XML and vice versa. The POJOs have to follow JavaBean patterns as I 
described in the e-mail when I checked in the changes.



The difference between using the IBM and Sun JDKs seems to be caused by
the IBM JDK having a private no-argument contructor on StackTraceElement
whereas the Sun JDK doesn't have this no-argument constructor at all.
There's no indication in the Javadoc for StackTraceElement to say which
of these implementations is correct.  The no-argument constructor isn't
mentioned, which presumably means it could be missing or could be private.

Because the Throwable base class for all exceptions has a getStackTrace()
method returning a StackTraceElement[] array, and this method is part of
a getter/setter pair, JAXB serialization and deserialization of exceptions
should fail (according to the JAXB spec) because of the absence of a
public or protected no-argument constructor on StackTraceElement.
It appears that when the IBM JDK is used, the introspection code in JAXB
incorrectly picks up the private no-argument constructor on
StackTraceElement and therefore the error does not occur.

There is a more minor problem even when using the IBM JDK.  Although the
exception makes it through to the client successfully, the exception's
detail message from the server is not being marshalled on the wire because
of a property name conflict between a superclass and a subclass.  I have
been able to modify the business exception class to work around this
problem.  Unfortunately I don't have any workaround for the more serious
problem with the Sun JDK.

Now the question is how do we serialize the pure java exceptions (not 
generated from JAX-WS) into XML so that they can flow over SOAP. Maybe 
we have to create a speical databinding from exceptions and then have 
special transformers to deal with the Exception/XML transformations.



Looking at the JAX-WS and JAXB specifications, it turns out that JAX-WS
does not use the normal JAXB mapping for exceptions.  It defines its own
custom mapping that removes some properties from the exception class to
avoid attempting to serialize things that should not be serialized.
See section 3.7 for details.  We need to implement this JAX-WS exception
mapping in Tuscany.

I have opened TUSCANY-1939 for this problem.  I will investigate how to
create and add a custom mapping for exceptions in the databinding
framework.  If there is any documentation on this that I could look at,
I would appreciate a pointer.

  Simon


Thanks,
Raymond

- Original Message - From: "Simon Nash" <[EMAIL PROTECTED]>
To: 
Sent: Monday, December 17, 2007 2:24 PM
Subject: JAXB databinding causing build failure in 
itest/exceptions-simple-ws




I'm seeing the failure below when attempting to build
itest/exceptions-simple-ws from the latest trunk.

From the message and stack trace, it looks like the Exception2Exception
transformer that was previously using a POJO-JavaBean serializer has been
changed to use a JAXB serializer, and this is throwing a JAXB exception
because the business exception object contains an object whose class
doesn't have a no-arg constructor (java.lang.StackTraceElement).

Does anyone know what has changed here and the reason why?

  Simon

Here's the error:

---
 T E S T S
---
Running com.example.ExampleTestCase
17-Dec-2007 21:40:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
17-Dec-2007 21:40:27 org.apache.catalina.startup.ContextConfig 
defaultWebConfig

INFO: No default web.xml
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

1.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

2.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_2_

0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory register
WARNING: Could not get url for 
/javax/servlet/resources/j2ee_web_services_1_1.xs

d
17-Dec-2007 21:40:27 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8085
17-Dec-2007 21:40:27 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8085
17-Dec-2007 21:40:27 org.apache.tuscany.sca.http.tomcat.TomcatServer 
addServletM

apping
INFO: Added Servlet mapping: 
http://EUREKA:8085/axis2/services/ExampleService
17-Dec-20

Re: JAXB databinding causing build failure in itest/exceptions-simple-ws

2007-12-19 Thread Raymond Feng

Hi, Simon.

I think you are on the right path. FYI, we already have some support for 
JAXB generated java exceptions, but not plain exceptions.


Thanks,
Raymond

- Original Message - 
From: "Simon Nash" <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, December 18, 2007 12:35 PM
Subject: Re: JAXB databinding causing build failure in 
itest/exceptions-simple-ws





Raymond Feng wrote:


Hi,

I just tried and it apparently works with IBM JDK and SUN JDK is not 
happy with it. But anyway, we now use the JAXB to serialize POJO into XML 
and vice versa. The POJOs have to follow JavaBean patterns as I described 
in the e-mail when I checked in the changes.



The difference between using the IBM and Sun JDKs seems to be caused by
the IBM JDK having a private no-argument contructor on StackTraceElement
whereas the Sun JDK doesn't have this no-argument constructor at all.
There's no indication in the Javadoc for StackTraceElement to say which
of these implementations is correct.  The no-argument constructor isn't
mentioned, which presumably means it could be missing or could be private.

Because the Throwable base class for all exceptions has a getStackTrace()
method returning a StackTraceElement[] array, and this method is part of
a getter/setter pair, JAXB serialization and deserialization of exceptions
should fail (according to the JAXB spec) because of the absence of a
public or protected no-argument constructor on StackTraceElement.
It appears that when the IBM JDK is used, the introspection code in JAXB
incorrectly picks up the private no-argument constructor on
StackTraceElement and therefore the error does not occur.

There is a more minor problem even when using the IBM JDK.  Although the
exception makes it through to the client successfully, the exception's
detail message from the server is not being marshalled on the wire because
of a property name conflict between a superclass and a subclass.  I have
been able to modify the business exception class to work around this
problem.  Unfortunately I don't have any workaround for the more serious
problem with the Sun JDK.

Now the question is how do we serialize the pure java exceptions (not 
generated from JAX-WS) into XML so that they can flow over SOAP. Maybe we 
have to create a speical databinding from exceptions and then have 
special transformers to deal with the Exception/XML transformations.



Looking at the JAX-WS and JAXB specifications, it turns out that JAX-WS
does not use the normal JAXB mapping for exceptions.  It defines its own
custom mapping that removes some properties from the exception class to
avoid attempting to serialize things that should not be serialized.
See section 3.7 for details.  We need to implement this JAX-WS exception
mapping in Tuscany.

I have opened TUSCANY-1939 for this problem.  I will investigate how to
create and add a custom mapping for exceptions in the databinding
framework.  If there is any documentation on this that I could look at,
I would appreciate a pointer.

  Simon


Thanks,
Raymond

- Original Message - From: "Simon Nash" <[EMAIL PROTECTED]>
To: 
Sent: Monday, December 17, 2007 2:24 PM
Subject: JAXB databinding causing build failure in 
itest/exceptions-simple-ws




I'm seeing the failure below when attempting to build
itest/exceptions-simple-ws from the latest trunk.

From the message and stack trace, it looks like the Exception2Exception
transformer that was previously using a POJO-JavaBean serializer has 
been

changed to use a JAXB serializer, and this is throwing a JAXB exception
because the business exception object contains an object whose class
doesn't have a no-arg constructor (java.lang.StackTraceElement).

Does anyone know what has changed here and the reason why?

  Simon

Here's the error:

---
 T E S T S
---
Running com.example.ExampleTestCase
17-Dec-2007 21:40:27 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
17-Dec-2007 21:40:27 org.apache.catalina.startup.ContextConfig 
defaultWebConfig

INFO: No default web.xml
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory 
register

WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory 
register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

1.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory 
register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_1_

2.dtd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory 
register
WARNING: Could not get url for 
/javax/servlet/jsp/resources/web-jsptaglibrary_2_

0.xsd
17-Dec-2007 21:40:27 org.apache.catalina.startup.DigesterFactory 
register
WARNING: Could not get url for 
/