应客户需求,将原来所有跑在TOMCAT下的应用全部迁移到APUSIC下来;涉及10余个WEB应用;现将大致的迁移过程记录如下:
环境:
应用服务器:APUSIC 6.0
DB:ORACLE 10g
OS:IBM AIX
1.原先使用了C3p0作为数据库连接池,迁移到APUSIC上后,需将其替换成APUSIC的连接池;修改CONIFG目录下的datasource.xml配置文件新增数据库连接池,重启APUSIC后:
apusic.JMS.JMSQueue.SYSTEM.DEAD_LETTER] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.JMSQueue.testQueue] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.JMSQueue.testReplyQueue] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.JMSTopic.SYSTEM] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.JMSTopic.SYSTEM.ADMIN_EVENT_TOPIC] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.JMSTopic.testTopic] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.ConnectionFactory.ConnectionFactory] Started.
2010-06-29 16:11:18 INFO [apusic.JMS.ConnectionFactory.SYSTEM.ADMIN_CONNECTION_FACTORY] Started.
2010-06-29 16:11:18 INFO [apusic.service.JMSRegistry] Started.
2010-06-29 16:11:19 INFO [apusic.ejb.mejb.jar.MEJB] EJB home 'ejb/mgmt/MEJB' registered.
2010-06-29 16:11:19 INFO [apusic.application.mejb.jar] Started.
2010-06-29 16:11:21 INFO [apusic.web.webtool.ear./admin] Context Root [/admin]
2010-06-29 16:11:21 INFO [apusic.application.webtool.ear] Started.
2010-06-29 16:11:22 INFO [apusic.web.default./] Context Root [/]
2010-06-29 16:11:22 INFO [apusic.application.default] Started.
2010-06-29 16:11:22 WARNING [apusic.deploy.env] External reference 'jdbc/projndi' of type 'javax.sql.DataSource' not found
2010-06-29 16:11:23 INFO [apusic.web.dyrx./dyrx] Context Root [/dyrx]
2010-06-29 16:11:23 INFO [apusic.application.dyrx] Started.
2010-06-29 16:11:23 INFO [apusic.service.J2EEDeployer] Started.
2010-06-29 16:11:23 INFO [apusic.service.ClassLoaderViewer] Started.
2010-06-29 16:11:23 INFO [apusic.service.JDBCTracer] Started.
2010-06-29 16:11:23 INFO [apusic.service.admin] Started.
2010-06-29 16:11:23 INFO [apusic.server.Main] Server is ready.
日志显示:还是报数据源没找着
需要看下web.xml是否有对DataSource的引用;
查看web.xml代码片段
<resource-ref>
<res-ref-name>jdbc/projndi</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
发现确实有对DataSource做了引用;所以需在META-INF下添加apusic-application.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE apusic-application PUBLIC "-//Apusic//DTD Apusic Application 4.0.2//EN" "http://www.apusic.com/dtds/apusic-application_4_0_2.dtd">
<apusic-application>
<module uri="">
<web>
<context-root>zfoa</context-root>//应用上下文
<resource-ref>
<res-ref-name>jdbc/projndi</res-ref-name>
<jndi-name>jdbc/projndi</jndi-name>
</resource-ref>
</web>
</module>
</apusic-application>
2.WEB.xml下相关的FCKeditor配置;
[apusic.application.qjoa] 启动失败 com.apusic.xml.reader.ScanException: The URL pattern '/common/FCKeditor/editor/filemanager/browser/default/con nectors/jsp/connector ' cannot contains CR(#xD) or LF(#xA) charactersat com.apusic.deploy.runtime.WebModule.validateUrlPattern(Unknown Source ) at com.apusic.deploy.runtime.WebModule$ServletMappingAction.readXml(Unkn own Source) at com.apusic.deploy.runtime.WebModule.readXml(Unknown Source) at com.apusic.deploy.runtime.J2EEModule.loadDeploymentDescriptor(Unknown Source) at com.apusic.deploy.runtime.J2EEModule.load(Unknown Source) at com.apusic.deploy.runtime.WebModule.load(Unknown Source) at com.apusic.deploy.runtime.J2EEApplication.load(Unknown Source) at com.apusic.deploy.runtime.J2EEApplication.startService(Unknown Source ) at com.apusic.service.Service.start(Unknown Source) at com.apusic.deploy.runtime.J2EEDeployer.deploy(Unknown Source) at com.apusic.deploy.runtime.J2EEDeployer.deploy(Unknown Source) at com.apusic.deploy.runtime.J2EEDeployer.deploy(Unknown Source) at com.apusic.deploy.runtime.AutoDeployer.deploy(Unknown Source) at com.apusic.deploy.runtime.AutoDeployer.run(Unknown Source) at java.lang.Thread.run(Thread.java:619)
错误的地方在蓝的 /common/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector。
WEB.xml下FCKeditor相关的:
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>
/common/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>
/common/FCKeditor/editor/filemanager/upload/simpleuploader
</url-pattern>
</servlet-mapping>
<url-pattern></url-pattern>只能写在一行并排。如下:
<url-pattern>/common/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
改之。暂时启用成功。
3.Struts配置文件下的关于CLASS的大小写;
2010-06-30 15:16:02 信息 [apusic.web.webtool.ear./admin] Context Root [/admin]
2010-06-30 15:16:02 信息 [apusic.application.webtool.ear] 成功启动
2010-06-30 15:16:02 信息 [apusic.web.default./] Context Root [/]
2010-06-30 15:16:02 信息 [apusic.application.default] 成功启动
2010-06-30 15:16:02 信息 [con.out] - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
2010-06-30 15:16:02 信息 [con.out] - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
2010-06-30 15:16:03 信息 [con.out] - Begin event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:2065)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:2051)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1858)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1964)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1019)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:829)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:433)
at org.apache.commons.digester.SetPropertiesRule.begin(SetPropertiesRule.java:259)
at org.apache.commons.digester.Rule.begin(Rule.java:200)
at org.apache.commons.digester.Digester.startElement(Digester.java:1273)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:788)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1006)
at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at com.apusic.web.container.ServletComponent.initializeComponent(Unknown Source)
at com.apusic.web.container.ServletComponent.initializeComponent(Unknown Source)
at com.apusic.web.container.WebComponent.create(Unknown Source)
at com.apusic.web.container.WebComponent.getComponent(Unknown Source)
at com.apusic.web.container.WebComponent.init(Unknown Source)
at com.apusic.web.container.WebContainer.loadServlet(Unknown Source)
at com.apusic.web.container.WebContainer.loadServlet(Unknown Source)
at com.apusic.web.container.WebContainer.loadStartupServlets(Unknown Source)
at com.apusic.web.container.WebContainer.start(Unknown Source)
at com.apusic.web.http.VirtualHost.addContext(Unknown Source)
at com.apusic.web.http.HttpServer.loadWebModule(Unknown Source)
at com.apusic.web.WebService.loadWebModule(Unknown Source)
at com.apusic.deploy.runtime.WebModule.load(Unknown Source)
at com.apusic.deploy.runtime.J2EEApplication.loadModules(Unknown Source)
at com.apusic.deploy.runtime.J2EEApplication.startApplication(Unknown Source)
at com.apusic.deploy.runtime.J2EEApplication.startService(Unknown Source)
at com.apusic.service.Service.start(Unknown Source)
at com.apusic.deploy.runtime.J2EEDeployer.startUserApplications(Unknown Source)
at com.apusic.deploy.runtime.J2EEDeployer.startService(Unknown Source)
at com.apusic.service.Service.start(Unknown Source)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.apusic.jmx.MBeanDescriptor.invoke(Unknown Source)
at com.apusic.jmx.DynamicMBeanSupport.invoke(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at com.apusic.server.J2EEServer.start(Unknown Source)
at com.apusic.server.J2EEServer.startup(Unknown Source)
at com.apusic.server.Main.main(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: xgxt/form/commanForm (wrong name: xgxt/form/CommanForm)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at com.apusic.util.UCPClassLoader.defineClass(Unknown Source)
at com.apusic.util.UCPClassLoader.access$100(Unknown Source)
at com.apusic.util.UCPClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.apusic.util.UCPClassLoader.findClass(Unknown Source)
at com.apusic.web.container.ReloadableClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at com.apusic.web.container.ReloadableClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
at com.apusic.web.container.ReloadableClassLoader.loadClass(Unknown Source)
at com.apusic.web.container.JSPClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at com.apusic.web.container.CompositeLoaderDelegate.loadClass(Unknown Source)
at com.apusic.web.container.ServletClassLoader.loadClass(Unknown Source)
at org.apache.struts.config.FormBeanConfig.formBeanClass(FormBeanConfig.java:320)
at org.apache.struts.config.FormBeanConfig.setType(FormBeanConfig.java:191)
... 61 more
2010-06-30 15:16:03 信息 [con.out] - Parsing error processing resource path /WEB-INF/sztz-struts-config.xml, /WEB-INF/sxjy-struts-config.xml,/WEB-INF/gygl-struts-config.xml, /WEB-INF/wjcf-struts-config.xml,/WEB-INF/yxgl.xml,/WEB-INF/wjsc-struts-config.xml, /WEB-INF/jxgl.xml,/WEB-INF/lrh_commen_util.xml, /WEB-INF/zbdx/xszzstruts.xml, /WEB-INF/zbdx/nullFormStruts.xml, /WEB-INF/shgc/xszzstruts.xml, /WEB-INF/shgc/nullFormStruts.xml, /WEB-INF/bjlhdx/xszzstruts.xml,/WEB-INF/qgzx-config.xml, /WEB-INF/hzzyjsxy/xszzstruts.xml,/pjpy/jcxy/pjpy.xml, /WEB-INF/xszz-jcxy.xml, /WEB-INF/wjcf/wjcf_jcxy_dispatch.xml,/WEB-INF/wjcf/wjcf_jcxy.xml
java.lang.reflect.InvocationTargetException
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
一看错误是在Caused by: java.lang.NoClassDefFoundError: xgxt/form/commanForm (wrong name: xgxt/form/CommanForm)
有可能是项目中有大小的问题;用total commander工具首先查找CommanForm.class;发现存在;那估计是有地方把他写成commanForm了;所以马上查找xgxt/form/commanForm结果发现是xgxt\WEB-INF\jygl.xml下有
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config (View Source for full doctype...)>
- <struts-config>
- <form-beans>
<form-bean name="commanForm" type="xgxt.form.commanForm" />
<form-bean name="jyglForm" type="xgxt.base.form.JyglForm" />
<form-bean name="xxxForm" type="xgxt.base.form.XxxForm" />
………………………………
将type="xgxt.form.commanForm" />修改成type="xgxt.form.CommanForm" />
重启发现问题解决;
有可能是原先TOMCAT下对此大小写不敏感;
至此全部的应用迁移成功