You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Arulazi Dhesiaseelan <ar...@gmail.com> on 2009/04/08 07:12:22 UTC

issues with running dynamic client tests using mvn surefire plugin

I am getting the following exception when running a simple CXF 2.1.4 dynamic
client test using maven surefire plugin. The strange thing is, this test
works fine if I run it standalone.

Any clues why this fails when run using surefire?

    public void testWsdl2Java() throws Exception {
        JaxWsDynamicClientFactory dcf =
JaxWsDynamicClientFactory.newInstance();
        Client client = dcf.createClient("
http://localhost:8080/axis2/services/Version?wsdl");
        Object[] res = client.invoke("getVersion");
        Object versionResponse =
Thread.currentThread().getContextClassLoader().loadClass("sample.axisversion.GetVersionResponse").newInstance();
        Method m = versionResponse.getClass().getMethod("getReturn");
        Object out = m.invoke(res[0]);
        Method m2 = out.getClass().getMethod("getValue");
        String versionStringSoap = (String) m2.invoke(out);
        System.out.println("Version : " + versionStringSoap);
    }

java.lang.IllegalStateException: Unable to create JAXBContext for generated
packages: "sample.axisversion" doesnt contain ObjectFactory.class or
jaxb.index
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:352)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:196)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:189)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:144)
at
fluxtest.functional.webservices.DynamicClientFactoryTest.testWsdl2Java(DynamicClientFactoryTest.java:12)
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 junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: javax.xml.bind.JAXBException: "sample.axisversion" doesnt contain
ObjectFactory.class or jaxb.index
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183)
at sun.reflect.GeneratedMethodAccessor367.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:349)
... 27 more

------- Stderr: -------
[ERROR] IOException during exec() of compiler "javac". Check your path
environment variable.

Appreciate any insight into this problem.

Thank you,
Arul

Re: issues with running dynamic client tests using mvn surefire plugin

Posted by Arulazi Dhesiaseelan <ar...@gmail.com>.
I just noticed this happens only when the tests are run from our build
server (Teamcity). Still trying to figure out the root cause. I will keep
you posted on what I find.
Thanks,-Arul

On Wed, Apr 8, 2009 at 3:01 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> Any chance you could package this up into a small maven based testcase and
> attach it to a jira?   That would definitely help trying to reproduce and
> diagnose it.   We have a couple DynamicFactory test cases in our code that
> obviously are maven based and running in surefire, so it SHOULD work.
> Haveing a testcase that shows the issue would be a big help.
>
> Dan
> - Show quoted text -
>
>
> On Wed April 8 2009 1:12:22 am Arulazi Dhesiaseelan wrote:
> > I am getting the following exception when running a simple CXF 2.1.4
> > dynamic client test using maven surefire plugin. The strange thing is,
> this
> > test works fine if I run it standalone.
> >
> > Any clues why this fails when run using surefire?
> >
> >     public void testWsdl2Java() throws Exception {
> >         JaxWsDynamicClientFactory dcf =
> > JaxWsDynamicClientFactory.newInstance();
> >         Client client = dcf.createClient("
> > http://localhost:8080/axis2/services/Version?wsdl");
> >         Object[] res = client.invoke("getVersion");
> >         Object versionResponse =
> >
> Thread.currentThread().getContextClassLoader().loadClass("sample.axisversio
> >n.GetVersionResponse").newInstance(); Method m =
> > versionResponse.getClass().getMethod("getReturn"); Object out =
> > m.invoke(res[0]);
> >         Method m2 = out.getClass().getMethod("getValue");
> >         String versionStringSoap = (String) m2.invoke(out);
> >         System.out.println("Version : " + versionStringSoap);
> >     }
> >
> > java.lang.IllegalStateException: Unable to create JAXBContext for
> generated
> > packages: "sample.axisversion" doesnt contain ObjectFactory.class or
> > jaxb.index
> > at
> >
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
> >ientFactory.java:352) at
> >
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
> >ientFactory.java:196) at
> >
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
> >ientFactory.java:189) at
> >
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
> >ientFactory.java:144) at
> >
> fluxtest.functional.webservices.DynamicClientFactoryTest.testWsdl2Java(Dyna
> >micClientFactoryTest.java:12) at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
> >9) at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > at junit.framework.TestCase.runTest(TestCase.java:168)
> > at junit.framework.TestCase.runBare(TestCase.java:134)
> > at junit.framework.TestResult$1.protect(TestResult.java:110)
> > at junit.framework.TestResult.runProtected(TestResult.java:128)
> > at junit.framework.TestResult.run(TestResult.java:113)
> > at junit.framework.TestCase.run(TestCase.java:124)
> > at junit.framework.TestSuite.runTest(TestSuite.java:232)
> > at junit.framework.TestSuite.run(TestSuite.java:227)
> > at
> >
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:8
> >1) at
> >
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:6
> >2) at
> >
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(A
> >bstractDirectoryTestSuite.java:140) at
> >
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstract
> >DirectoryTestSuite.java:127) at
> > org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
> >9) at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > at
> >
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Surefire
> >Booter.java:345) at
> >
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:10
> >09) Caused by: javax.xml.bind.JAXBException: "sample.axisversion" doesnt
> - Show quoted text -
> > contain ObjectFactory.class or jaxb.index
> > at
> > com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183)
> > at sun.reflect.GeneratedMethodAccessor367.invoke(Unknown Source)
> > at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
> >l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> > at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
> > at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
> > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
> > at
> >
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
> >ientFactory.java:349) ... 27 more
> >
> > ------- Stderr: -------
> > [ERROR] IOException during exec() of compiler "javac". Check your path
> > environment variable.
> >
> > Appreciate any insight into this problem.
> >
> > Thank you,
> > Arul
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>



-- 
http://aruld.info

Re: issues with running dynamic client tests using mvn surefire plugin

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you could package this up into a small maven based testcase and 
attach it to a jira?   That would definitely help trying to reproduce and 
diagnose it.   We have a couple DynamicFactory test cases in our code that 
obviously are maven based and running in surefire, so it SHOULD work.   
Haveing a testcase that shows the issue would be a big help.

Dan


On Wed April 8 2009 1:12:22 am Arulazi Dhesiaseelan wrote:
> I am getting the following exception when running a simple CXF 2.1.4
> dynamic client test using maven surefire plugin. The strange thing is, this
> test works fine if I run it standalone.
>
> Any clues why this fails when run using surefire?
>
>     public void testWsdl2Java() throws Exception {
>         JaxWsDynamicClientFactory dcf =
> JaxWsDynamicClientFactory.newInstance();
>         Client client = dcf.createClient("
> http://localhost:8080/axis2/services/Version?wsdl");
>         Object[] res = client.invoke("getVersion");
>         Object versionResponse =
> Thread.currentThread().getContextClassLoader().loadClass("sample.axisversio
>n.GetVersionResponse").newInstance(); Method m =
> versionResponse.getClass().getMethod("getReturn"); Object out =
> m.invoke(res[0]);
>         Method m2 = out.getClass().getMethod("getValue");
>         String versionStringSoap = (String) m2.invoke(out);
>         System.out.println("Version : " + versionStringSoap);
>     }
>
> java.lang.IllegalStateException: Unable to create JAXBContext for generated
> packages: "sample.axisversion" doesnt contain ObjectFactory.class or
> jaxb.index
> at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
>ientFactory.java:352) at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
>ientFactory.java:196) at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
>ientFactory.java:189) at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
>ientFactory.java:144) at
> fluxtest.functional.webservices.DynamicClientFactoryTest.testWsdl2Java(Dyna
>micClientFactoryTest.java:12) at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:168)
> at junit.framework.TestCase.runBare(TestCase.java:134)
> at junit.framework.TestResult$1.protect(TestResult.java:110)
> at junit.framework.TestResult.runProtected(TestResult.java:128)
> at junit.framework.TestResult.run(TestResult.java:113)
> at junit.framework.TestCase.run(TestCase.java:124)
> at junit.framework.TestSuite.runTest(TestSuite.java:232)
> at junit.framework.TestSuite.run(TestSuite.java:227)
> at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:8
>1) at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:6
>2) at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(A
>bstractDirectoryTestSuite.java:140) at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstract
>DirectoryTestSuite.java:127) at
> org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Surefire
>Booter.java:345) at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:10
>09) Caused by: javax.xml.bind.JAXBException: "sample.axisversion" doesnt
> contain ObjectFactory.class or jaxb.index
> at
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183)
> at sun.reflect.GeneratedMethodAccessor367.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:133)
> at javax.xml.bind.ContextFinder.find(ContextFinder.java:286)
> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
> at
> org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicCl
>ientFactory.java:349) ... 27 more
>
> ------- Stderr: -------
> [ERROR] IOException during exec() of compiler "javac". Check your path
> environment variable.
>
> Appreciate any insight into this problem.
>
> Thank you,
> Arul

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog