Topic
5 replies Latest Post - ‏2012-11-28T17:32:56Z by Jacek_Laskowski
SystemAdmin
SystemAdmin
590 Posts
ACCEPTED ANSWER

Pinned topic Liberty profile vs Maven generated JAXB package-info classes

‏2012-11-22T16:29:37Z |
Hello,

I'm currently porting an application from Tomcat to Liberty 8.5.0.1. The application is based on Spring 3.1.1 and Hibernate 4.1.2.

The application WARs are built with Maven and include some package-info classes which are generated by the Maven JAXB plugin. The generated files do not actually contain a class, just package information.

Liberty seems to be taking exception to these:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL : Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL : Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/webapp/mycomponent/ws/schema/package-info (wrong name: com/myapp/webapp/mycomponent/ws/schema/package-info)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1991)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:753)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5779)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:249)
at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:165)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:167)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:448)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:382)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:282)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:253)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:662)

The WARs are currently deployed in dropins.

Any suggestions gratefully received.
  • bkail
    bkail
    23 Posts
    ACCEPTED ANSWER

    Re: Liberty profile vs Maven generated JAXB package-info classes

    ‏2012-11-26T15:30:40Z  in response to SystemAdmin
    Based on the exception message, something has attempted a loadClass("WEB-INF.classes.com.myapp.webapp.mycomponent.ws.schema.package-info"), and the "WEB-INF.classes." prefix is wrong. Also from the exception message, it appears that there might be nested exceptions ("Caused by") that you didn't include in the stack trace. If you include the stack traces of the nested exceptions, perhaps someone can assist.
    • SystemAdmin
      SystemAdmin
      590 Posts
      ACCEPTED ANSWER

      Re: Liberty profile vs Maven generated JAXB package-info classes

      ‏2012-11-28T16:51:24Z  in response to bkail
      Hi, here's a full stack:

      11/28/12 15:46:40:297 GMT] 0000001a SystemOut                                                    O 11-28 15:46:40,291 Config-Thread-9 ERROR org.springframework.web.context.ContextLoader - Context initialization failed
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL : Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL : Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/mypackage/webapp/msac/ws/schema/package-info (wrong name: com/myapp/mypackage/webapp/msac/ws/schema/package-info)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
              at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:728)
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:449)
              at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
              at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1991)
              at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:753)
              at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5779)
              at com.ibm.ws.webcontainer.osgi.webapp.WebGroup.addWebApplication(WebGroup.java:84)
              at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.addWebApplication(DynamicVirtualHost.java:156)
              at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:571)
              at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:521)
              at com.ibm.ws.webcontainer.osgi.WebContainer.addWebContainerApplication(WebContainer.java:652)
              at com.ibm.ws.app.manager.war.internal.WARApplicationHandler.install(WARApplicationHandler.java:142)
              at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:144)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:358)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:247)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine$StateChangeCallback.processChange(ApplicationStateMachine.java:137)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine$StateChangeCallback.changed(ApplicationStateMachine.java:119)
              at com.ibm.ws.app.manager.internal.statemachine.LocateHandlerAction.arrived(LocateHandlerAction.java:92)
              at com.ibm.ws.app.manager.internal.lifecycle.ReferenceMapHolder.addListener(ReferenceMapHolder.java:191)
              at com.ibm.ws.app.manager.internal.statemachine.LocateHandlerAction.execute(LocateHandlerAction.java:65)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:358)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:247)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine$StateChangeCallback.processChange(ApplicationStateMachine.java:137)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine$StateChangeCallback.changed(ApplicationStateMachine.java:119)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine$ResourceCallback.succesfulCompletion(ApplicationStateMachine.java:153)
              at com.ibm.ws.app.manager.internal.statemachine.ResolveFileAction.findFile(ResolveFileAction.java:95)
              at com.ibm.ws.app.manager.internal.statemachine.ResolveFileAction.initComplete(ResolveFileAction.java:135)
              at com.ibm.ws.kernel.filemonitor.internal.MonitorHolder.init(MonitorHolder.java:321)
              at com.ibm.ws.kernel.filemonitor.internal.CoreServiceImpl.setMonitor(CoreServiceImpl.java:203)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:227)
              at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:38)
              at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:595)
              at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:476)
              at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1067)
              at org.apache.felix.scr.impl.manager.DependencyManager.serviceAdded(DependencyManager.java:317)
              at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:171)
              at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
              at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
              at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
              at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
              at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
              at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
              at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:451)
              at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:950)
              at com.ibm.ws.app.manager.internal.lifecycle.ServiceReg.register(ServiceReg.java:89)
              at com.ibm.ws.app.manager.internal.statemachine.ResolveFileAction.execute(ResolveFileAction.java:110)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:358)
              at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachine.changeState(ApplicationStateMachine.java:247)
              at com.ibm.ws.app.manager.internal.ApplicationConfigurator.updated(ApplicationConfigurator.java:123)
              at com.ibm.ws.config.internal.cm.ManagedServiceFactoryTracker.callUpdated(ManagedServiceFactoryTracker.java:425)
              at com.ibm.ws.config.internal.cm.ManagedServiceFactoryTracker.access$100(ManagedServiceFactoryTracker.java:49)
              at com.ibm.ws.config.internal.cm.ManagedServiceFactoryTracker$1.run(ManagedServiceFactoryTracker.java:253)
              at java.util.concurrent.Thread
      11/28/12 15:46:40:297 GMT 0000001a SystemOut                                                    O PoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
              at java.lang.Thread.run(Thread.java:662)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL : Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/mypackage/webapp/msac/ws/schema/package-info (wrong name: com/myapp/mypackage/webapp/msac/ws/schema/package-info)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:400)
              at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:275)
              at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:139)
              at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
              at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
              at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:103)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1475)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1443)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
              ... 69 more
      Caused by: java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/mypackage/webapp/msac/ws/schema/package-info (wrong name: com/myapp/mypackage/webapp/msac/ws/schema/package-info)
              at java.lang.ClassLoader.defineClass1(Native Method)
              at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
              at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
              at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
              at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
              at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
              at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
              at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:248)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:385)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:169)
              at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
              at org.hibernate.ejb.packaging.NativeScanner.getPackagesInJar(NativeScanner.java:70)
              at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:490)
              at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:852)
              at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:597)
              at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
              at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268)
              at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
              ... 84 more
      • SystemAdmin
        SystemAdmin
        590 Posts
        ACCEPTED ANSWER

        Re: Liberty profile vs Maven generated JAXB package-info classes

        ‏2012-11-28T16:58:18Z  in response to SystemAdmin
        Sorry, the top here's the FIRST occurrence which suggests something is up in the OSGI bundle cache in workarea:

        O 11-28 15:46:40,291 Config-Thread-9 ERROR org.springframework.web.context.ContextLoader - Context initialization failed
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor#0' defined in URL : Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in URL : Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/mypackage/webapp/msac/ws/schema/package-info (wrong name: com/myapp/mypackage/webapp/msac/ws/schema/package-info)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
  • Jacek_Laskowski
    Jacek_Laskowski
    133 Posts
    ACCEPTED ANSWER

    Re: Liberty profile vs Maven generated JAXB package-info classes

    ‏2012-11-28T17:32:56Z  in response to SystemAdmin
    Hi,

    After a couple of readings of the thread I've got some ideas what to try out.

    Firstly, the line org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:852) seemed to imply Hibernate is in charge of finding the JPA entities. Could you turn it off in persistence.xml with exclude-unlisted-classes=false so only classes listed in the <class> are managed? Although it doesn't solve the initial problem, it may work it around.

    Secondly, the line java.lang.NoClassDefFoundError: WEB-INF/classes/com/myapp/webapp/mycomponent/ws/schema/package-info (wrong name: com/myapp/webapp/mycomponent/ws/schema/package-info) suggests that the scanner somehow got at the class with WEB-INF/classes before the real path of the class so it could be that the bundle/app might not have had it defined as a part of the classpath. Could you verify what's inside MANIFEST.MF of the application? I assume it's WAR, but without some headers in MANIFEST, it's just a jar. Again, it's a shot in the dark and I might be off base completely.

    Thirdly, I assume you've tested it out already, but could you remove the package-info files and see what happens. They're for JAXB, aren't they? Perhaps they're there, but do nothing important?

    Just a bunch of guesses and perhaps nothing useful. Let us know.

    Jacek
    Japila :: verba docent, exempla trahunt