[jboss-user] [JBoss AOP] - NullPointerException problem and no trace of the interceptor

laurentSalse do-not-reply at jboss.com
Fri Jun 1 12:12:38 EDT 2007


Hi M. KAHN,


It's still me.
As you may understand, I'm a beginner in programmation. I've test the example "injboss".
There's no deployement of the AOP. The result is : 

17:28:54,718 INFO  [STDOUT] **** BasicExampleServlet.service()
17:28:54,718 INFO  [STDOUT] **** ExampleValue String Constructor
17:28:54,718 INFO  [STDOUT] **** ExampleValue.getMessage()

There no trace of the interceptor.

Otherwise, for my project, I've deleted JBoss server and re-install it.

I've re-loaded a clean project on svn.

I've verified that I've the good version of JBoss AOP. I've added the good libraries (JBoss AOP 1.5.5 version) in the project

I haven't convert the project to an AOP project.

I put : true
and in the run.bat file as usual: set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME% -javaagent:pluggable-instrumentor.jar

In fact I've followed the advice of the "10.3.3. JBoss 4.x and JDK 5" part in the reference document and  I've read carefully the JBoss forum.

I haven't found any either explanations for an AOP project which run on a JBoss server.

When I apply the javap command on the target file, there's no org.jboss.aop.Advised implementation.

I give you the console error : 

--- MBeans waiting for other MBeans ---
ObjectName: jboss.aop:service=AspectManager
  State: FAILED
  Reason: java.lang.NullPointerException

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.aop:service=AspectManager
  State: FAILED
  Reason: java.lang.NullPointerException

(When I execute the run.bat of the server, there's no errors but there's still no trace of the interceptor)



I give you the interceptor code : 


package com.fitnetapplication.aop.interceptors;

import org.apache.log4j.Logger;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.ConstructorInvocation;
import org.jboss.aop.joinpoint.FieldInvocation;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.joinpoint.MethodInvocation;


public class LoggerInterceptor implements Interceptor{

		private static Logger log = Logger.getLogger(LoggerInterceptor.class); 

		public Object invoke (Invocation invocation) throws Throwable { 

		if (invocation instanceof MethodInvocation){ 
		MethodInvocation method = (MethodInvocation) invocation; 
		log.info("Method: " + method.getActualMethod() + " invoked."); 
		System.out.println("Method: " + method.getActualMethod() + " invoked."); 
		} 

		if (invocation instanceof FieldInvocation){ 
		FieldInvocation field = (FieldInvocation) invocation; 
		log.info("Field: " + field.getField() + " invoked."); 
		System.out.println("Field: " + field.getField() + " invoked."); 
		} 

		if (invocation instanceof ConstructorInvocation){ 
		ConstructorInvocation constructor = (ConstructorInvocation) invocation; 
		log.info("Constructor: " + constructor.getConstructor() + " invoked."); 
		System.out.println("Constructor: " + constructor.getConstructor() + " invoked."); 
		} 

		return invocation.invokeNext(); 
		}

		public String getName() {
			return "LoggerInterceptor"; // Par convention nous mettons le nom de la classe 
		}		
}

the JBoss-aop.xml code : 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

   	
        
    
    



The Jboss-service.xml which is there : \jboss-4.0.5.GA\server\default\deploy\jboss-aop-jdk50.deployer\META-INF
This file is directly concerned by the console error.


  <?xml version="1.0" encoding="UTF-8" ?> 
- <!--  $Id: jboss-service.xml 44143 2006-04-24 18:19:21Z kkhan $ 
  --> 
- <!--  ===================================================================== 
  --> 
- <!--   JBoss Server Configuration                                           
  --> 
- <!--  ===================================================================== 
  --> 
- 

- 
  true 
  
  true 
  true 
  org.jboss.test, org.jboss.injbossaop 
  org.jboss. 
  true 
  false 
  
   
  

Finally, with all the configuration, the project (like the injboss project) goes but without trace of the interceptor

Coud you continue to help me please ?

Thank you very much


Didier ROCK




	



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050540#4050540

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050540



More information about the jboss-user mailing list