1 Reply Latest reply: Jul 8, 2012 9:13 PM by jimcpl RSS

    OAM 11g SDK in Servlet causes NullPointerException during startup

    jimcpl
      Hi,

      I am implementing a servlet, based on the LoginServlet example here:

      http://docs.oracle.com/cd/E23943_01/doc.1111/e12491/as_api.htm#autoId21

      I'm deploying this onto Tomcat 6.0.35, and it works, but, if I add <load-on-startup> to the application's web.xml in order to have the servlet's init() method called at startup (rather than when it processes the 1st request), I am getting two NullPointerExceptions:


      java.util.logging.ErrorManager: 5
      java.lang.NullPointerException
      at java.util.ListResourceBundle.handleGetObject(ListResourceBundle.java:109)
      at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
      at java.util.ResourceBundle.getString(ResourceBundle.java:334)
      at java.util.logging.Formatter.formatMessage(Formatter.java:108)
      at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:63)
      at org.apache.juli.FileHandler.publish(FileHandler.java:198)
      at java.util.logging.Logger.log(Logger.java:478)
      at java.util.logging.Logger.doLog(Logger.java:501)
      at java.util.logging.Logger.log(Logger.java:524)
      at oracle.security.am.common.nap.util.NAPLogger.log(NAPLogger.java:60)
      at oracle.security.am.common.nap.util.pool.ObjectPoolManager.shutdown(ObjectPoolManager.java:267)
      at oracle.security.am.common.aaaclient.ObAAAServiceClient.close(ObAAAServiceClient.java:1239)
      at oracle.security.am.common.aaaclient.ObAAAServiceClient.finalize(ObAAAServiceClient.java:2548)
      at jrockit.memory.Finalizer.doFinalize(Finalizer.java:29)
      at jrockit.memory.Finalizer.access$300(Finalizer.java:12)
      at jrockit.memory.Finalizer$4.run(Finalizer.java:186)
      at java.lang.Thread.run(Thread.java:662)
      java.util.logging.ErrorManager: 5
      java.lang.NullPointerException
      at java.util.ListResourceBundle.handleGetObject(ListResourceBundle.java:109)
      at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
      at java.util.ResourceBundle.getString(ResourceBundle.java:334)
      at java.util.logging.Formatter.formatMessage(Formatter.java:108)
      at java.util.logging.SimpleFormatter.format(SimpleFormatter.java:63)
      at java.util.logging.StreamHandler.publish(StreamHandler.java:179)
      at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:88)
      at java.util.logging.Logger.log(Logger.java:478)
      at java.util.logging.Logger.doLog(Logger.java:501)
      at java.util.logging.Logger.log(Logger.java:524)
      at oracle.security.am.common.nap.util.NAPLogger.log(NAPLogger.java:60)
      at oracle.security.am.common.nap.util.pool.ObjectPoolManager.shutdown(ObjectPoolManager.java:267)
      at oracle.security.am.common.aaaclient.ObAAAServiceClient.close(ObAAAServiceClient.java:1239)
      at oracle.security.am.common.aaaclient.ObAAAServiceClient.finalize(ObAAAServiceClient.java:2548)
      at jrockit.memory.Finalizer.doFinalize(Finalizer.java:29)
      at jrockit.memory.Finalizer.access$300(Finalizer.java:12)
      at jrockit.memory.Finalizer$4.run(Finalizer.java:186)
      at java.lang.Thread.run(Thread.java:662)
      Jul 7, 2012 11:37:57 PM org.apache.coyote.http11.Http11Protocol start
      INFO: Starting Coyote HTTP/1.1 on http-8080

      If I remove the <load-on-startup> from the web.xml, or if I use the Tomcat manager app to stop then start the servlet, I don't get those exceptions.

      It appears that the shutdown() method in the ObjectPoolManager class is being called some time after the init() method in my servlet has finished, and then NapLogger is trying to log something, and then the exception(s) occur.

      Has anyone used the 11g ASDK in a servlet, and had this problem? If so, how to resolve it?

      Thanks,
      Jim