web app jar classloader issue

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

web app jar classloader issue

cruisercoder
I have a web app that is deployed under jetty 5.1.3 that uses a pair of jars for
a stax parser.  When the jar pair is present in the small container app that
embeds jetty, everything is fine, but when the container app doesn't have the
jars and I instead rely on having the jars in the WEB-INF/lib directory of the
deployed war file, I get this error :

java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException

The parser actually runs up to a point.  The problem appears to occur when one
jar in WEB-INF/lib tries to resolve a class contained in another jar in
WEB-INF/lib (although this may not be related)

Any ideas?

erik




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: web app jar classloader issue

Greg Wilkins-5

Erik,

this problem is almost certainly due to the class inversion problems in the
servlet spec.

You can try turning on java2compliant class loading or configure the
new class loading options in  5.1.3

Look in jetty-web.xml, demo.xml and jetty.xml   for examples.

I need to write a FAQ on this.... I will for the next release.

cheers


Erik Smith wrote:

> I have a web app that is deployed under jetty 5.1.3 that uses a pair of jars for
> a stax parser.  When the jar pair is present in the small container app that
> embeds jetty, everything is fine, but when the container app doesn't have the
> jars and I instead rely on having the jars in the WEB-INF/lib directory of the
> deployed war file, I get this error :
>
> java.lang.NoClassDefFoundError: javax/xml/stream/XMLStreamException
>
> The parser actually runs up to a point.  The problem appears to occur when one
> jar in WEB-INF/lib tries to resolve a class contained in another jar in
> WEB-INF/lib (although this may not be related)
>
> Any ideas?
>
> erik
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: web app jar classloader issue

cruisercoder

> You can try turning on java2compliant class loading or configure the
> new class loading options in  5.1.3
>
> Look in jetty-web.xml, demo.xml and jetty.xml   for examples.


I tried turning on classloading in jetty.xml as below but it didn't help -
although I'm unsure about whether the below lines actually affect classloading
in all contexts (the exammples apply to a specific deployment, not to the
"addWebApplications" Call which doesn't seem to have the equivalent)

  <Call name="addContext">
    <Arg>/</Arg>
    <Set name="classLoaderJava2Compliant">true</Set>
    ....


erik








-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: web app jar classloader issue

Greg Wilkins-5

Irik,

if you want to use addWebApplications, then you will need to do this
in a jetty-web.xml file in your webapps WEB-INF directory.

or you could just add the webapp individually with addWebApplication
and set the class loader option in jetty.xml as you have.

cheers


Erik Smith wrote:

>>You can try turning on java2compliant class loading or configure the
>>new class loading options in  5.1.3
>>
>>Look in jetty-web.xml, demo.xml and jetty.xml   for examples.
>
>
>
> I tried turning on classloading in jetty.xml as below but it didn't help -
> although I'm unsure about whether the below lines actually affect classloading
> in all contexts (the exammples apply to a specific deployment, not to the
> "addWebApplications" Call which doesn't seem to have the equivalent)
>
>   <Call name="addContext">
>     <Arg>/</Arg>
>     <Set name="classLoaderJava2Compliant">true</Set>
>     ....
>
>
> erik
>
>
>
>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
> a projector? How fast can you ride your desk chair down the office luge track?
> If you want to score the big prize, get to know the little guy.  
> Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: web app jar classloader issue

cruisercoder
I found the problem.   I had two jars: xstream.jar and stax.jar where xstream
depends on stax.   xstream was in both the container and the deployment, but
stax was only in the deployment.   Because of the java 2 class loading, java
found the xstream in the container first, but it then tried to use xstream's
classloader to load stax and then failed on the first stax class encountered.  
The situation mentioned most often is that you end up getting the wrong version
of jar, but in this case it failed to find classes entirely.

erik
 



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Off topic SimpleServer

Anastasios Angelidis
Hey, anyone know if there is any c/c++ Wincsock projects similar to the
SimpleServer beeing used in Jetty?

Thanks


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Off topic SimpleServer

Tony Seebregts
xitami from imatix is small and fast and nice ... not sure if you could call it
simple though.

regards

Tony Seebregts


> Hey, anyone know if there is any c/c++ Wincsock projects similar to the
> SimpleServer beeing used in Jetty?
>
> Thanks



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Off topic How does "Connection: Keep-Alive" work?

Anastasios Angelidis
Since some of you guys are "experts" in this...

To me Keep-Alive means that the server wont close the tcp/ip connection.
Meaning I should be able to send multiple HTTP request over the same
established connection right?

Now if that assumption is correct...

Can multiple request be sent at the same time or do they have to be sent
one after the other as each completes? Bassically can I use one
connection and use mutiple threads to send many requests at the same
time or will each thread have to wait until each request is done?

Is this server dependant or is it expected behaviour from all http
servers includding jetty?




-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Off topic How does "Connection: Keep-Alive" work?

Heiner Westphal
Anastasios,

the Keep-Alive relates to a single socket connection.
You cannot send multiple messages at the same time through
the same socket, unless you don't care if the server receives
chunks of all the message in unpredictable order :)

(Interesting approach for a DOS-Attack, isn't it? ;)

There are libraries available, that handle pools of connections
with keep-alive, which is probably what you need.

See e.g. http://jakarta.apache.org/commons/httpclient/
(that's what I use). Be sure to use the
MultiThreadedHttpConnectionManager and you leave a lot
of hassle behind, since you don't need to sync connections
yourself.

HTH,

Heiner

BTW. You better do a new post in favour of reply, if you want to
    discuss a new topic.
    My threaded newsreader shows your new (but unrelated) questions
    in the same thread as a request titled "web app jar classloader
    issue" from Erik Smith. This confuses me.


Anastasios Angelidis wrote:

> Since some of you guys are "experts" in this...
>
> To me Keep-Alive means that the server wont close the tcp/ip connection.
> Meaning I should be able to send multiple HTTP request over the same
> established connection right?
>
> Now if that assumption is correct...
>
> Can multiple request be sent at the same time or do they have to be sent
> one after the other as each completes? Bassically can I use one
> connection and use mutiple threads to send many requests at the same
> time or will each thread have to wait until each request is done?
>
> Is this server dependant or is it expected behaviour from all http
> servers includding jetty?
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar
> happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> core and dual graphics technology at this free one hour event hosted by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support
>



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Off topic How does "Connection: Keep-Alive" work?

Eric Rizzo
In reply to this post by Anastasios Angelidis
On 7/11/05, Anastasios Angelidis <[hidden email]> wrote:

> Since some of you guys are "experts" in this...
>
> To me Keep-Alive means that the server wont close the tcp/ip connection.
> Meaning I should be able to send multiple HTTP request over the same
> established connection right?
>
> Now if that assumption is correct...
>
> Can multiple request be sent at the same time or do they have to be sent
> one after the other as each completes? Bassically can I use one
> connection and use mutiple threads to send many requests at the same
> time or will each thread have to wait until each request is done?
>
> Is this server dependant or is it expected behaviour from all http
> servers includding jetty?

You may want to do some research into HTTP pipelining. You can Google
for the details, but the bottom line on pipelining is that a client
can send multiple requests on the same connection in "rapid-fire"
succession, without having to wait for the response of one request
before sending another request.
All 1.1 compliant servers must be able to handle pipelined requests
correctly by responding to each request in the same order in which
they arrived.

Google it - I'm sure you'll find lots of info.

HTH,
Eric


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. <a href="http://ads.osdn.com/?ad_idt77&alloc_id492&op=click">http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support