本地WebServer为Tomcat7,最终部署到Weblogic 11g。以下方法全部为Google结果。
1. 部署后说ClassNotFoundException
weblogic类加载顺序问题,在WEB-INF目录下创建weblogic.xml。
<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"> <container-descriptor> <index-directory-enabled>true</index-directory-enabled> <prefer-web-inf-classes>true</prefer-web-inf-classes> <show-archived-real-path-enabled>true</show-archived-real-path-enabled> </container-descriptor> </weblogic-web-app>
表示让weblogic先加载WEB-INF/lib下面的jar包
2. unable to instantiate action
weblogic中的web.xml不支持通配符的写法,如:
部署到tomcat中可以这样写
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:/applicationContext*.xml</param-value> </context-param>
但是在weblogic中必须这样写
<context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:/applicationContext.xml classpath:/applicationContext-bean.xml </param-value> </context-param>
3. SessionFactory配置
Tomcat下:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation" value="classpath:hibernate.cfg.xml"/> </bean>
Weblogic使用datasource:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" > <property name="jndiName"> <value>jdbc/TESTDS</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mappingResources"> <list> <value>com/pojo/Refresh.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.connection.release_mode">auto</prop> <prop key="hibernate.current_session_context_class">jta</prop> <prop key="hibernate.transaction.manager_lookup_class"> org.hibernate.transaction.WeblogicTransactionManagerLookup </prop> </props> </property> </bean>
参考链接:http://simon-fish.iteye.com/blog/1136438
时间: 2024-10-10 05:51:40