websphere6.1 不能创建sessionfactory

问题描述

户使用的服务器是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被版主删除

时间: 2025-01-21 04:46:05

websphere6.1 不能创建sessionfactory的相关文章

websphere6.1+spring创建sessionfactory报错(急求救)

问题描述 ContextLoaderEorg.springframework.web.context.ContextLoaderinitWebApplicationContextContextinitializationfailedorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'txAdvice':Cannotresolvereferencetobean'transactionMa

hibernate-Hibernate 5.0.1 Final中怎么创建SessionFactory 详细步骤

问题描述 Hibernate 5.0.1 Final中怎么创建SessionFactory 详细步骤 新手求教,Hibernate 5.0.1 Final中怎么创建SessionFactory 这是我自己写的步骤,但是测试不行,提示 hibernate.properties not found: SessionFactory sessionFactory = null; Configuration configuration = new Configuration().configure();

javase-Hibernate4创建SessionFactory时卡住不运行?

问题描述 Hibernate4创建SessionFactory时卡住不运行? Hibernate4创建SessionFactory时卡住不运行? 使用Hibernate4写一个CRUD示例,javase程序,在main方法中创建sessionFactory,使用如下代码: private HibernateUtils() { try { if (this.sessionFactory == null) { Configuration cfg = new Configuration(); cfg.

Hibernate创建sessionFactory null

问题描述 请问各位: 我在使用junit进行单元测试的时候,到实例化SessionFactory的时候不成功,控制台打印的信息如下:2013-8-14 15:36:45 org.hibernate.annotations.common.Version <clinit>INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}2013-8-14 15:36:45 org.hibernate.Version logVersionIN

用MyEclipse创建一个Struts+Hibernate项目

第一步: 创建一个Web Project, 在主窗口菜单里面点击 File -> New -> Project..., 会弹出New Project的窗口, 选择MyEclipse -> J2EE Projects -> Web Project, 然后Next, 填写你的Project Name, Source Folder, Web root folder以及Context root URL, Location是指你的工作目录, 你可以选择默认的, 也可以指向自己想要的路径, F

mysql-SchemaExport export自动创建表失败

问题描述 SchemaExport export自动创建表失败 1C package entity; import org.hibernate.Session;import org.hibernate.SessionFactory;import org.hibernate.cfg.Configuration;import org.hibernate.service.ServiceRegistry;import org.hibernate.service.ServiceRegistryBuilde

Hibernate数据库对象的创建与导出

Hibernate 与数据库的关系是ORM关系,对象映射数据库. 那么如何通过对象对数据库进行各种对象的ddl与dml操作呢? 数据库对象操作的〈database-object ../〉+ SchemaExport 1.hibernate.cfg.xml <?xml version="1.0" encoding="GBK"?> <!-- 指定Hibernate配置文件的DTD信息 --> <!DOCTYPE hibernate-conf

利用开源项目Hibernate开发Blog系统

项目 开发工具采用MYECLIPS3.6,首先是建立项目,导入STRUTS+HIBERNATE包,然后配置SRC跟目录下的hibernate.cfg.xml.我采用的是MYSQL数据库,所以配置如下: <hibernate-configuration>     <session-factory>        <!-- properties -->        <property name="connection.username">r

Hibernate核心接口简介

接口 在项目中使用Hibernate框架,非常关键的一点就是要了解Hibernate的核心接口.Hibernate接口位于业务层和持久化层,如图1所示. 图1 Hibernate核心接口的层次架构关系 Hibernate的核心接口一共有5个,分别为:Session.SessionFactory.Transaction.Query和Configuration.这5个核心接口在任何开发中都会用到.通过这些接口,不仅可以对持久化对象进行存取,还能够进行事务控制.下面对这五的核心接口分别加以介绍. ·S