Hi,

I just fixed the issue in trunk. The root cause is the classloader for the 
generated fault bean. We used to set the parent of classloader to be the 
classloader of the exception class which can be part of the JDK. IBM JDK seems 
to use the classloader of the generated fault bean to load the annotation 
class. With the fix, we change the parent to be the classloader of the java 
interface.

Thanks,
Raymond


From: Simon Laws 
Sent: Thursday, July 31, 2008 7:51 AM
To: [email protected] 
Subject: Re: [jira] Commented: (TUSCANY-2519) "throws Exception" causes failure 
in JAXB type generation





On Thu, Jul 31, 2008 at 3:29 PM, Scott Kurz <[EMAIL PROTECTED]> wrote:

  It's not your Exception test class .. just the fact that this is the first 
bottom-up (intf.java) test added to this test bucket, so the pom.xml needs the 
jaxb dependencies added. 

  I'd guess you can find the right pom entry someplace like 
'itest/databindings/jaxb-bottom-up' 




  On Thu, Jul 31, 2008 at 10:18 AM, Simon Laws <[EMAIL PROTECTED]> wrote:




    On Thu, Jul 31, 2008 at 3:04 PM, Scott Kurz (JIRA) <[email protected]> 
wrote:


         [ 
https://issues.apache.org/jira/browse/TUSCANY-2519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618686#action_12618686
 ]

      Scott Kurz commented on TUSCANY-2519:
      -------------------------------------

      I tried recreating and hit the same problem with an IBM 5.0 JDK, but when 
I used an IBM 6.0 JDK it worked fine.

      I guess there's a need for a jaxb dependency to be declared in the pom at 
the Java 5 level.

      > "throws Exception" causes failure in JAXB type generation
      > ---------------------------------------------------------
      >
      >                 Key: TUSCANY-2519
      >                 URL: https://issues.apache.org/jira/browse/TUSCANY-2519
      >             Project: Tuscany
      >          Issue Type: Bug
      >    Affects Versions: Java-SCA-1.3
      >         Environment: WinXP SP2 IBM JDK5.0
      >            Reporter: Simon Laws
      >             Fix For: Java-SCA-Next
      >
      >         Attachments: TUSCANY-2519-reproduce.patch
      >
      >
      > An interface with a method such as;
      > public String hello(String name) throws Exception;
      > Causes our WSDL generation code to bail out with;
      > Caused by: java.lang.TypeNotPresentException: Type 
javax.xml.bind.annotation.XmlRootElement not present
      >       at 
com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:38)
      >       at 
com.ibm.oti.reflect.AnnotationHelper.getDeclaredAnnotations(AnnotationHelper.java:50)
      >       at java.lang.Class.getDeclaredAnnotations(Class.java:1620)
      >       at java.lang.Class.getAnnotations(Class.java:1581)
      >       at java.lang.Class.getAnnotation(Class.java:1561)
      >       at 
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getClassAnnotation(RuntimeInlineAnnotationReader.java:102)
      >       at 
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader.getClassAnnotation(RuntimeInlineAnnotationReader.java:53)
      >       at 
com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:325)
      >       at 
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:432)
      >       at 
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286)
      >       at 
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
      >       at 
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
      >       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      >       at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
      >       at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      >       at java.lang.reflect.Method.invoke(Method.java:615)
      >       at 
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
      >       at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
      >       at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
      >       at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
      >       at 
org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache.getJAXBContext(JAXBContextCache.java:275)
      >       at 
org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBContext(JAXBContextHelper.java:179)
      >       at 
org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper.createJAXBContext(JAXBContextHelper.java:211)
      >       at 
org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper.getSchemaDefinitions(JAXBTypeHelper.java:238)
      >       ... 28 more
      > Caused by: java.lang.ClassNotFoundException: 
javax.xml.bind.annotation.XmlRootElement
      >       at java.lang.Class.forName(Class.java:163)
      >       at 
com.ibm.oti.reflect.AnnotationHelper.getAnnotation(AnnotationHelper.java:33)
      >       ... 51 more
      > The RI tooling seems to able to happily cope with this.

      --
      This message is automatically generated by JIRA.
      -
      You can reply to this email to add a comment to the issue online.




    Ah hadn't tried JDK6.  Seems funny though that it works on most types but 
this one. Does Exception have some embedded annotation, that is not in our test 
classes,  that is causing the context to throw the error?

    Simon




With Java 5 if I change 

public String hello(String name) throws Exception;

to 

public String hello(String name) throws BusinessExceptionMinimal;

The test runs fine with no other changes. I.e. it's happily doing a WSDL gen 
without error. 

The test runs with both forms of this method with the version of Java6 I have 
installed. So something is missing form/different in Java5 but it seems to be 
the configuration of the Exception class that is causing it to go down a path 
that makes whatever is different  important. 

Simon

Reply via email to