1

我们在码头服务器上的项目并完全工作,然后这个项目部署在 Glassfish 服务器上,但这里有一些错误。

像记录器和一些东西等。

错误 ::

    [#|2012-06-27T17:14:18.710+0530|SEVERE|glassfish3.1.2|org.apache.catalina.core.ContainerBase|_ThreadID=52;_ThreadName=AutoDeployer;|ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5332)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:353)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
        at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:145)
        at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:575)
        at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:461)
        at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:389)
        at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
        at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:220)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
        at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2743)
        at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:1966)
        at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:235)
        at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:94)
        at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:274)
        at com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:172)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5329)
        ... 26 more
Caused by: javax.servlet.ServletException: java.lang.ExceptionInInitializerError
        at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2853)
        at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:4806)
        at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1599)
        at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2740)
        ... 33 more
Caused by: java.lang.ExceptionInInitializerError
        at org.apache.log4j.Logger.getLogger(Logger.java:118)
        at mwp.slktechlabs.web.SessionListener.<clinit>(SessionListener.java:35)
        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:525)
        at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:307)
        at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:761)
        at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:1987)
        at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2851)
        ... 36 more
Caused by: java.lang.SecurityException: Access to default session denied
        at javax.mail.Session.getDefaultInstance(Session.java:320)
        at mwp.slktechlabs.log.SMTPSSLAppender.createSession(SMTPSSLAppender.java:31)
        at org.apache.log4j.net.SMTPAppender.activateOptions(SMTPAppender.java:121)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:133)
        at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:97)
        at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:689)
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:647)
        at org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:568)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:442)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
        ... 46 more
|#]

mwp 是我们的项目和记录器错误。

Caused by: java.lang.ExceptionInInitializerError
        at org.apache.log4j.Logger.getLogger(Logger.java:118)
        at mwp.slktechlabs.web.SessionListener.<clinit>(SessionListener.java:35)

和行号:35 是

private static final Logger logger = Logger.getLogger(SessionListener.class);

在 mwp.slktechlabs.web.SessionListener.java 文件中。

所以请帮忙,如何消除这个错误?

谢谢,

卡姆莱什

4

1 回答 1

1

您已将记录器配置为也使用电子邮件传输。

原因:java.lang.SecurityException:在 mwp.slktechlabs.log.SMTPSSLAppender.createSession(SMTPSSLAppender.java:31) 的 javax.mail.Session.getDefaultInstance(Session.java:320) 拒绝访问默认会话

安全管理器不允许在您的配置中使用它,因此您应该重新配置记录器以不发送电子邮件,或重新配置安全管理器以允许这样做。

于 2012-06-27T12:44:14.200 回答