2 Replies Latest reply on Mar 6, 2004 7:15 AM by Gennadi Bereschneu

    Running DR2 troubles

    Gennadi Bereschneu Newbie

      I just try to run my HelloWorld under DR2. With DR1 everithing is perefect. With this new version I get only

      java.lang.NoClassDefFoundError: test/hello/HelloWorld
      Exception in thread "main"...
      

      When the class is outside package - no problem. Only when I try to put my class in package it's come.

      Any ideas?

        • 1. Re: Running DR2 troubles
          Bill Burke Master

          code please? How are you running?

          FYI, if you can wait, DR3 is in two weeks. Unfortunately though, it is a complete revamp in the XML department.

          Bill

          • 2. Re: Running DR2 troubles
            Gennadi Bereschneu Newbie

            The problem is solved - i run it under eclipce, and after switching to the DR2 i need to reassign run-parms for this task. BTW...

            In DR1 I can't define method-pointcut instead pre-defined interceptor-pointcut. Whis same syntax it's working same. But....
            ..after definition <method-pointcut> (see code) my Interceptor don't get control anymore? What is wrong?

            jbossaop.xml:

            <?xml version="1.0" encoding="UTF-8"?>
            <aop xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jbossaop.xsd">
             <advisable class="test.hello.HelloWorld" fieldFilter="ALL" methodFilter="say.*" />
             <method-pointcut group="localization" class="test.hello.HelloWorld" methodName="say.*">
             <interceptors>
             <interceptor class="test.hello.jbossaop.Localization"/>
             </interceptors>
             </method-pointcut>
            <!--
             <interceptor-pointcut class="test.hello.HelloWorld">
             <interceptors>
             <interceptor class="test.hello.jbossaop.Localization"/>
             </interceptors>
             </interceptor-pointcut>
            -->
            </aop>
            
            


            HelloWorld.java
            package test.hello;
            public class HelloWorld {
             public static void main(String[] args) {
             HelloWorld helloworldTmp = new HelloWorld();
             helloworldTmp .say("Hello", args[0]);
             }
             public void say(String message){
             System.out.println(message);
             }
             public void say(String message, String name){
             say (message + " " + name);
             }
            }
            


            Localization.java
            package test.hello.jbossaop;
            
            import org.jboss.aop.Interceptor;
            import org.jboss.aop.Invocation;
            import org.jboss.aop.InvocationResponse;
            import org.jboss.aop.InvocationType;
            import org.jboss.aop.MethodInvocation;
            
            public class Localization implements Interceptor {
            
             public String getName() {
             // TODO Auto-generated method stub
             return "sdfsdfadsfsd";
             }
            
             public InvocationResponse invoke(Invocation invocation) throws Throwable {
             System.out.println("intercept started!");
             if (invocation.getType() == InvocationType.METHOD){
             MethodInvocation mi = (MethodInvocation )invocation;
             if (mi.arguments.length==2){
             mi.arguments[1]="translated:"+mi.arguments[1];
             }
             }
             // TODO Auto-generated method stub
             InvocationResponse ir = invocation.invokeNext();
             return ir;
             }
            }