Indeterminate ClassNotFound: BeansException
skyflyer Oct 27, 2015 9:28 AMHi!
I have a strange issue and I can't pinpoint the exact scenario, but redeploying usually triggers it. The background: Running jboss 7.1.1 on a Mac (or Windows) with Liferay installed. I have a Spring MVC portlet, which calls a web service (proxy generated using jax-ws's wsimport command).
The portlet includes the following jar files: aopalliance.jar, gson.jar, spring-aop.jar, spring-asm.jar, spring-beans.jar, spring-context-support.jar, spring-context.jar, spring-core.jar, spring-expression.jar, spring-jdbc.jar, spring-tx.jar, spring-web.jar, spring-webmvc-portlet.jar, spring-webmvc.jar
The portlet is deployed fine after a restart. When I redeploy it (copying the portelt war file to liferay/deploy, where it is picked up by JBoss AS), I usually (but not always) get an exception:
12:06:53,587 ERROR [org.springframework.web.portlet.DispatcherPortlet] (MSC service thread 1-1) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'podporaController': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/beans/BeansException. This exception is triggered by calling the webservice inside "@PostConstruct public void initializePortlet()" method.
Which is strange, since BeansException is contained in the spring-beans.jar file. The JBoss AS does NOT have spring module installed (that's why I'm including the jars here), but Liferay deployment does include its own spring jars. Interestingly enough, the liferay module does NOT include spring jars, so I have to include them in my portlet WAR file.
How would I go about troubleshooting the classloader or whatever in order to fix this issue?
Kind regards,
Miha.
PS: Additional trace that might give some clues to the advanced gurus here:
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @1d140071 (roots: /Users/miha/work/MIZS/liferay/jboss-7.1.1/modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
Edit: I've even disabled the org.apache.cxf module in jboss-deployment-structure.xml, but I'm still getting this error sometimes, although less frequently (??? seems like the twilight zone )