部署SSH项目到weblogic server

本地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

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。