spring+struts2+cxf项目部署到webSphere后报错,部署到tomcat下时正常。 [10/30/14 23:33:47:211 PDT] 0000006b StrutsSpringO I com.opensymphony.xwork2.util.logging.commons.CommonsLogger info Initializing Struts-Spring integration... [10/30/14 23:33:47:212 PDT] 0000006b StrutsSpringO E com.opensymphony.xwork2.util.logging.commons.CommonsLogger fatal Error creating bean with name ""queryLogService"": Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.pactera.bosBigData.webService.HBaseLogQueryService com.pactera.bigdata.common.service.impl.QueryLogService.hBaseLogQueryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""org.apache.cxf.binding.soap.SoapBindingFactory"" defined in class path resource [META-INF/cxf/cxf-extension-soap.xml]: Cannot resolve reference to bean ""cxf"" while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ""cxf"" defined in class path resource [META-INF/cxf/cxf.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.apache.cxf.bus.spring.SpringBus]: Constructor threw exception; nested exception is org.apache.cxf.bus.extension.ExtensionException [10/30/14 23:33:47:264 PDT] 0000006b Dispatcher E com.opensymphony.xwork2.util.logging.commons.CommonsLogger error Dispatcher initialization failed java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:230) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:604) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:574) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:530) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145) at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:568) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:475) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:308) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:380) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:892) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862) [10/30/14 23:33:47:266 PDT] 0000006b webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor]: Class: com.opensymphony.xwork2.spring.SpringObjectFactory File: SpringObjectFactory.java Method: getClassInstance Line: 230 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:230:-1 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:502) at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145) at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:568) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:475) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:308) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:380) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:892) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3761) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:283) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncChannelFuture.java:205) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862) Caused by: java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:230) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:604) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:574) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:530) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:292) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:112) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:250) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490) ... 24 more 在创建queryLogService时失败,因为实例化org.apache.cxf.bus.spring.SpringBus时失败! 在tomcat中都跑的好好的为什么到webSphere下会变成这样? |
|
20分 |
很正常,要么就是jar包版本的问题,要么就是webSphere自带的包与你项目中的包冲突了
|
20分 |
这种问题很纠结的 ,你看看spring的版本吧
|
20分 |
这个bean(“org.apache.cxf.bus.spring.SpringBus”)构造失败,贴下你的xml配置看看
|
20分 |
当服务器已经提供了一些最常用最基本的 API 库时我们的程序不需要再自带一份。比如 log4j, commons-logging 之类的。
|
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>BOSBigDataWeb</display-name> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> <context-param> <param-name>webAppRootKey</param-name> <param-value>webapp.root</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:ApplicationContext.xml</param-value> </context-param> <servlet> <servlet-name>CXFService</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> </servlet> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> <init-param> <param-name>filterConfig</param-name> <param-value>classpath:struts.xml</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.properties</param-value> </context-param> <filter> <filter-name>characterEncodiing</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>characterEncodiing</filter-name> <url-pattern>/</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <session-config> <session-timeout>20</session-timeout> </session-config> </web-app> ApplicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <context:annotation-config /> <context:property-placeholder location="classpath:config.properties" /> <!-- c3p0配置 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="${c3p0.driverClass}"></property> <property name="jdbcUrl" value="${c3p0.url}"></property> <property name="user" value="${c3p0.user}"></property> <property name="password" value="${c3p0.password}"></property> <property name="minPoolSize" value="${c3p0.minPoolSize}" /> <property name="maxPoolSize" value="${c3p0.maxPoolSize}" /> <property name="maxIdleTime" value="${c3p0.maxIdleTime}" /> <property name="acquireIncrement" value="${c3p0.acquireIncrement}" /> <property name="maxStatements" value="${c3p0.maxStatements}" /> <property name="initialPoolSize" value="${c3p0.initialPoolSize}" /> <property name="idleConnectionTestPeriod" value="${c3p0.idleConnectionTestPeriod}" /> <property name="acquireRetryAttempts" value="${c3p0.acquireRetryAttempts}" /> <property name="acquireRetryDelay" value="${c3p0.acquireRetryDelay}" /> <property name="breakAfterAcquireFailure" value="${c3p0.breakAfterAcquireFailure}" /> <property name="testConnectionOnCheckout" value="${c3p0.testConnectionOnCheckout}" /> </bean> <!--获取由应用服务器提供的DataSource的组件--> <!-- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> --> <!-- <property name="jndiName" value="${jndi.name}"></property> --> <!-- </bean> --> <!--根据dataSource和configLocation创建一个SqlMapClient --> <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <property name="configLocation"> <value>classpath:SqlMapConfig.xml</value> </property> <property name="dataSource"> <ref bean="dataSource" /> </property> </bean> <!--根据sqlMapClien创建一个SqlMapClient模版类 --> <bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate"> <property name="sqlMapClient"> <ref bean="sqlMapClient" /> </property> </bean> <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource" /> </bean> <!-- 利用注解实现事务控制 --> <tx:annotation-driven transaction-manager="txManager"/> <bean class="com.pactera.bigdata.common.core.CustomizedPropertyConfigurer"> <property name="locations"> <list> <!--<value>file:G:/bigdata/config/config.properties</value> --> <value>classpath:/config.properties</value> </list> </property> </bean> <import resource="spring/beans.xml"/> <import resource="applicationContext-client.xml"/> <context:component-scan base-package="com.pactera.bosBigData.webService" /> <context:component-scan base-package="com.pactera.bigdata.common.service" /> <!-- <import resource="quartz.xml"/> --> <!--调度器初始化 --> <!-- <bean id="scheduleTaskControll" class="com.pactera.bigdata.Schedule.ScheduleTaskInit" init-method="initTask"></bean> --> </beans> applicationContext-client.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd" default-lazy-init="true"> <!--会向cxf jar包去找 --> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <!-- address="http://hdp-m2:8099/BOSBigDataWebService/hbaseLogQuery" --> <!-- webserice接收客户端 --> <jaxws:client id="cUserInfoClient" address="http://hdp-m2:8099/BOSBigDataWebService/hbaseLogQuery" serviceClass="com.pactera.bosBigData.webService.HBaseLogQueryService"> <jaxws:outInterceptors> <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /> <bean class="com.pactera.bigdata.interceptor.MethodToInvokeInterceptorClient"></bean> </jaxws:outInterceptors> </jaxws:client> <!-- hbase通用查询 --> <jaxws:client id="hbaseCommQuery" address="http://hdp-m2:8099/BOSBigDataWebService/hbaseCommQuery" serviceClass="com.pactera.bosBigData.webService.HBaseCommQueryService"> <jaxws:dataBinding> <bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding" scope="prototype" /> </jaxws:dataBinding> <jaxws:outInterceptors> <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /> <bean class="com.pactera.bigdata.interceptor.MethodToInvokeInterceptorClient"></bean> </jaxws:outInterceptors> </jaxws:client> </beans> 谢谢。。。帮我看看 哪配错了 |
|
你的意思是webSphere已经自带了log4j 我项目中的都要去掉吗? |
|
20分 |
webSphere上框架的配置和tomcat上略有不同,而且每一个版本的IBM JSK对spring的支持都不同,如IBM JDK6 只支持spring2.5及以上,看下你webSphere的版本号和spring的版本号。看看下面的文章,希望对你有帮助,http://www.ibm.com/developerworks/cn/websphere/techjournal/0609_alcott/0609_alcott.html
|
貌似空指针了。
|
|
应该和WAS的JAR有冲突,如果WAS有默认存在的包,它就会使用自带的。你按照这个逻辑再看看。
|
|
我用的是spring3.0 webSphere用的是8.5 |
|
这种问题基本都是jar包冲突问题,楼主可以把异常信息的报错原因那条粘贴到百度,然后搜索,逐条错误原因排查,然后关注控制台报错信息是否有变化。
|
|
如果百度有用我就不会跑到csdn上来问了…………………. |