zhyh1105 / run-jetty-run

Automatically exported from code.google.com/p/run-jetty-run
0 stars 0 forks source link

Classpath/Classloader issues #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add Hibernate to Project
2. Add Custom ConfiguratbleWebApplicationContext (Spring) to project
3.

What is the expected output? What do you see instead?
For Hibernate:
The server should start normally, instead I get:

java.lang.IllegalArgumentException: Cannot convert value of type
[org.hibernate.impl.SessionFactoryImpl] to required type
[org.hibernate.SessionFactory] for property 'sessionFactory': no matching
editors or conversion strategy found

Where one is a direct subclass of the other. After some research I cannot
set a SessionFactory to a SessionFactory property in a bean either (ends up
with classcastexception).

For Spring:
The server should start normally, instead I get:

org.springframework.context.ApplicationContextException: Custom context
class [utils.spring.PerHostXmlWebApplicationContext] is not of type
[org.springframework.web.context.ConfigurableWebApplicationContext]

even though it is a direct subclass.

What version of the product are you using? On what operating system?
I am using version 1.0.1 on Windows XP with Eclipse 3.3.0

Please provide any additional information below.
If I copy all of the project into Jetty's webapp folder or a tomcat server
it works perfectly, also works with jettylauncher and jetty 5.x. Seems like
it is a classloader issue?

Original issue reported on code.google.com by soeren...@gmail.com on 23 Apr 2008 at 8:31

GoogleCodeExporter commented 9 years ago
I've actually found the reason for this ... I kept all my libraries in 
WEB-INF/lib,
this caused them to get loaded twice (by both runjettyrun and jetty I suppose).

A fix for this would be greatly appreciated :)

Original comment by soeren...@gmail.com on 24 Apr 2008 at 10:03

GoogleCodeExporter commented 9 years ago
+1

Original comment by m.zd...@gmail.com on 16 May 2008 at 7:58

GoogleCodeExporter commented 9 years ago
In the VM arguments of the launch config add:
-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true

Seemed to work for me.

Original comment by simonhar...@hotmail.com on 2 Dec 2008 at 10:50

GoogleCodeExporter commented 9 years ago
I was experiencing the exact same problem trying to run the HelloWorld example 
for
the Echo3 web framework.  It was giving me the following exception:

java.lang.ClassCastException: nextapp.echo.app.serial.property.IntegerPeer 
cannot be
cast to nextapp.echo.app.serial.SerialPropertyPeer

I also keep my all of .jar libraries for the project in its WEB-INF/lib folder 
as
soerensen describes above.

I thought it was an Echo3 issue, but running the HelloWorld on Tomcat worked 
great. 
It turns out that adding the 
-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true
line to the VM config (described by Simon above) fixes the problem.

So thanks a bunch for the fix!!  You rock.

Original comment by eldaa...@gmail.com on 15 Feb 2009 at 7:12

GoogleCodeExporter commented 9 years ago
I think this is a duplicate of issue 8:

http://code.google.com/p/run-jetty-run/issues/detail?id=8

Original comment by James.Sy...@gmail.com on 4 May 2009 at 12:55