问题描述
户使用的服务器是websphere6.1,所以项目要发布在websphere上面,以前没弄过,看了下websphere的安装和配置把项目发布到websphere6.1上面就有问题了,老报sessionFactory创建不了,但是在tomcat5.5下面没有任务问题,网上找了很多资料都没有相关问题,请以前有websphere开发经验的高手帮帮忙,不尽感激~配置文件路径没对?还是Websphere没有配置数据源,这个和Websphere配置无关吧?web.xml文件<web-appversion="2.4"xmlns="http://java.sun.com/xml/ns/j2ee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"><!--启动参数--><context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:/applicationContext*.xml</param-value></context-param><!--对Spring容器进行实例化--><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><servlet><servlet-name>action</servlet-name><servlet-class>org.apache.struts.action.ActionServlet</servlet-class><init-param><param-name>config</param-name><param-value>/WEB-INF/struts-config.xml</param-value></init-param><init-param><param-name>debug</param-name><param-value>3</param-value></init-param><init-param><param-name>detail</param-name><param-value>3</param-value></init-param><load-on-startup>0</load-on-startup></servlet><!--Filter定义--><!--CharacterEncodingfilter--><filter><filter-name>encodingFilter</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><init-param><param-name>forceEncoding</param-name><param-value>true</param-value></init-param></filter><!--HibernateOpenSessionInViewfilter--><filter><filter-name>hibernateOpenSessionInViewFilter</filter-name><filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter-mapping><filter-name>hibernateOpenSessionInViewFilter</filter-name><url-pattern>*.do</url-pattern></filter-mapping><servlet-mapping><servlet-name>action</servlet-name><url-pattern>*.do</url-pattern></servlet-mapping><welcome-file-list><welcome-file>index.jsp</welcome-file></welcome-file-list></web-app>
<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-2.5.xsd"><!--=========================GENERALDEFINITIONS=========================--><!--Configurerthatreplaces${...}placeholderswithvaluesfrompropertiesfiles--><!--(inthiscase,mailandJDBCrelatedproperties)--><!--<beanid="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><propertyname="locations"><list><value>etc/jdbc.properties</value></list></property></bean>--><beanid="dataSource"class="org.apache.tomcat.dbcp.dbcp.BasicDataSource"destroy-method="close"><propertyname="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property><propertyname="url"><value>jdbc:oracle:thin:@10.151.2.101:1521/orc</value></property><propertyname="username"><value>dbuser</value></property><propertyname="password"><value>cistjava</value></property></bean><!--HibernateSessionFactory--><beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><propertyname="dataSource"><reflocal="dataSource"/></property><propertyname="configurationClass"value="org.hibernate.cfg.AnnotationConfiguration"/><propertyname="configLocation"><value>classpath:hibernate.cfg.xml</value></property></bean><beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><propertyname="sessionFactory"ref="sessionFactory"/></bean><beanclass="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/><beanclass="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"><propertyname="transactionInterceptor"><refbean="transactionInterceptor"/></property></bean><beanid="transactionInterceptor"class="org.springframework.transaction.interceptor.TransactionInterceptor"><propertyname="transactionManager"><refbean="transactionManager"/></property><propertyname="transactionAttributeSource"><beanclass="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/></property></bean><beanid="hibernateTemplete"class="org.springframework.orm.hibernate3.HibernateTemplate"><propertyname="sessionFactory"><reflocal="sessionFactory"/></property></bean></beans>
错误:[10-4-1316:35:36:843CST]0000002aSRTServletResWWARNING:Cannotsetstatus.Responsealreadycommitted.[10-4-1316:35:36:843CST]0000002aSRTServletResWWARNING:Cannotsetheader.Responsealreadycommitted.[10-4-1316:35:36:890CST]0000002aWebAppE[ServletError]-[action]:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nobeannamed'sessionFactory'isdefinedatorg.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:509)atorg.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1041)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:273)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)atorg.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1048)atorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:242)atorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:227)atorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:171)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atcom.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)atcom.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atcom.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)atcom.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)atcom.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)atcom.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)atcom.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)atcom.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)atcom.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)atcom.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3107)atcom.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)atcom.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)atcom.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)atcom.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)atcom.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)atcom.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)atcom.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)atcom.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)atcom.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)atcom.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)atcom.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)atcom.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)atcom.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)atcom.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)atcom.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)[10-4-1316:38:20:796CST]0000003dSessionListenISessionListenersessionDestroyed(HttpSessionEventevent)sessionwithsessionID=uiObNx_FLswv1sh9m7C9lvHgettingdestroyed
解决方案
本帖最后由 niyeyedeo 于 2010-04-13 17:15:54 编辑
解决方案二:
我也遇到相同问题,各位大侠,救命啊.
解决方案三:
该回复于2010-04-15 13:39:33被版主删除
解决方案四:
我也遇到了类似问题,环境如下:WebSphere6.1.0.0forwindwos构建号:b0620.14构建日期:5/16/06web.xml原配置[code]<context-param><param-name>contextConfigLocation</param-name><param-value>classpath*:applicationContext*.xml</param-value></context-param>[/code]发现利用通配符有问题。需呀完整声明所有的配置,修改后如下:[code]<context-param><param-name>contextConfigLocation</param-name><param-value>classpath:applicationContext-aop.xmlclasspath:applicationContext-calendar.xmlclasspath:applicationContext-client.xmlclasspath:applicationContext-dao.xmlclasspath:applicationContext-service.xmlclasspath:applicationContext.xml</param-value></context-param>[code]文件解决。
解决方案五:
该回复于2010-08-04 15:22:17被版主删除