私はWildflyで展開EARのために、このスキーマをしました:wildflyクラスローダーの問題
- EAR:
- ejbA.jar
- ejbB.jar
- libに
- LibInterfaceA.jar
- LibInterfac
- LibInterfaceA.jar
LibInterfaceA.jarがで使用される唯一のインターフェイスのライブラリであるLIB eB.jar
- ejb m odules(A adn B)とejbを注入するためのWARの中でLibInterfaceB.jarに拡張されています。私はLibInterfaceA内部のカスタム注釈を検索するとき
問題はJavaのリフレクションを使用することです:
public Annotation getAnnotazione(Method method, Class annotationType){ Annotation annotazioni[] = method.getAnnotations(); URL locationsearch = annotationType.getResource('/' + annotationType.getName().replace('.', '/') + ".class"); for(Annotation a : annotazioni){ Class klass = a.annotationType(); URL location = klass.getResource('/' + klass.getName().replace('.', '/') + ".class"); if(a.annotationType().getName().equals(annotationType.getName())){ return a; } } return null; }
私はannotationType = @カスタム注釈を見つけるために、WAR内のクラスでこのメソッドを呼び出します。 @CustomはWAR/lib/LibInterfaceA.jarのものです
LibInterfeceAのインターフェースを拡張するLibInterfaceBのインターフェースを実装するクラスでこのメソッドを呼び出すと、メソッドの@CustomというアノテーションはjarのEAR/libになります/LibInterfaceA.jarなので、クラスはクラスローディングの問題で異なっています。
どうすればこの問題を解決できますか?
私はやや混乱します。 2つの異なる場所にある2つのLibinterfaceA.jarは同じですか? –