users@jersey.java.net

[Jersey] Re: Bizarre stack trace with jersey-client

From: Mark Petrovic <mspetrovic_at_gmail.com>
Date: Tue, 15 Mar 2011 15:23:48 -0700

Try placing the java ee dependency last in the list of dependencies if
you are using maven:

http://dominikdorn.com/2010/05/maven-junit-classformaterror-absent-code-attribute/

While I don't like having to strategically place dependencies in my
pom.xml, this 'fix' did work for me.


On Mon, Mar 14, 2011 at 10:30 AM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:
> you should use 3.0 (it is newer that 3.0-b66), or actually 3.1 is the most
> recent  stable one [1]
>
> Pavel
>
> [1]
> http://download.java.net/maven/glassfish/org/glassfish/javax.servlet/3.1/
>
>
> On 03/14/2011 01:46 PM, Gili wrote:
>>
>> Using
>>
>>
>>          org.glassfish
>>          javax.servlet
>>          3.0-b66
>>
>>
>> worked for me. Thank you!
>>
>> Gili
>>
>>
>> Pavel Bucek-2 wrote:
>>>
>>> On 03/13/2011 07:34 PM, Gili wrote:
>>>>
>>>> Under Netbeans 6.9.1 the IDE copies javaee-endorsed-api-6.0.jar into
>>>> target/endorsed and adds it into the classpath when running tests, in
>>>> spite
>>>> of the fact that the dependency is declared as "provided".
>>>>
>>>> I can't exclude this dependency because my code (not tests) extends
>>>> ServletContextListener which is defined by this JAR file.
>>>>
>>>> What am I supposed to do now?
>>>
>>> well, you can. I recommend remove this and introduce different one:
>>> "javax.servlet:servlet-api:2.5 (or glassfish 3.0, if you want). see [1],
>>> [2]).
>>>
>>> Let me know whether that helped.
>>>
>>> Regards,
>>> Pavel
>>>
>>> [1] http://repo2.maven.org/maven2/javax/servlet/servlet-api/2.5/
>>> [2]
>>> http://download.java.net/maven/glassfish/org/glassfish/javax.servlet/3.0/
>>>
>>>> Gili
>>>>
>>>>
>>>> Gili wrote:
>>>>>
>>>>> I am also getting the "java.lang.ClassFormatError" and my dependency on
>>>>> javaee-web-api is already set to "provided" scope. In fact, reading the
>>>>> email thread, Mewel already had his dependency set to "provided" as
>>>>> well.
>>>>> How did you solve this problem? What should I be doing?
>>>>>
>>>>> Thanks,
>>>>> Gili
>>>>>
>>>>>
>>>>> Paul Sandoz-2 wrote:
>>>>>>
>>>>>> On Jan 21, 2011, at 10:41 AM, Mewel wrote:
>>>>>>
>>>>>>> Thanks for your answer Paul.
>>>>>>>
>>>>>>> What testframework should i use to deal with servlet 3.0 and jersey?
>>>>>>>
>>>>>> Probably external test deployment to either GF or another compliant
>>>>>> Servlet 3 impl (dunno if Jetty or Tomcat 7 support Servlet 3).
>>>>>>
>>>>>>
>>>>>>> You say that the EE jar is only for compiling, but changing the
>>>>>>> scope to
>>>>>>> compile
>>>>>>> doens't change anything? Did i miss something here?
>>>>>>>
>>>>>> Use the "provided" scope, which means compile against this jar but do
>>>>>> not include in the war, because the jar is provided by the runtime.
>>>>>>
>>>>>> Paul.
>>>>>>
>>>> --
>>>> View this message in context:
>>>>
>>>> http://jersey.576304.n2.nabble.com/Bizarre-stack-trace-with-jersey-client-tp785445p6166842.html
>>>> Sent from the Jersey mailing list archive at Nabble.com.
>>>>
>>
>> --
>> View this message in context:
>> http://jersey.576304.n2.nabble.com/Bizarre-stack-trace-with-jersey-client-tp785445p6168907.html
>> Sent from the Jersey mailing list archive at Nabble.com.
>>
>
>



-- 
Mark