Thursday, November 13, 2008

I'm installing Liferay 5.1.2, bundled with Jetty Servlet Container (Lightweight application server, you might say), in a Windows XP laptop. Unfortunately these errors showed up:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mbeanServer' defined in class path resource [META-INF/management-spring.xml]: Invocation of init method failed; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "java.lang.management.ManagementFactory.getPlatformMBeanServer()Ljavax/management/MBeanServer;" the class loader (instance of org/mortbay/http/ContextLoader) of the current class, org/springframework/jmx/support/JmxUtils, and the class loader (instance of ) for resolved class, java/lang/management/ManagementFactory, have different Class objects for the type javax/management/MBeanServer used in the signature
....
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "java.lang.management.ManagementFactory.getPlatformMBeanServer()Ljavax/management/MBeanServer;" the class loader (instance of org/mortbay/http/ContextLoader) of the current class, org/springframework/jmx/support/JmxUtils, and the class loader (instance of ) for resolved class, java/lang/management/ManagementFactory, have different Class objects for the type javax/management/MBeanServer used in the signature


I resolve this by removing mx4j.jar in \liferay-portal-jetty-5.1.2\webapps\root\WEB-INF\lib. Seems that the problem is similar to the problem in this post. The case is that the Java 6's JRE already contains javax.management.MBeanServer interface class, and conflicts with mx4j.jar which are supplied for those who still use elder JRE/JDK which doesn't contain the MBeanServer interface class.