Wednesday, October 26, 2011

Cannot Restart Managed Server : Weblogic because of Exception while getting default policy Provider

While starting the Weblogic Managed server or admin server I was getting the eorror:

Reason: weblogic.security.SecurityInitializationException: The loading of OPSS java security policy provider failed due to exception, see the exception stack trace or the server log file for root cause. If still see no obvious cause, enable the debug flag -Djava.security.debug=jpspolicy to get more information. Error message: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider


weblogic.security.SecurityInitializationException: The loading of OPSS java security policy provider failed due to exception, see the exception stack trace or the server log file for root cause.
 
Caused By: oracle.security.jps.JpsException: [PolicyUtil] Exception while getting default policy Provider
Caused By: java.security.PrivilegedActionException: oracle.security.jps.JpsException: [PolicyUtil] Unable to obtain default JPS Context!
Caused By: oracle.security.jps.JpsException: [PolicyUtil] Unable to obtain default JPS Context!
Caused By: oracle.security.jps.JpsRuntimeException: Cannot read from policy store.
Caused By: oracle.security.jps.JpsRuntimeException: javax.xml.stream.XMLStreamException: javax.xml.stream.XMLStreamException: Premature end of file encountered
 
 
Cause:
 
this can happen when a non weblogic user tried to restart the managed server [may be root by mistake]
 
In my env, it had corrupted the : system-jazn-data.xml [got 0 bytes in it]
 
so i had to restore it :


from : /app/oracle/product/wcpoc/11.1.0/oracle_common/modules/oracle.jps_11.1.1/domain_config/system-jazn-data.xml

to /app/oracle/product/wcpoc/11.1.0/user_projects/domains/wc_poc/config/fmwconfig

and was finally able to restart the managed servers.
 
thanks to Oracle metalink: ID 1348704.1