2016-05-26 60 views
1

我正在嘗試將使用seam 2.1.2的應用程序從JBoss 5.2遷移到JBoss 6.4 EAP。我將所有依賴於線縫的庫添加爲maven依賴項,現在我已經部署應用程序時沒有任何錯誤,接縫上下文似乎已成功創建(並且一些流程按預期工作)。IllegalArgumentException在注入接縫組件時

我偶然發現了一個問題,我希望有人能幫助建議。

我的耳朵結構如下:

myapp.ear 
| 
|--- warpck.war 
| 
|--- ejb.jar 
| 
|--- client1.jar 
| 
|--- client2.jar 
| 
|--- commons.jar 
| 
|--- loggers.jar 

在client1.jar我有以下的java bean定義:

@Name(CustomClient.NAME) 
@AutoCreate 
public class CustomClientImpl implements CustomClient { 
... 
} 

一個CustomClient界面看起來是這樣的:

public interface CustomClient extends GeneratedSoapClients { 

    String NAME = "customClient"; 

}  

在部署期間,我有以下日誌:

09:14:44,574 INFO [org.jboss.seam.Component] (ServerService Thread Pool -- 81) Component: customClient, scope: EVENT, type: JAVA_BEAN, class: myapp.client.impl.CustomClientImpl 

...所以我假設組件在接縫上下文中正確註冊。

問題是,當我嘗試將此組件注入到其中一個類形成ejb.jar包時。我收到以下錯誤:

09:14:49,319 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:8080-1) JBAS014134: EJB Invocation failed on component CustomAdapterWs for method public myapp.webservice.v5.CustomResponse myapp.webservice.impl.CustomAdapterWs.customInformation(myapp.webservice.v5.CustomInformation): javax.ejb.EJBException: java.lang.IllegalArgumentException: could not set field value: CustomAdapterController.customClient 

Caused by: java.lang.IllegalArgumentException: could not set field value: CustomAdapterController.customClient 
     at org.jboss.seam.Component.setFieldValue(Component.java:1927) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.Component.access$600(Component.java:126) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.Component$BijectedField.set(Component.java:2940) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.Component.injectAttributes(Component.java:1736) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.Component.inject(Component.java:1554) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam-2.1.2.jar:2.1.2] 
     at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam-2.1.2.jar:2.1.2] 



Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: CustomAdapterController.customClient on: myapp.controller.CustomAdapterController with value: class myapp.client.impl.CustomClientImpl_$$_javassist_seam_2 



Caused by: java.lang.IllegalArgumentException: Can not set myapp.client.CustomClient field myapp.controller.CustomAdapterController.customClient to myapp.client.impl.CustomClientImpl_$$_javassist_seam_2 

的CustomAdapterController:

@Name(CustomAdapterController.NAME) 
@AutoCreate 
public class CustomAdapterController { 

    public static final String NAME = "CustomAdapterController"; 

    @In(value = CustomClient.NAME) 
    private CustomClient customClient; 

,我使用(它在EAR POM加)的Javassist是依賴:

<dependency> 
     <groupId>org.javassist</groupId> 
     <artifactId>javassist</artifactId> 
     <version>3.20.0-GA</version> 
    </dependency> 

了JBoss,部署 - structure.xml:

<jboss-deployment-structure> 
<ear-subdeployments-isolated>false</ear-subdeployments-isolated> 

<deployment> 
    <exclusions> 
     <module name="org.hibernate" slot="main"/> 
     <module name="org.javassist" slot="main"/> 
    </exclusions> 
    <dependencies> 
     <module name="javax.faces.api" slot="1.2" export="true"/> 
     <module name="com.sun.jsf-impl" slot="1.2" export="true"/> 
     <module name="org.apache.log4j" export="true"/> 
     <module name="org.dom4j" export="true"/> 
     <module name="org.apache.commons.logging" export="true"/> 
     <module name="org.apache.commons.collections" export="true"/> 
    </dependencies> 
</deployment> 

<sub-deployment name="warpck.war"> 
    <exclusions> 
     <module name="javax.faces.api" slot="main"/> 
     <module name="com.sun.jsf-impl" slot="main"/> 
    </exclusions> 
    <dependencies> 
     <module name="javax.faces.api" slot="1.2"/> 
     <module name="com.sun.jsf-impl" slot="1.2"/> 
    </dependencies> 
</sub-deployment> 

<sub-deployment name="ejb.jar"> 
    <dependencies> 
     <module name="client1.jar"/> 
    </dependencies> 
</sub-deployment> 

</jboss-deployment-structure> 

所有在ejb.jar中定義的組件都被正確注入。每次我嘗試注入一個在differenect包中定義的bean時,都會出現這個問題。誰能告訴我我在這裏失蹤了什麼?

回答