1

Glassfish3.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|#]
4

1 に答える 1

1

Glassfishサーバーで発生するすべてのアプリケーションをクリアし、再起動して新しいデプロイを行った後、アプリケーションが機能します。

ところで:私の@Auditインターセプターは、EJBメソッドで使用されるときに呼び出されますが、@ WebServletメソッドは、呼び出されない私のインターセプターです。新しい質問を投稿します。

于 2012-09-30T15:30:21.347 に答える