【问题标题】:CDI Interceptor Glassfish after deploy NullPointer部署 NullPointer 后的 CDI 拦截器 Glassfish
【发布时间】:2012-09-19 16:56:52
【问题描述】:

我是第一次玩 glassfish 3.1。

创建META-INF\beans.xml文件后,部署失败。

@WebServlet

@Override
@Audit
protected void service(HttpServletRequest req, HttpServletResponse res)
        throws IOException, ServletException {
    PrintWriter writer = res.getWriter();
    writer.write("Hello!");

}

注解@Audit

@Inherited  
@InterceptorBinding  
@Retention(RetentionPolicy.RUNTIME)  
@Target({ElementType.METHOD, ElementType.TYPE}) 

public @interface Audit {
}

审计实施

@Interceptor
@Audit
public class AuditImpl {
     @AroundInvoke  
     public Object auditting(InvocationContext context) throws Exception {  
     System.out.println("Log before method call...");  
     Object returnObject = context.proceed();  
            // to do some logging  
     System.out.println("Log after method call...");  
     return returnObject;  
     } 
}

META-INF/beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
  http://java.sun.com/xml/ns/javaee 
  http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
 <interceptors>
    <class>xyz.AuditImpl</class>
 </interceptors>
</beans>

我不知道在哪里可以找到 Glassfish 中的错误详细信息。 请帮忙。

部署错误:

[#|2012-09-27T21:43:31.010+0200|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=55;_ThreadName=Thread-1;|Exception while invoking class org.glassfish.weld.WeldDeployer load method
java.lang.NullPointerException
    at org.glassfish.weld.BeanDeploymentArchiveImpl.handleEntry(BeanDeploymentArchiveImpl.java:489)
    at org.glassfish.weld.BeanDeploymentArchiveImpl.collectJarInfo(BeanDeploymentArchiveImpl.java:473)
    at org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:413)
    at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:148)
    at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:128)
    at org.glassfish.weld.DeploymentImpl.<init>(DeploymentImpl.java:120)
    at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:334)
    at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:99)
    at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:186)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:249)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
    at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:145)
    at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:577)
    at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:463)
    at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:395)
    at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
    at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:213)
    at java.util.TimerThread.mainLoop(Timer.java:512)
    at java.util.TimerThread.run(Timer.java:462)
|#]

[#|2012-09-27T21:43:31.010+0200|SEVERE|glassfish3.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=55;_ThreadName=Thread-1;|Exception while loading the app|#]

[#|2012-09-27T21:43:31.016+0200|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=55;_ThreadName=Thread-1;|Exception while loading the app|#]

【问题讨论】:

  • 哪个版本的 GlassFish?似乎该日志文件应该还有更多内容,例如还有其他一些未粘贴的部分。
  • 你好 LightGuard,版本是 glassfish3.1。不幸的是,server.log 中没有更多错误 - 这就是我要问的“在 glassfish 中哪里可以找到更多错误信息”

标签: jakarta-ee deployment glassfish-3 cdi interceptor


【解决方案1】:

我已经清除了 glassfish 服务器中所有出现的应用程序,并且在重新启动和新部署后,应用程序可以正常工作。

顺便说一句:我的@Audit 拦截器在与 EJB 方法一起使用时被调用,@WebServlet 方法是我的拦截器未被调用。我将发布新问题。

【讨论】:

    猜你喜欢
    • 2020-06-17
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 2015-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多