问题
I get this error after deploying a new war through the server configuration tool. I tried to revert back to the original war error persist.
Tomcat 7.0.30 Worklight Server 6.1.0.2
javax.servlet.ServletException: Worklight Console initialization failed.Logged Exception: java.lang.RuntimeException: conf/authenticationConfig.xml contains duplicated realm named: wl_anonymousUserRealm
com.worklight.core.auth.impl.AuthenticationFilter.verifyServletInitialized(AuthenticationFilter.java:317)
com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:111)
The xml is built by default my realm is defined in the context.xml for server.
<!-- Licensed Materials - Property of IBM
5725-G92 (C) Copyright IBM Corp. 2006, 2013. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or
disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
<!-- Uncomment the next element to protect the worklight console and the first section in securityTests below. -->
<staticResources>
<!-- <resource id="worklightConsole" securityTest="WorklightConsole">
<urlPatterns>/console*</urlPatterns>
</resource>
-->
<resource id="subscribeServlet" securityTest="SubscribeServlet">
<urlPatterns>/subscribeSMS*</urlPatterns>
</resource>
</staticResources>
test below , element must be added to application-descriptor.xml as well. -->
<securityTests>
<!--
<customSecurityTest name="WorklightConsole">
<test realm="WorklightConsole" isInternalUserID="true"/>
</customSecurityTest>
<mobileSecurityTest name="mobileTests">
<testAppAuthenticity/>
<testDeviceId provisioningType="none" />
<testUser realm="myMobileLoginForm" />
</mobileSecurityTest>
<webSecurityTest name="webTests">
<testUser realm="myWebLoginForm"/>
</webSecurityTest>
<customSecurityTest name="customTests">
<test realm="wl_antiXSRFRealm" step="1"/>
<test realm="wl_authenticityRealm" step="1"/>
<test realm="wl_remoteDisableRealm" step="1"/>
<test realm="wl_anonymousUserRealm" isInternalUserID="true" step="1"/>
<test realm="wl_deviceNoProvisioningRealm" isInternalDeviceID="true" step="2"/>
</customSecurityTest>
-->
<customSecurityTest name="SubscribeServlet">
<test isInternalUserID="true" realm="SubscribeServlet"/>
</customSecurityTest>
<customSecurityTest name="AgentSecurityTest">
<test isInternalUserID="true" realm="FbitnAgentRealm"/>
</customSecurityTest>
</securityTests>
<realms>
<!--realm name="ConsumerRealm" loginModule="AnonymousLoginModule" >
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="ConsumerPolicy.onAuthRequired"/>
<parameter name="logout-function" value="ConsumerPolicy.onLogout"/>
</realm-->
<realm loginModule="StrongDummy" name="SampleAppRealm">
<className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
</realm>
<realm loginModule="requireLogin" name="WorklightConsole">
<className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
<onLoginUrl>/console</onLoginUrl>
</realm>
<realm loginModule="rejectAll" name="SubscribeServlet">
<className>com.worklight.core.auth.ext.HeaderAuthenticator</className>
</realm>
<!-- For websphere -->
<!-- realm name="WASLTPARealm" loginModule="WASLTPAModule">
<className>com.worklight.core.auth.ext.WebSphereFormBasedAuthenticator</className>
<parameter name="login-page" value="/login.html"/>
<parameter name="error-page" value="/loginError.html"/>
</realm -->
<realm name="FbitnAgentRealm" loginModule="FbitnAgentLogin">
<className>com.fbitn.WorklightCustomAuthenticator</className>
</realm>
</realms>
<loginModules>
<loginModule name="FbitnAgentLogin">
<className>com.fbitn.WorklightCustomLogin</className>
</loginModule>
<!--loginModule name="AnonymousLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule-->
<!--loginModule name="HeaderLoginModule" canBeResourceLogin="true" isIdentityAssociationKey="true" audit="true"-->
<loginModule name="StrongDummy">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>
<loginModule name="requireLogin">
<className>com.worklight.core.auth.ext.SingleIdentityLoginModule</className>
</loginModule>
<loginModule name="rejectAll">
<className>com.worklight.core.auth.ext.RejectingLoginModule</className>
</loginModule>
<!-- For websphere -->
<!-- loginModule name="WASLTPAModule">
<className>com.worklight.core.auth.ext.WebSphereLoginModule</className>
</loginModule -->
<!-- For enabling SSO with no-provisioning device authentication -->
<!-- <loginModule name="MySSO" ssoDeviceLoginModule="WLDeviceNoProvisioningLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule> -->
<!-- For enabling SSO with auto-provisioning device authentication -->
<!-- <loginModule name="MySSO" ssoDeviceLoginModule="WLDeviceAutoProvisioningLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule> -->
</loginModules>
回答1:
There was two versions on the server. Tomcat/Worklight/app and Tomcat/webapps/app. I'm not sure the the server config tool was used to deploy the first one, but was on the second deploy. I removed the app contents from the Worklight folder and left the original folder under webapps, the server.xml is configured to read both directories, only one is needed.
I found out this was because of the worklight-jee-library.jar was install under the tomcat/lib and in the tomcat/Worklight/app. I believe the one in the lib was placed there by the installation manager when Worklight 6.1 was installed.
来源:https://stackoverflow.com/questions/26169247/worklight-console-for-app-not-working-after-deploying-new-war