2012-09-27 5 views
1

글래스 피쉬 3.1을 처음으로 사용하고 있습니다.배포 후 CDI 인터셉터 글래스 피시 NullPointer

META-INF\beans.xml 파일을 만든 후에는 배포가 실패합니다.

@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> 
를 @WebServlet

글래스 피시에서 오류 세부 정보를 찾을 위치를 알 수 없습니다. 도와주세요.

배포 오류 : 나는 글래스 피쉬 서버에서 다시 시작하고 새 배포, 응용 프로그램이 작동 한 후 내 응용 프로그램의 모든 항목을 삭제 한

[#|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|#] 
+0

어떤 버전의 GlassFish? 또한 붙여 넣기되지 않은 다른 부분이있는 것처럼 로그 파일에 더 많은 내용이 있어야하는 것처럼 보입니다. – LightGuard

+0

안녕하세요 LightGuard, 버전은 glassfish3.1입니다. 불행히도 server.log에 더 이상 오류가 없습니다. "내가 glassfish에서 더 많은 오류 정보를 찾을 수있는 곳" – PeterR

답변

1

.

BTW : @WebServlet 메서드를 사용하여 EJB 메서드와 함께 사용할 때 @Audit 인터셉터가 호출됩니다. 호출되지 않은 인터셉터입니다. 나는 새로운 질문을 게시 할 것이다.

관련 문제