users@jersey.java.net

Re: [Jersey] Problems with test framework

From: Naresh <Srinivas.Bhimisetty_at_Sun.COM>
Date: Thu, 20 Aug 2009 15:54:52 +0530

Paul Sandoz wrote:
>
> On Aug 20, 2009, at 11:56 AM, Naresh wrote:
>
>> Hi,
>>
>> bea wrote:
>>> Hi,
>>>
>>> Thanks for the answer to both.
>>>
>>>
>>> Answering to Naresh, I've tried out with maven 2.0.9 and I'm still
>>> getting an error.
>>> Using maven 2.2.1, with the default container selected, Grizzly, the
>>> only thing I get is:
>>>
>>> 20-ago-2009 10:18:25 com.sun.grizzly.http.servlet.ServletContextImpl
>>> initListeners
>>> WARNING: Unable to load listener: null
>> Are you using the ".setContextListenerClassName(...)' of the
>> ApplicationDescriptor instance?
>> If so, are you sure that class is in your class path?
>
>
> I see "null" when i test the helloworld-webapp:
Oh...
That was a mistake. Some validation is missing for the context-listener
class name.
lt is fixed in the latest SNAPSHOT build though (but there are some API
changes).

-Naresh
>
> # mvn clean test -Dcontainer.type=GrizzlyWeb -DenableLogging
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Helloworld WebApp - Jersey Sample
> [INFO] task-segment: [clean, test]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] [clean:clean]
> [INFO] Deleting directory
> /Users/paulsandoz/Projects/jersey/tags/jersey-1.1.1-ea/jersey/samples/helloworld-webapp/target
>
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:compile]
> [INFO] Compiling 1 source file to
> /Users/paulsandoz/Projects/jersey/tags/jersey-1.1.1-ea/jersey/samples/helloworld-webapp/target/classes
>
> [INFO] [resources:testResources]
> [INFO] Using default encoding to copy filtered resources.
> [INFO] [compiler:testCompile]
> [INFO] Compiling 1 source file to
> /Users/paulsandoz/Projects/jersey/tags/jersey-1.1.1-ea/jersey/samples/helloworld-webapp/target/test-classes
>
> [INFO] [surefire:test]
> [INFO] Surefire report directory:
> /Users/paulsandoz/Projects/jersey/tags/jersey-1.1.1-ea/jersey/samples/helloworld-webapp/target/surefire-reports
>
>
> -------------------------------------------------------
> T E S T S
> -------------------------------------------------------
> Running com.sun.jersey.samples.helloworld.HelloWorldWebAppTest
> Aug 20, 2009 12:10:46 PM
> com.sun.jersey.test.framework.impl.container.grizzly.web.GrizzlyWebContainer
> start
> INFO: Starting grizzly...
> Aug 20, 2009 12:10:47 PM
> com.sun.grizzly.http.servlet.ServletContextImpl initListeners
> WARNING: Unable to load listener: null
> 1 * Out-bound request
> 1 > GET http://localhost:9998/helloworld-webapp/helloworld
> 1 >
>
> Paul.
>
>> The possible issue that I think might be causing this is - you might
>> be specifying a context-listener class, and may be that class is not
>> found on the classpath.
>>
>> -Naresh
>>>
>>> I have the packages, so I have no idea what happens.
>>> Is it possible to run my jersey tests against Grizzly?
>>>
>>>
>>>
>>> Answerin to Paul, yesterday, when I got those traces I had an
>>> incorrect version of jersey-test-framework, but jersey-core and
>>> jersey-server were in the same version: 1.1.1. Now I've tha same
>>> version for the jersey packages. Sorry about my message because I
>>> was wrong.
>>>
>>>
>>> Thanks again,
>>> bests regards
>>>
>>>
>>>
>>>
>>>
>>> > Hi,
>>> >
>>> > The two stack traces you present are errors for instantiating some
>>> > internal Jersey components, the SAXParserContextProvider and >
>>> XMLRootElementProvider.
>>> >
>>> > The above errors can occur if you have two versions of Jersey in
>>> the > classpath. For example, if you have jersey-core version 1.1.1
>>> and > jersey-server 1.1.0.
>>> >
>>> > What are your dependencies?
>>> >
>>> > Paul.
>>> >
>>> >
>>> > What are you dependencies? do you have two versions of Jersey in
>>> the > classpath?
>>> >
>>> > On Aug 20, 2009, at 6:25 AM, Naresh wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> I have read somewhere that there are issues in Maven+Mac >>
>>> combinations where a property set using "-D" is not recognized. This
>>> >> might be related to the version of Maven, version of Mac OS or
>>> the >> version of Java itself.
>>> >>
>>> >> I do not have access to a Mac machine at the moment, will check
>>> it >> and let you know if it works for me. But I remember the
>>> property >> "container.type" being recognized with Maven 2.0.9 + JDK
>>> 1.6.0_13 + >> Mac 10.5.8 configuration. There was an issue with
>>> Maven 2.0.10 though.
>>> >>
>>> >> Thanks,
>>> >> Naresh
>>> >>
>>> >> bea wrote:
>>> >>> 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
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> <mailto:users-unsubscribe_at_jersey.dev.java.net>
>>> > For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>> <mailto:users-help_at_jersey.dev.java.net>
>>> >
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>