sun.reflect.annotation.TypeNotPresentExceptionProxy error when deploy web-ear

后端 未结 7 502
说谎
说谎 2020-12-17 07:20

When I try to deploy ejd-ear, web-ear on to glassfish server. I added an ejb client dependency in web project. The ejb-ear deploys successfully. But when I try to deploy web

7条回答
  •  隐瞒了意图╮
    2020-12-17 08:17

    Had the same exception recently with JUnit. The situation was like this:

    @SuiteClasses({MyTestClass.class})
    public class MySuite {
        ...
    }
    

    Problem is that JVM was unable to process MyTestClass because it was missing dependencies in the classpath (another JAR file was missing). But the exception provided no information on which class was missing.

    Solution was to temporarily add a static initialization block to MySuite, that instantiates MyTestClass:

    @SuiteClasses({MyTestClass.class})
    public class MySuite {
        static {
            new MyTestClass();
        }
    }
    

    this causes JVM to run the static block first, try to instantiate MyTestClass, find out the missing class and report a proper exception. Then you can add the missing dependency and remove the temporary static block.

提交回复
热议问题