Search code examples
webspherewebsphere-6.1websphere-portal

Axis client jar is was 6.1 shared app


I've created an axis client for a web service. I exported as a jar and included in in the shared/app folder so that it is available to all portlet apps to use. The problem is that when my portlet projects try to init the client I get the following exception:

    ERROR [org.springframework.web.portlet.DispatcherPortlet] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'portalStatisticsTransactionDelegateProxy' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.uig.portal.ws.statistics.service.PortalStatisticsTransactionDelegateProxy]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.apache.axis.client.AxisClient (initialization failure)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:653)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:370)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:293)
    at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
    at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1138)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:817)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2124)
    at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.uig.portal.ws.statistics.service.PortalStatisticsTransactionDelegateProxy]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.apache.axis.client.AxisClient (initialization failure)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
    ... 30 more
Caused by: java.lang.NoClassDefFoundError: org.apache.axis.client.AxisClient (initialization failure)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
    at org.apache.axis.client.Service.getAxisClient(Service.java:104)
    at org.apache.axis.client.Service.<init>(Service.java:113)
    at com.uig.portal.ws.statistics.service.PortalStatisticsTransactionServiceLocator.<init>(PortalStatisticsTransactionServiceLocator.java:12)
    at com.uig.portal.ws.statistics.service.PortalStatisticsTransactionDelegateProxy._initPortalStatisticsTransactionDelegateProxy(PortalStatisticsTransactionDelegateProxy.java:18)
    at com.uig.portal.ws.statistics.service.PortalStatisticsTransactionDelegateProxy.<init>(PortalStatisticsTransactionDelegateProxy.java:8)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:522)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
    ... 32 more

Any ideas? I tried referencing the axis jars from my portlet project, but that didn't work.


Solution

  • I think that your client jar interferes with standard websphere libraries. It leads to a situation where two different versions of the same class exist on the server classloader hierarchy. Your application classs loader probably picks the wrong version.

    I would suggest to remove the jar from shared/app and configure a shared library instead. Then you associate the shared library with your application. You can find more details in was infocenter.