Not able to configure J2ee agent on adding my cust

2019-09-03 19:59发布

问题:

I am getting the problem in configuring j2ee agent and not able to figure out what is going wrong,if someone can help me out of this proble, my problem is I have configured openam 11 in domain 1 in tomcat server and agentapp in domain2 in tomcat server, now when I create a J2ee agent with Datastore as "OpenDj", I am able to configure my j2ee agent to it, but when I am adding my customized Datastore plugin class which is fetching data from postgre sql, I am able to see the my users and group under subject, but when I am trying to reconfigure J2ee agent with Datastore as my customized data store I am getting error as:

java.lang.ExceptionInInitializerError
    at com.sun.identity.agents.arch.AgentConfiguration.bootStrapClientConfiguration(AgentConfiguration.java:727)
    at com.sun.identity.agents.arch.AgentConfiguration.initializeConfiguration(AgentConfiguration.java:1140)
    at com.sun.identity.agents.arch.AgentConfiguration.<clinit>(AgentConfiguration.java:1579)
    at com.sun.identity.agents.arch.Manager.<clinit>(Manager.java:675)
    at com.sun.identity.agents.tomcat.v6.AmTomcatRealm.<clinit>(AmTomcatRealm.java:67)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.lang.Class.newInstance(Class.java:374)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1350)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2778)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    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:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: com.sun.identity.security.AMSecurityPropertiesException: AdminTokenAction:  FATAL ERROR: Cannot obtain Application SSO token.
Check AMConfig.properties for the following properties
    com.sun.identity.agents.app.username
    com.iplanet.am.service.password
    at com.sun.identity.security.AdminTokenAction.run(AdminTokenAction.java:272)
    at com.sun.identity.security.AdminTokenAction.run(AdminTokenAction.java:76)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.identity.common.configuration.ConfigurationObserver.registerListeners(ConfigurationObserver.java:89)
    at com.sun.identity.common.configuration.ConfigurationObserver.getInstance(ConfigurationObserver.java:114)
    at com.sun.identity.common.DebugPropertiesObserver.<clinit>(DebugPropertiesObserver.java:49)
    ... 32 more

java.lang.ExceptionInInitializerError
    at com.sun.identity.agents.arch.AgentConfiguration.bootStrapClientConfiguration(AgentConfiguration.java:727)
    at com.sun.identity.agents.arch.AgentConfiguration.initializeConfiguration(AgentConfiguration.java:1140)
    at com.sun.identity.agents.arch.AgentConfiguration.<clinit>(AgentConfiguration.java:1579)
    at com.sun.identity.agents.arch.Manager.<clinit>(Manager.java:675)
    at com.sun.identity.agents.tomcat.v6.AmTomcatRealm.<clinit>(AmTomcatRealm.java:67)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.lang.Class.newInstance(Class.java:374)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:145)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1276)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1350)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2778)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    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:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:617)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:665)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: com.sun.identity.security.AMSecurityPropertiesException: AdminTokenAction:  FATAL ERROR: Cannot obtain Application SSO token.
Check AMConfig.properties for the following properties
    com.sun.identity.agents.app.username
    com.iplanet.am.service.password
    at com.sun.identity.security.AdminTokenAction.run(AdminTokenAction.java:272)
    at com.sun.identity.security.AdminTokenAction.run(AdminTokenAction.java:76)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.identity.common.configuration.ConfigurationObserver.registerListeners(ConfigurationObserver.java:89)
    at com.sun.identity.common.configuration.ConfigurationObserver.getInstance(ConfigurationObserver.java:114)
    at com.sun.identity.common.DebugPropertiesObserver.<clinit>(DebugPropertiesObserver.java:49)
    ... 32 more

回答1:

looking into the documentation at http://docs.forgerock.org/en/openam-pa/3.1.0-Xpress/agent-install-guide/#chap-apache-tomcat

i found this line

If your policy agent configuration is not in the top-level realm (/), then you must edit config/OpenSSOAgentBootstrap.properties to identify the sub-realm that has your policy agent configuration. Find com.sun.identity.agents.config.organization.name and change the / to the path to your policy agent profile. This allows the policy agent to properly identify itself to the OpenAM server.

the same document has mentioned the following

Check the debug.out debug log to verify that the agent did start up.

$ tail -n 7 /path/to/j2ee_agents/tomcat_v6_agent/Agent_001/logs/debug/debug.out
=======================================
Version: ...
Revision: 3111
Build Date: 20120915
Build Machine: builds.forgerock.org
=======================================

While i got the following error

Unable to retrieve application under realm /.

Correcting the Realm name to point to the LDAP realm i was using has corrected the error.

But I still could not get any trace of AMConfig.properties.

So point is the configuration done in OPenAM Admin screen should match with what is specified in the properties file of J2EE_Agent.

It is quite old post but hope this will help somebody else walking the same path



回答2:

Your problem description is hard to understand. You may want to look at how to attach a debugger to OpenAM. See https://wikis.forgerock.org/confluence/display/openam/Attach+a+Debugger+to+OpenAM