Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 59934 invoked from network); 4 Jun 2009 15:52:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 4 Jun 2009 15:52:25 -0000 Received: (qmail 48279 invoked by uid 500); 4 Jun 2009 15:42:27 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 48244 invoked by uid 500); 4 Jun 2009 15:42:25 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 48234 invoked by uid 99); 4 Jun 2009 15:42:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 15:42:24 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: unknown ipv4:83.244.179.212/29mx-all (nike.apache.org: encountered unrecognized mechanism during SPF processing of domain of gavin.ellis@mfuse.com) Received: from [83.244.179.212] (HELO proxmox.mfuse.com) (83.244.179.212) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2009 15:42:08 +0000 Received: from proxmox.mfuse.com (localhost [127.0.0.1]) by proxmox.mfuse.com (Proxmox) with ESMTP id 61D1C706AE for ; Thu, 4 Jun 2009 16:41:46 +0100 (BST) Received: from MHLEXB02.mfuse.net (mhlexb02.mfuse.net [10.64.60.148]) by proxmox.mfuse.com (Proxmox) with ESMTP id 23FD270688 for ; Thu, 4 Jun 2009 16:41:46 +0100 (BST) Received: from MHLEXB02.mfuse.net ([10.64.60.148]) by MHLEXB02.mfuse.net ([10.64.60.148]) with mapi; Thu, 4 Jun 2009 16:41:46 +0100 From: Gavin Ellis To: "axis-user@ws.apache.org" Date: Thu, 4 Jun 2009 16:41:41 +0100 Subject: RE: JAXBException..... doesn't contain ObjectFactory.class or jaxb.index Thread-Topic: JAXBException..... doesn't contain ObjectFactory.class or jaxb.index Thread-Index: Acnkdm/elRawMYNAQ8iUAbn9ASgL2gAs4Ing Message-ID: <0148C484084C7E498FDE04F7F20361DA16BF4F8290@MHLEXB02.mfuse.net> References: <0148C484084C7E498FDE04F7F20361DA16BF4F80A0@MHLEXB02.mfuse.net> <0148C484084C7E498FDE04F7F20361DA16BF4F80E7@MHLEXB02.mfuse.net> In-Reply-To: Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: multipart/alternative; boundary="_000_0148C484084C7E498FDE04F7F20361DA16BF4F8290MHLEXB02mfuse_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_0148C484084C7E498FDE04F7F20361DA16BF4F8290MHLEXB02mfuse_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Ok, looks like jaxb was complaining about the default class loader used to = look up the context ObjectFactory. By default inside JAXBContext.newInstance(String contextPath) Initialises the class loader using Thread.currentThread().getContextClassLoader() i.e. public static JAXBContext newInstance( String contextPath ) throws JAXBException { //return newInstance( contextPath, JAXBContext.class.getClassLoader= () ); return newInstance( contextPath, Thread.currentThread().getContextC= lassLoader() ); } For some reason tomcat/axis doesn't like this and you won't find the Object= Factory on the classpath. This is remedied by getting a handle on the classloader in the following wa= y: JAXBContext jaxbReqContext =3D JAXBContext.newInstance(requestContext, this= .getClass().getClassLoader()); Thanks for the responses to my initial post. Gavin Ellis Free Man From: Martin Gainty [mailto:mgainty@hotmail.com] Sent: 03 June 2009 19:09 To: axis-user@ws.apache.org Subject: RE: JAXBException..... doesn't contain ObjectFactory.class or jaxb= .index here is an example of a constructed jaxws artifact cd $AXIS2_HOME/samples/jaxws-addressbook //To build this sample, execute the following maven command: mvn clean install //This will do the following: //- Generate the JAXB artifacts (in target/schema) //- Compile the service implementation classes (in target/classes), includi= ng the JAXB //artifacts, // and create a JAR containing those classes (target/jaxws-addressbook-//S= NAPSHOT.jar) //- Compile the Dispatch client classes (in target/classes) and create a JA= R //containing those classes // (target/jaxws-addressbook-SNAPSHOT-Client.jar). //Step 1: Generate JAXB artifacts from simple schema //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D //The file src/AddressBookEntry.xsd describes a simple AddressBookEntry obj= ect with //the following fields: // String firstName; ....... //The following JAXB artifacts are generated in the target/schema/src direc= tory when //the sample is built //org\apache\axis2\jaxws\addressbook\AddressBookEntry.java //org\apache\axis2\jaxws\addressbook\ObjectFactory.java //org\apache\axis2\jaxws\addressbook\package-info.java //These files will be compiled into target/classes as part of the build. he= re is proof [INFO] [antrun:run {execution: gen-sources}] [INFO] Executing tasks [mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema [mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema\src [mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema\classes [echo] Generating java from echo.xsd [java] parsing a schema... [java] compiling a schema... [java] org\apache\axis2\jaxws\addressbook\AddressBookEntry.java [java] org\apache\axis2\jaxws\addressbook\ObjectFactory.java [java] org\apache\axis2\jaxws\addressbook\package-info.java [INFO] Executed tasks afterwards my Directory of $AXIS2_HOME\samples\jaxws-addressbook\target\cla= sses\org\apa che\axis2\jaxws\addressbook contains 06/03/2009 01:16 PM 372 AddressBook.class 06/03/2009 01:16 PM 3,469 AddressBookClient.class 06/03/2009 01:16 PM 1,962 AddressBookEntry.class 06/03/2009 01:16 PM 1,873 AddressBookImpl.class 06/03/2009 01:16 PM 1,525 ObjectFactory.class pom.xml contained within gen-sources generate-sources Generating java from echo.xsd run //also if well at the pom.xml in modules/jaxbri we see the generate-test-so= urces phase will create required classes gen-ts generate-test-sources Generating JAX-B classes for DocLitBa= reService test .......... run F:\AXIS\axis2-1.4\modules\jaxbri>mvn -e generate-test-sources + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] --------------------------------------------------------------------= ---- [INFO] Building Apache Axis2 - JAXB-RI Data Binding [INFO] task-segment: [generate-test-sources] [INFO] --------------------------------------------------------------------= ---- [INFO] artifact org.codehaus.mojo:build-helper-maven-plugin: checking for u= pdate s from ws-zones [INFO] [resources:resources] [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resour= ces, i.e. build is platform dependent! [INFO] Copying 2 resources [INFO] skip non existing resourceDirectory F:\AXIS\axis2-1.4\modules\jaxbri= \conf [INFO] Copying 1 resource [INFO] [compiler:compile] [INFO] Compiling 3 source files to F:\AXIS\axis2-1.4\modules\jaxbri\target\= class es [INFO] [antrun:run {execution: gen-ts}] [INFO] Executing tasks [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\target\schema [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\target\schema\src [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\target\schema\cla= sses [echo] Generating JAX-B classes for DocLitBareService test [echo] Generating Service / Service Client for Test01 test [java] Retrieving document at 'test-resources/wsdl/Test01.wsdl'. //proof that sources were generated in the correct folder Directory of F:\AXIS\axis2-1.4\modules\jaxbri\target\wsdl\Test01\src\com\f= oo\xm lns\axis2\test01 06/03/2009 01:28 PM 1,720 Add.java 06/03/2009 01:28 PM 1,669 ObjectFactory.java 06/03/2009 01:28 PM 192 package-info.java //command line tool used to create these class is called wsimport here is t= he doc You can use the JAX-WS tool, wsimport, to process a WSDL file and generate portable Java artifacts that are used to create a Web service. The portable Java artifacts created using the wsimport tool are: Service endpoint interface (SEI) Service class Exception class that is mapped from the wsdl:fault class (if any) Java Architecture for XML Binding (JAXB) generated type values which are Java classes mapped from XML schema types Run the wsimport -keep -verbose wsdl_URL command to generate the portable artifacts. The -keep option tells the tool not to delete the generated files, and the -verbose option tells it to list the files that were created. The ObjectFactory.java file that is created contains factory methods for ea= ch Java content interface and Java element interface generated in the associated package. The package-info.java file takes the targetNamespace value and creates the directory structure. http://java.sun.com/javase/6/docs/technotes/tools/share/wsimport.html conclusion:execute maven task which calls generate-test-sources and generat= es classes from com.sun.tools.xjc.Driver after that you would only need to compile with javac build your service aar then deploy to axis2 HTH Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterle= itung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient led= iglich dem Austausch von Informationen und entfaltet keine rechtliche Bindu= ngswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir= keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAtes= pas le destinataire pr=E9vu, nous te demandons avec bont=E9 que pour satis= faire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e o= u la copie de ceci est interdite. Ce message sert =E0 l'information seuleme= nt et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9tant don= n=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulation, no= us ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni. ________________________________ From: gavin.ellis@mfuse.com To: axis-user@ws.apache.org Date: Wed, 3 Jun 2009 17:33:09 +0100 Subject: RE: JAXBException..... doesn't contain ObjectFactory.class or jaxb= .index As I understand it the jaxb.index file is not relevant in this scenario, or= at least doesn't exist in the standalone version that works. So in this ca= se, is the problem when trying to load ObjectFactory.class caused by a simi= lar issue? Gavin Ellis From: Martin Gainty [mailto:mgainty@hotmail.com] Sent: 03 June 2009 17:03 To: Gavin Ellis Subject: RE: JAXBException..... doesn't contain ObjectFactory.class or jaxb= .index --a definite bug The javadoc for JAXBContext.newInstance(String,ClassLoader) needs to more c= learly specify the expected format of the class names listed in "jaxb.index= ". Right now, the RI is expecting classnames of the form: "ClassName.class" The attached test case is failing because the index file contains: "fully.q= ualified.ClassName" also "modify the RI to work for "ClassName" rather than "ClassName.class" specifying classname without package. prefix or .class suffix is the fix http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=3D6314008 so it seems the workaround is to use "ClassName.class" and not PackageName.= ClassName.class (patch was supposed to be applied in JAXB 2) does this help? Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterle= itung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient led= iglich dem Austausch von Informationen und entfaltet keine rechtliche Bindu= ngswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir= keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAtes= pas le destinataire pr=E9vu, nous te demandons avec bont=E9 que pour satis= faire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e o= u la copie de ceci est interdite. Ce message sert =E0 l'information seuleme= nt et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9tant don= n=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulation, no= us ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni. ________________________________ From: gavin.ellis@mfuse.com To: axis-user@ws.apache.org Date: Wed, 3 Jun 2009 15:41:59 +0100 Subject: JAXBException..... doesn't contain ObjectFactory.class or jaxb.ind= ex I'm currently experiencing an issue when trying to initialise a jaxb contex= t inside a jar dependency inside an axis aar module i.e. axis.war\WEB-INF\services\myService.aar!\lib\myDependency.jar!\com.mycompan= y.MyClass.class I have tested this lib standalone and everything works fine, the jaxb conte= xt is initialised as expected. However when it is referenced inside an aar = module inside axis, then the following exception is thrown: javax.xml.bind.JAXBException: "com.mfuse.novo.transactions.adapter.orbis.ox= i.generated" doesnt contain ObjectFactory.class or jaxb.index at com.sun.xml.bind.v2.ContextFactory.createContext(Context= Factory.java:183) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Meth= od) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethod= AccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegati= ngMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javax.xml.bind.ContextFinder.newInstance(ContextFinder.j= ava:128) at javax.xml.bind.ContextFinder.find(ContextFinder.java:277= ) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:= 372) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:= 337) at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:= 244) at com.mfuse.novo.adapters.connections.jaxb.JaxbConnectionI= mpl.initMarshaller(JaxbConnectionImpl.java:70) ... 34 more I have debugged into the code and attempted to load ObjectFactory manually = and it appears to be on the classpath. I've also inspected the package insi= de the jar and it contains ObjectFactory.class. I noticed that axis WEB-INF/lib already contains an earlier version of jaxb= , which I thought might possibly be causing a conflict here so tried swappi= ng these out for the ones that I used in the lib, but this made no differen= ce. Has anyone else experienced a similar issue? Regards, Gavin Ellis ________________________________ The information contained in this message is confidential and is intended f= or the addressee only. Any unauthorised dissemination or copying or use or = disclosure of information contained herein is strictly prohibited and may b= e illegal. If you are not the named or intended recipient please notify us = immediately by telephone (+44 207 154 2070) or return e-mail. We have insta= lled active virus software but do not accept liability or responsibility fo= r the security or reliability of transmission or for any virus transmitted;= as such you should carry out your own virus checks before opening any atta= chment. Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN ________________________________ Windows Live(tm) SkyDrive(tm): Get 25 GB of free online storage. Get it on = your BlackBerry or iPhone. ________________________________ The information contained in this message is confidential and is intended f= or the addressee only. Any unauthorised dissemination or copying or use or = disclosure of information contained herein is strictly prohibited and may b= e illegal. If you are not the named or intended recipient please notify us = immediately by telephone (+44 207 154 2070) or return e-mail. We have insta= lled active virus software but do not accept liability or responsibility fo= r the security or reliability of transmission or for any virus transmitted;= as such you should carry out your own virus checks before opening any atta= chment. Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN ________________________________ Insert movie times and more without leaving Hotmail=AE. See how. ________________________________ The information contained in this message is confidential and is intended f= or the addressee only. Any unauthorised dissemination or copying or use or = disclosure of information contained herein is strictly prohibited and may b= e illegal. If you are not the named or intended recipient please notify us = immediately by telephone (+44 207 154 2070) or return e-mail. We have insta= lled active virus software but do not accept liability or responsibility fo= r the security or reliability of transmission or for any virus transmitted;= as such you should carry out your own virus checks before opening any atta= chment. Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN --_000_0148C484084C7E498FDE04F7F20361DA16BF4F8290MHLEXB02mfuse_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Ok, looks like jaxb was complaining about the default class = loader used to look up the context ObjectFactory. By default inside

 

JAXBContext.newInstance(String contextPath)

 

Initialises the class loader using

 

Thread.currentThread().getContextClassLoader()

 

i.e.

 

public static JAXBContext newInstance( String c= ontextPath )

    &n= bsp;   throws JAXBException {

    &n= bsp;      

    &n= bsp;   //return newInsta= nce( contextPath, JAXBContext.class.getClassLoader() );

    &n= bsp;   return newInstance( contextPath, Thread.currentThread().getContextCl= assLoader() );

    }

 

 

For some reason tomcat/axis doesn’t like this and you = won’t find the ObjectFactory on the classpath.

 

This is remedied by getting a handle on the classloader in t= he following way:

 

JAXBContext jaxbReqContext =3D JAXBContext.newInstance(= requestContext, this.getClass().getClassLoader());

 

Thanks for the responses to my initial post.

 

Gavin Ellis
Free Man

 

 

From: Martin Gainty [mail= to:mgainty@hotmail.com]
Sent: 03 June 2009 19:09
To: axis-user@ws.apache.org
Subject: RE: JAXBException..... doesn't contain ObjectFactory.class = or jaxb.index

 

here is an example of a constructed jax= ws artifact
cd $AXIS2_HOME/samples/jaxws-addressbook

//To build this sample, execute the following maven command:
mvn clean install

//This will do the following:
//- Generate the JAXB artifacts (in target/schema)
//- Compile the service implementation classes (in target/classes), includi= ng the JAXB //artifacts,
//  and create a JAR containing those classes (target/jaxws-addressboo= k-//SNAPSHOT.jar)
//- Compile the Dispatch client classes (in target/classes) and create a JA= R //containing those classes
//  (target/jaxws-addressbook-SNAPSHOT-Client.jar). 

//Step 1: Generate JAXB artifacts from simple schema
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D
//The file src/AddressBookEntry.xsd describes a simple AddressBookEntry obj= ect with //the following fields:
//    String firstName;
.......

//The following JAXB artifacts are generated in the target/schema/src direc= tory when //the sample is built
//org\apache\axis2\jaxws\addressbook\AddressBookEntry.java
//org\apache\axis2\jaxws\addressbook\ObjectFactory.java
//org\apache\axis2\jaxws\addressbook\package-info.java

//These files will be compiled into target/classes as part of the build. he= re is proof
[INFO] [antrun:run {execution: gen-sources}]
[INFO] Executing tasks
[mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema
[mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema\src
[mkdir] Created dir: F:\AXIS\axis2-1.4\samples\jaxws-addressbook\target\sch= ema\classes
     [echo] Generating java from echo.xsd
     [java] parsing a schema...
     [java] compiling a schema...
     [java] org\apache\axis2\jaxws\addressbook\AddressB= ookEntry.java
     [java] org\apache\axis2\jaxws\addressbook\ObjectFa= ctory.java
     [java] org\apache\axis2\jaxws\addressbook\package-= info.java
[INFO] Executed tasks

afterwards my Directory of $AXIS2_HOME\samples\jaxws-addressbook\target\cla= sses\org\apa
che\axis2\jaxws\addressbook contains

06/03/2009  01:16 PM        &n= bsp;      372 AddressBook.class
06/03/2009  01:16 PM        &n= bsp;    3,469 AddressBookClient.class
06/03/2009  01:16 PM        &n= bsp;    1,962 AddressBookEntry.class
06/03/2009  01:16 PM        &n= bsp;    1,873 AddressBookImpl.class
06/03/2009  01:16 PM        &n= bsp;    1,525 ObjectFactory.class

pom.xml contained within <execution>
            &nb= sp;          <id>gen-sou= rces</id>
            &nb= sp;           <phase&g= t;generate-sources</phase>
            &nb= sp;           <configu= ration>
            &nb= sp;            =    <tasks>
            &nb= sp;            =        <property name=3D"schema.outpu= t.base.dir" value=3D"target/schema"/>
            &nb= sp;            =        <property name=3D"schema.gener= ated.src.dir" value=3D"${schema.output.base.dir}/src"/>             &nb= sp;            =        <property name=3D"schema.gener= ated.classes.dir"
            &nb= sp;            =             &nb= sp;    value=3D"${schema.output.base.dir}/classes"= />
            &nb= sp;            =        <!-- make the dirs -->
            &nb= sp;            =        <mkdir dir=3D"${schema.output.= base.dir}"/>
            &nb= sp;            =        <mkdir dir=3D"${schema.generat= ed.src.dir}"/>
            &nb= sp;            =        <mkdir dir=3D"${schema.generat= ed.classes.dir}"/>
            &nb= sp;            =        <!-- Run JAXB schema compiler with = designated schemas -->
            &nb= sp;            =        <echo>Generating java from echo.= xsd</echo>
            &nb= sp;            =        <java classname=3D"com.sun.too= ls.xjc.Driver" fork=3D"true">
            &nb= sp;            =            <classpath = refid=3D"maven.runtime.classpath"/>
            &nb= sp;            =            <classpath = location=3D"${compiled.classes.dir}"/>
            &nb= sp;            =            <arg line= =3D"-d ${schema.generated.src.dir} src/AddressBookEntry.xsd"/>=
            &nb= sp;            =        </java>
            &nb= sp;            =    </tasks>
            &nb= sp;           </config= uration>
            &nb= sp;           <goals&g= t;
            &nb= sp;            =    <goal>run</goal>
            &nb= sp;           </goals&= gt;

//also if well at the pom.xml in modules/jaxbri we see the generate-test-so= urces phase will create required classes
            &nb= sp;       <execution>
            &nb= sp;           <id>g= en-ts</id>
            &nb= sp;           <phase&g= t;generate-test-sources</phase>
            &nb= sp;           <configu= ration>
            &nb= sp;            =    <tasks>
            &nb= sp;            =        <property name=3D"axis2.home&q= uot; value=3D"${basedir}/target"/>
            &nb= sp;            =        <property name=3D"maven.class.= path" refid=3D"maven.runtime.classpath"/>
            &nb= sp;            =        <!-- Theres got to be a better way = to do this -->
            &nb= sp;            =        <property name=3D"schema.sourc= e.dir" value=3D"test-resources/xsd"/>
            &nb= sp;            =        <property name=3D"wsdl.source.= dir" value=3D"test-resources/wsdl"/>
            &nb= sp;            =        <property name=3D"schema.outpu= t.base.dir" value=3D"target/schema"/>
            &nb= sp;            =        <property name=3D"schema.gener= ated.src.dir" value=3D"${schema.output.base.dir}/src"/>             &nb= sp;            =        <property name=3D"schema.gener= ated.classes.dir"
            &nb= sp;            =             &nb= sp;    value=3D"${schema.output.base.dir}/classes"= />
            &nb= sp;            =        <!-- make the dirs -->
            &nb= sp;            =        <mkdir dir=3D"${schema.output.= base.dir}"/>
            &nb= sp;            =        <mkdir dir=3D"${schema.generat= ed.src.dir}"/>
            &nb= sp;            =        <mkdir dir=3D"${schema.generat= ed.classes.dir}"/>
            &nb= sp;            =        <!-- Run JAXB schema compiler with = designated schemas -->
            &nb= sp;            =        <echo>Generating JAX-B classes f= or DocLitBareService test</echo>
            &nb= sp;            =        <java classname=3D"com.sun.too= ls.xjc.Driver" fork=3D"true">
            &nb= sp;            =            <classpath = refid=3D"maven.runtime.classpath"/>
            &nb= sp;            =            <classpath = location=3D"${compiled.classes.dir}"/>
            &nb= sp;            =            <arg line= =3D"-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/Doc= LitBareService.wsdl"/>
            &nb= sp;            =        </java>
..........
            &nb= sp;            =        <ant dir=3D"target/wsdl/Test01= "/>
            &nb= sp;            =    </tasks>
            &nb= sp;           </config= uration>
            &nb= sp;           <goals&g= t;
            &nb= sp;            =    <goal>run</goal>
            &nb= sp;           </goals&= gt;
            &nb= sp;       </execution>

F:\AXIS\axis2-1.4\modules\jaxbri>mvn -e generate-test-sources
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] --------------------------------------------------------------------= ----
[INFO] Building Apache Axis2 - JAXB-RI Data Binding
[INFO]    task-segment: [generate-test-sources]
[INFO] --------------------------------------------------------------------= ----
[INFO] artifact org.codehaus.mojo:build-helper-maven-plugin: checking for u= pdate
s from ws-zones
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resour= ces,
i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] skip non existing resourceDirectory F:\AXIS\axis2-1.4\modules\jaxbri= \conf

[INFO] Copying 1 resource
[INFO] [compiler:compile]
[INFO] Compiling 3 source files to F:\AXIS\axis2-1.4\modules\jaxbri\target\= class
es
[INFO] [antrun:run {execution: gen-ts}]
[INFO] Executing tasks
    [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\ta= rget\schema
    [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\ta= rget\schema\src
    [mkdir] Created dir: F:\AXIS\axis2-1.4\modules\jaxbri\ta= rget\schema\classes
     [echo] Generating JAX-B classes for DocLitBareServ= ice test
     [echo] Generating Service / Service Client for Tes= t01 test
     [java] Retrieving document at 'test-resources/wsdl= /Test01.wsdl'.

//proof that sources were generated in the correct folder
 Directory of F:\AXIS\axis2-1.4\modules\jaxbri\target\wsdl\Test01\src\= com\foo\xm
lns\axis2\test01

06/03/2009  01:28 PM        &n= bsp;    1,720 Add.java
06/03/2009  01:28 PM        &n= bsp;    1,669 ObjectFactory.java
06/03/2009  01:28 PM        &n= bsp;      192 package-info.java

//command line tool used to create these class is called wsimport here is t= he doc
     You can use the JAX-WS tool, wsimport, to process = a
      WSDL file and generate portable Java artifac= ts that are used
      to create a Web service. The portable Java a= rtifacts created
      using the wsimport tool are:

        Service endpoint interface (SEI)=

        Service class

        Exception class that is mapped f= rom the
        <code>wsdl:fault</code&= gt; class (if any)

        Java Architecture for XML Bindin= g (JAXB) generated type
        values which are Java classes ma= pped from XML schema
        types

Run the wsimport -keep -verbose wsdl_URL
command to generate the portable artifacts. The
-keep option tells the tool not to delete the generated files, and the
-verbose option tells it to list the files that were created.
The ObjectFactory.java file that is created contains factory methods for ea= ch Java content interface
and Java element interface generated in the associated package. The
package-info.java file takes the targetNamespace value
and creates the directory structure.

http://java.sun.com/javase/6/docs/technotes/tools/share/wsimport.html

conclusion:execute maven task which calls generate-test-sources and generat= es classes from com.sun.tools.xjc.Driver

after that you would only need to compile with javac
build your service aar
then deploy to axis2

HTH
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9

 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterle= itung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient led= iglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Mani= pulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt ueberne= hmen.

Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=
=EAtes pas le destinataire pr=E9vu, nous te demandons avec bont=E9 que pour=
 satisfaire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=
=E9e ou la copie de ceci est interdite. Ce message sert =E0 l'information s=
eulement et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9ta=
nt donn=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulati=
on, nous ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni=
.






From: gavin.ellis@m= fuse.com
To: axis-user@ws.apache.org
Date: Wed, 3 Jun 2009 17:33:09 +0100
Subject: RE: JAXBException..... doesn't contain ObjectFactory.class or jaxb= .index

As I understand it the jaxb.index file is not relevant in th= is scenario, or at least doesn’t exist in the standalone version that= works. So in this case, is the problem when trying to load ObjectFactory.class caused by a similar= issue?

 

Gavin El= lis

 

From: Martin Gainty [mail= to:mgainty@hotmail.com]
Sent: 03 June 2009 17:03
To: Gavin Ellis
Subject: RE: JAXBException..... doesn't contain ObjectFactory.class = or jaxb.index

 

--a definite bug

The javadoc for JAXBContext.newInstance(String,ClassLoader) needs to more c= learly specify the expected format of the class names listed in "jaxb.= index".

Right now, the RI is expecting classnames of the form: "ClassName.clas= s"

The attached test case is failing because the index file contains: "fu= lly.qualified.ClassName"

also

"modify the RI to work for "ClassName" rather than "Cla= ssName.class"



specifying classname without package. prefix or .class suffix is the fix

http://bugs.sun.com/bugdatabase/view_bu= g.do?bug_id=3D6314008

so it seems the workaround is to use "ClassName.class" and not Pa= ckageName.ClassName.class
(patch was supposed to be applied in JAXB 2)

does this help?
Martin Gainty
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9

 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterle= itung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient led= iglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Mani= pulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt ueberne= hmen.

Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=
=EAtes pas le destinataire pr=E9vu, nous te demandons avec bont=E9 que pour=
 satisfaire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=
=E9e ou la copie de ceci est interdite. Ce message sert =E0 l'information s=
eulement et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9ta=
nt donn=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulati=
on, nous ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni=
.





From: gavin.ellis@m= fuse.com
To: axis-user@ws.apache.org
Date: Wed, 3 Jun 2009 15:41:59 +0100
Subject: JAXBException..... doesn't contain ObjectFactory.class or jaxb.ind= ex

I’m currently experiencing an iss= ue when trying to initialise a jaxb context inside a jar dependency inside = an axis aar module i.e.

 

axis.war\WEB-INF\services\myService.aar= !\lib\myDependency.jar!\com.mycompany.MyClass.class

 

I have tested this lib standalone and e= verything works fine, the jaxb context is initialised as expected. However = when it is referenced inside an aar module inside axis, then the following exception is thrown:

 

javax.xml.bind.JAXBException: "com= .mfuse.novo.transactions.adapter.orbis.oxi.generated" doesnt contain O= bjectFactory.class or jaxb.index

      &nb= sp;         at com.sun.xml.bind.v2.= ContextFactory.createContext(ContextFactory.java:183)

      &nb= sp;         at sun.reflect.NativeMe= thodAccessorImpl.invoke0(Native Method)

      &nb= sp;         at sun.reflect.NativeMe= thodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)=

      &nb= sp;         at sun.reflect.Delegati= ngMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      &nb= sp;         at java.lang.reflect.Me= thod.invoke(Method.java:597)

      &nb= sp;         at javax.xml.bind.Conte= xtFinder.newInstance(ContextFinder.java:128)

      &nb= sp;         at javax.xml.bind.Conte= xtFinder.find(ContextFinder.java:277)

      &nb= sp;         at javax.xml.bind.JAXBC= ontext.newInstance(JAXBContext.java:372)

      &nb= sp;         at javax.xml.bind.JAXBC= ontext.newInstance(JAXBContext.java:337)

      &nb= sp;         at javax.xml.bind.JAXBC= ontext.newInstance(JAXBContext.java:244)

      &nb= sp;         at com.mfuse.novo.adapt= ers.connections.jaxb.JaxbConnectionImpl.initMarshaller(JaxbConnectionImpl.j= ava:70)

      &nb= sp;         ... 34 more<= /span>

 

I have debugged into the code and attem= pted to load ObjectFactory manually and it appears to be on the classpath. = I’ve also inspected the package inside the jar and it contains ObjectFactory.class.

 

I noticed that axis WEB-INF/lib already= contains an earlier version of jaxb, which I thought might possibly be cau= sing a conflict here so tried swapping these out for the ones that I used in the lib, but this made no difference.

 

Has anyone else experienced a similar i= ssue?

 

Regards,

 

Gavin El= lis

 

 

 

 


The inform= ation contained in this message is confidential and is intended for the add= ressee only. Any unauthorised dissemination or copying or use or disclosure of information contained herein is strictly p= rohibited and may be illegal. If you are not the named or intended recipien= t please notify us immediately by telephone (+44 207 154 2070) or retur= n e-mail. We have installed active virus software but do not accept liability or responsibility for the security or= reliability of transmission or for any virus transmitted; as such you shou= ld carry out your own virus checks before opening any attachment.
Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN


Windows Live™ SkyDrive™: Ge= t 25 GB of free online storage. Get it on your BlackBerry or iPhone.

 


The inform= ation contained in this message is confidential and is intended for the add= ressee only. Any unauthorised dissemination or copying or use or disclosure of information contained herein is strictly p= rohibited and may be illegal. If you are not the named or intended recipien= t please notify us immediately by telephone (+44 207 154 2070) or retur= n e-mail. We have installed active virus software but do not accept liability or responsibility for the security or= reliability of transmission or for any virus transmitted; as such you shou= ld carry out your own virus checks before opening any attachment.
Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN


Insert movie times and more without lea= ving Hotmail=AE. See how.



The information contained in= this message is confidential and is intended for the addressee only. Any u= nauthorised dissemination or copying or use or disclosure of information co= ntained herein is strictly prohibited and may be illegal. If you are not the named or intended recipient please = notify us immediately by telephone (+44 207 154 2070) or return e-mail.= We have installed active virus software but do not accept liability or res= ponsibility for the security or reliability of transmission or for any virus transmitted; as such you should carry out= your own virus checks before opening any attachment.
Mfuse Limited registered in England and Wales, company number 04468412. Reg= istered Office: 3rd Floor, Mitre House, 177 Regent Street, London W1B 4JN
--_000_0148C484084C7E498FDE04F7F20361DA16BF4F8290MHLEXB02mfuse_--