|
项目以前一直运行在tomcat和jboss上,现在要求运行在weblogic10.3上,这次迁移遇到了很多问题,特分享下遇到的问题和解决的办法
项目框架: struts-2.1.6,spring 2.5.6 ,ibatis-2.3.4,作为war包发布
1 启动weblogic报错:解析strtus.xml文件失败
单步跟踪发现在strtus.xml中有
<include file="struts-config/*/struts-*.xml" />
利用通配符匹配配置文件,但是在weblogic下不能解析,只有老老实实的把struts的配置文件一个个引入
2 正常启动,但是运行时报错: DateUtils.addDate方法找不到。
这个文件就是weblogic优先加载自己bea\modules\com.bea.core.apache.commons.lang_2.1.0.jar,而不是我们web-inf\lib下的commons.lang_2.3.jar
按照要求在web-inf下增加weblogic.xml
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
3 启动又报错:
java.lang.ClassCastException: weblogic.xml.jaxp.RegistryDocumentBuilderFactory at javax.xml.parsers.DocumentBuilderFactory.newInstan ce()
Ljavax.xml.parsers.DocumentBuilderFactory;(Unk nown Source) at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.createDocumentBuilderFactory
(XmlBeanDe finitionReader.java:250) at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions
如果prefer-web-inf-classes = false则能正常启动
这个问题在于web-inf\lib下的jar有冲突,不同jar中存在相同全限定名的class类名。
又花了不少时间才找到它 : xml-apis.jar,去掉后系统能正常启动了
4 测试发现还有些错误
我们自己的资源文件找不到,资源文件在web-inf\conf\ 下 程序中加载的路径是 ../conf, weblogic不认 ../ 后来调整了文件路径,放web-inf/classes/conf下,加载路径用 conf/即可
还有个问题就是我们用到了ecside来展现大数据的表格,这个比extjs的gridPanel性能要好
但是在jsp中有ecside的标签马上报错。
这个问题检查发现是少了standard.jar,jstl.jar,为啥在tomcat,jboss就没有报错呢。。
顺便提下weblogic的数据库连接池的配置 jndiname = JNDI_xxx
在spring的applicationContext.xml配置的dateSources如下
<bean id="dsJndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.provider.url">t3://192.156.1.42:8000</prop>
<prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
</props>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>JNDI_xxx</value>
</property>
<property name="resourceRef">
<value>true</value>
</property>
<property name="jndiTemplate">
<ref local="dsJndiTemplate" />
</property>
</bean>
结论:折腾了2天时间解决了了一些问题,但是由于时间问题。很多只是简单的用了解决了下,没有深入了解下去,这里我权当抛个砖,希望各位大侠来分享自己的经验 |
|
|
|
|
|
|