Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jetty fails to launch with a linkage error #27

Closed
GoogleCodeExporter opened this issue Jul 7, 2015 · 23 comments
Closed

jetty fails to launch with a linkage error #27

GoogleCodeExporter opened this issue Jul 7, 2015 · 23 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a minimal web application with spring using maven for dependency
management.  Include MX4j and MX4j-tools in the dependency list.  Also
include spring-webmvc as a dependency.
2. Declare an mbean server bean in the application context with the class
org.springframework.jmx.support.MBeanServerFactoryBean.  
3. Launch the application.

What is the expected output? What do you see instead?
Application should launch normally.  Instead during initialization of the
spring context you get an exception as follows:
java.lang.LinkageError: loader constraint violation: when resolving method
"java.lang.management.ManagementFactory.getPlatformMBeanServer()Ljavax/managemen
t/MBeanServer;"
the class loader (instance of runjettyrun/ProjectClassLoader) of the
current class, org/springframework/jmx/support/JmxUtils, and the class
loader (instance of <bootloader>) for resolved class,
java/lang/management/ManagementFactory, have different Class objects for
the type javax/management/MBeanServer used in the signature

Removing the dependency on Mx4j OR removing the declaration of the mbean
server removes the error condition, but neither is a suitable solution for
my project.


What version of the product are you using? On what operating system?
Occurs on Run Jetty Run 1.1.0.  Does NOT occur on 1.0.1.  

Please provide any additional information below.
Attached is a minimal test project.  This project was run in eclipse using
m2eclipse for dependency management and run jetty run 1.1.0 for the servlet
container.

Original issue reported on code.google.com by jheric...@gmail.com on 5 May 2009 at 11:03

Attachments:

@GoogleCodeExporter
Copy link
Author

Thanks for the report.

Could you make my life easier by attaching a zip or tar file?  Thanks.

Original comment by James.Sy...@gmail.com on 5 May 2009 at 11:23

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

attachment as a zip

Original comment by jheric...@gmail.com on 5 May 2009 at 11:34

Attachments:

@GoogleCodeExporter
Copy link
Author

Thanks

Original comment by James.Sy...@gmail.com on 6 May 2009 at 1:30

@GoogleCodeExporter
Copy link
Author

Original comment by James.Sy...@gmail.com on 6 May 2009 at 11:00

  • Added labels: Priority-High
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Disregard this bug.  Apparently using the MX4J library (not the MX4J-Tools 
library)
in Java 5 is the cause of this.  MX4J is an implementation of JMX and is 
suitable for
adding JMX to JDK 1.4 and earlier, but is not needed on JDK 5 and its inclusion 
can
cause problems like this.  Removing this library specifically removes the error 
and
allows full functionality.  I still am not quite sure why this broke between 
1.1.0
and 1.0.1, but I suspect its some obscure class loading order issue that isn't 
really
a defect.

Original comment by jheric...@gmail.com on 6 May 2009 at 7:01

@GoogleCodeExporter
Copy link
Author

Thanks for the update.

Original comment by James.Sy...@gmail.com on 7 May 2009 at 12:03

  • Changed state: Invalid

@GoogleCodeExporter
Copy link
Author

I opened another issue, because i didnt search in all status. 

I am not using mx4j library in the app but having the same problem. The project 
is
run with java-6. I attached the full stack in issue 28.

Original comment by phoetm...@googlemail.com on 7 May 2009 at 2:51

@GoogleCodeExporter
Copy link
Author

OK, I'm re-opening this bug.  I have some guesses as to the cause, and will 
investigate.

Original comment by James.Sy...@gmail.com on 7 May 2009 at 3:07

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Pheotmail, can you detail the full list of dependencies in your classpath?  
From what
I've read this problem can also be caused by ANY other JMX implementations in 
the
classpath.  

Original comment by jheric...@gmail.com on 7 May 2009 at 5:14

@GoogleCodeExporter
Copy link
Author

@9 the dependencies can be seen in the attachement of issue 28. there is a 
bunch of
dependencies especially from spring, hibernate and cxf-webservice. i dont know 
if
there is a jmx implementation included.

Original comment by phoetm...@googlemail.com on 7 May 2009 at 5:27

@GoogleCodeExporter
Copy link
Author

Phoetmail, is there an option on the version of java you're using to dump out 
the 
class loading events (java -verbose:class is available from the Sun and IBM 
JREs)?  
If so, this might add some useful info about the LinkageError.

Original comment by James.Sy...@gmail.com on 8 May 2009 at 11:49

@GoogleCodeExporter
Copy link
Author

FYI, Jetty defaults to overriding the normal J2SE class loader delegation model 
(which calls for delegating to the parent).  You might try setting:

   -Dorg.mortbay.jetty.webapp.parentLoaderPriority=true

in the VM args, and report back how that impacted things.

Original comment by James.Sy...@gmail.com on 8 May 2009 at 11:58

@GoogleCodeExporter
Copy link
Author

I will try the system-property and report back. But i think that it will not be
before next week.

Original comment by phoetm...@googlemail.com on 8 May 2009 at 12:07

@GoogleCodeExporter
Copy link
Author

Jetty 6.1.6 defines the following prefixes for system classes (classes that a 
web app can't 
override/replace):

    java.
    javax.servlet.
    javax.xml.
    org.mortbay.
    org.xml.
    org.w3c.
    org.apache.commons.logging.
    org.apache.log4j.

Notice this doesn't include javax.management.
My inclination is to guess this is the source of the problem reported here.

Fortunately, this is a settable value (in code).  So, if we can determine that 
this is the problem, it'll 
be pretty easy to add it to the list.  Alternately, I could add javax. as a 
system classes prefix.


Original comment by James.Sy...@gmail.com on 9 May 2009 at 7:07

@GoogleCodeExporter
Copy link
Author

Response to Comment 12: 

   -Dorg.mortbay.jetty.webapp.parentLoaderPriority=true

It works! With this VM arg jetty runs again.
Thanks.

Original comment by stefan.f...@gmail.com on 11 May 2009 at 9:26

@GoogleCodeExporter
Copy link
Author

@15 Stefan, what class was failing to load for you?

Original comment by James.Sy...@gmail.com on 11 May 2009 at 11:45

@GoogleCodeExporter
Copy link
Author

Please fix this bug on 6.1 and 7 plugins, this is really blocking as soon as we 
use
java6 !!!

Original comment by bouiaw on 16 Dec 2009 at 1:56

@GoogleCodeExporter
Copy link
Author

Issue 28 has been merged into this issue.

Original comment by James.Sy...@gmail.com on 3 Jan 2010 at 4:39

@GoogleCodeExporter
Copy link
Author

   -Dorg.mortbay.jetty.webapp.parentLoaderPriority=true
Also worked for me. 

Thanks :)

Original comment by jacqu...@gmail.com on 17 Nov 2010 at 6:10

@GoogleCodeExporter
Copy link
Author

Issue 34 has been merged into this issue.

Original comment by tonylovejava on 11 Mar 2011 at 8:41

@GoogleCodeExporter
Copy link
Author

Plan to make it more clear in 1.2 

Original comment by tonylovejava on 11 Mar 2011 at 9:15

  • Added labels: 1.2

@GoogleCodeExporter
Copy link
Author

Ready since 2011/3/16 , committed in r88 .

I add a option and provide a help link for this config in RJR Run Configuration.
will in version 1.2.1 


Original comment by tonylovejava on 20 Mar 2011 at 5:50

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true

worked for me.

Big thanks

Original comment by arnaud.m...@gmail.com on 17 Mar 2015 at 5:38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant