我正在尝试将应用程序从Apache Tomcat 5.5迁移到版本7.我将应用程序从Tomcat 5.5.25成功迁移到Tomcat 6.0.41。然后我将应用程序从版本6.0.41迁移到版本7.0.28并遇到了问题。当我启动Tomcat 7服务器时,我在catalina.out
日志中收到以下错误:
Jul 1, 2015 2:15:31 PM org.apache.catalina.startup.HostConfig deployDescriptor INFO: Deploying configuration descriptor /usr/local/opt/ldtools/share/java/apache-tomcat-7.0.28/conf/Catalina/localhost/ttste st.xml Jul 1, 2015 2:15:31 PM org.apache.tomcat.util.digester.Digester startElement SEVERE: Begin event threw error java.lang.VerifyError: class com.att.csp.sca.tomcat.CSPRealm overrides final method init.()V at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$000(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:303) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:144) at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1359) 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.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.tomcat.util.digester.Digester.parse(Digester.java:1537) at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:612) at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:576) at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:814) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:364) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:139) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650) at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
我查看了realm-howto.html页面,但它似乎确实适用,因为当我在“快速入门”部分阅读时:
如果您使用的是包含一个或多个元素的Web应用程序,并且
<login-config>
元素定义了用户需要如何对自己进行身份验证,则只需要关注此问题。如果您不使用这些功能,则可以安全地跳过此文档。
应用程序不使用<login-config>
,因为它在web.xml中被注释掉了。以下是$CATALINA_HOME/conf/Catalina/localhost/ttstest.xml
文件中的Realm部分:
<code>
<Realm className="com.att.csp.sca.tomcat.CSPRealm">
<Authenticator
sysName="LD"
validationEnv="PROD"
loginURL="https://www.eaccess.xyz.com/empsvc/hrmgt/pagLogin"
logoutURL="https://www.eaccess.xyz.com/empsvc/hrmgt/pagLogout"
errorPage="authFailure.jsp">
<Resource name="jdbc_tts">
<Value
type="oracle.jdbc.pool.OracleDataSource"
debug="0"
URL="jdbc:oracle:thin:@devsrvr.pedc.xyz.com:1521:ttsdev"
connectionCachingEnabled="true"
connectionCacheName="my boring connection cache"
user="test"
password="test"
connectionCacheProperties="{MinLimit=0, MaxLimit=2, InitialLimit=0}"
/>
</Resource>
<EventLogger
type="com.att.csp.sca.log.DBEventLogger"
dataSourceName="jdbc_tts"
securityEventTableName="security_log"
maxRequestURISize="255"
/>
<RoleProvider
type="com.att.csp.sca.DBRoleProvider"
dataSourceName="jdbc_tts"
userRoleTableName="user_role_matrix"
userFieldName="user_id"
roleFieldName="role"
allowCaching="true"
/>
<UserProfilePersistor
type="com.att.csp.sca.DBUserProfilePersistor"
dataSourceName="jdbc_tts"
userTableName="users"
userFieldName="id"
lastActiveFieldName="last_active"
lastIpAddrFieldName="last_ip_addr"
/>
</Authenticator>
</Realm>
使用CSPRealm中的参数的jar文件位于$CATALINA_HOME/lib
目录中,就像它们用于Tomcat 6迁移一样。