users@jersey.java.net

Problems with test framework

From: bea <beaotx_at_gmail.com>
Date: Wed, 19 Aug 2009 14:31:12 +0200

Hi,

I've been writing some tests using the jersey test framework and I'm not
able to make it work. I'm trying to execute them with maven specifying
EmbbededGF as the container.type, but I think that property isn't recognized
(If I set GrizzlyWeb I get the same error).

Executing mvn clean test -Dcontainer.type=EmbbededGF -DenableLogging I get
the following exceptions:


19-ago-2009 13:51:34
com.sun.jersey.test.framework.impl.container.grizzly.web.GrizzlyWebContainer
start
INFO: Starting grizzly...
19-ago-2009 13:51:35 com.sun.grizzly.http.servlet.ServletContextImpl
initListeners
ADVERTENCIA: Unable to load listener: null
19-ago-2009 13:51:35 com.sun.jersey.core.spi.component.ProviderFactory
__getComponentProvider
GRAVE: The provider class, class
com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider, could not be
instantiated. Processing will continue but the class will not be utilized
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at
com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:160)
    at
com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:140)
    at
com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:159)
    at
com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:130)
    at
com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:190)
    at
com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:139)
    at
com.sun.jersey.core.spi.factory.InjectableProviderFactory.configure(InjectableProviderFactory.java:98)
    at com.sun.jersey.api.client.Client.<init>(Client.java:178)
    at com.sun.jersey.api.client.Client.<init>(Client.java:128)
    at com.sun.jersey.api.client.Client.create(Client.java:406)
    at com.sun.jersey.test.framework.JerseyTest.setUp(JerseyTest.java:188)
    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:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    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:597)
    at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
    at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.lang.NullPointerException
    at
com.sun.jersey.core.impl.provider.xml.SAXParserContextProvider.<init>(SAXParserContextProvider.java:60)
    ... 42 more


19-ago-2009 14:04:13 com.sun.jersey.core.spi.component.ProviderFactory
__getComponentProvider
GRAVE: The provider class, class
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$Text, could
not be instantiated. Processing will continue but the class will not be
utilized
java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at
com.sun.jersey.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:160)
    at
com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:140)
    at
com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:159)
    at
com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:130)
    at
com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:190)
    at
com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:120)
    at
com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:153)
    at
com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:145)
    at com.sun.jersey.api.client.Client.<init>(Client.java:219)
    at com.sun.jersey.api.client.Client.<init>(Client.java:128)
    at com.sun.jersey.api.client.Client.create(Client.java:406)
    at com.sun.jersey.test.framework.JerseyTest.setUp(JerseyTest.java:188)
    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:597)
    at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

.......

I've read all the thread from
http://n2.nabble.com/A-blog-entry-on-using-the-Jersey-Test-Framework-td2650615.html,
trying the different recomendations, but I don't get anything.

I'm using maven 2.2.1 (I've tried 2.0.9 too) and java 1.6.0_15 on mac osx
10.5.8

Do you know what could be the reason? If anyone needs more details I can
provide them.

Cheers