我是网络服务编程中的另一个面对未知错误的noobie:
我正在尝试使用JaxWsDynamicClientFactory来动态调用所请求的服务(服务的地址及其参数是从文件中读取的,但这与此无关)。
问题是由JaxWsDynamicClientFactory的标准初始化引起的。
JaxWsDynamicClientFactory dcf= JaxWsDynamicClientFactory.newInstance();
执行此行后,Karaf(Felix)返回以下错误:
java.lang.IllegalArgumentException: Can not set final com.sun.tools.internal.xjc
.reader.internalizer.InternalizationLogic field com.sun.tools.internal.xjc.reade
r.internalizer.DOMForest.logic to org.apache.cxf.endpoint.dynamic.DynamicClientF
actory$1
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(
UnsafeFieldAccessorImpl.java:146)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(
UnsafeFieldAccessorImpl.java:150)
at sun.reflect.UnsafeQualifiedObjectFieldAccessorImpl.set(UnsafeQualifie
dObjectFieldAccessorImpl.java:65)
at java.lang.reflect.Field.set(Field.java:657)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.hackInNewInterna
lizationLogic(DynamicClientFactory.java:817)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dyn
amicClientFactory.java:314)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dyn
amicClientFactory.java:270)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dyn
amicClientFactory.java:263)
at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(Dyn
amicClientFactory.java:198)
at testclient.BundleInvoker.invoke(BundleInvoker.java:53)
at testclient.TestClient.activate(TestClient.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.j
ava:236)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.jav
a:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMetho
d.java:613)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:49
6)
at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod
.java:149)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImp
lementationObject(ImmediateComponentManager.java:239)
at org.apache.felix.scr.impl.manager.ImmediateComponentManager.createCom
ponent(ImmediateComponentManager.java:119)
at org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfie
d.activate(AbstractComponentManager.java:1518)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateIn
ternal(AbstractComponentManager.java:550)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(Abs
tractComponentManager.java:261)
at org.apache.felix.scr.impl.config.ImmediateComponentHolder.enableCompo
nents(ImmediateComponentHolder.java:328)
at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleC
omponentActivator.java:158)
at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleCompo
nentActivator.java:113)
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:261
)
at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:179)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEv
ent(BundleContextImpl.java:847)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventM
anager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchr
onous(ListenerQueue.java:148)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent
Privileged(Framework.java:1569)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent
(Framework.java:1505)
at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent
(Framework.java:1500)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(Bundl
eHost.java:391)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(Abstrac
tBundle.java:300)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(Di
rectoryWatcher.java:1247)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(D
irectoryWatcher.java:1219)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundle
s(DirectoryWatcher.java:1208)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(Direct
oryWatcher.java:503)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryW
atcher.java:291)
事实上,我对以下执行没有任何问题(程序继续没有任何影响),但我想从屏幕上删除这个讨厌的错误堆栈。我试图通过try-catch环境隐藏错误,但Karaf只是忽略它(即,不会触发catch部分,尽管打印整个堆栈)。
你能帮助我解决这个问题(或者至少有助于理解为什么这条简单的线会产生它)?
总的来说。代码在Eclipse Kepler中创建,使用Maven 2构建,并在Karaf(felix)中执行。这是pom文件中的依赖部分:
<dependencies>
<dependency>
<groupId>my.test.bundle</groupId>
<artifactId>test-interface</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>1.8.0</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.4.0</version>
<type>bundle</type>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.8</version>
</dependency>
</dependencies>
答案 0 :(得分:0)
正如CXF website所述!
请注意,通常,CXF仅支持WSI-BP服务。如果您尝试创建 对于使用WSI-BP之外的功能的WSDL的动态客户端,CXF可能会抛出异常。
这可能是你的问题。如果您右键单击绑定并选择:检查WSI合规性
,请使用SOAPUI等工具进行检查答案 1 :(得分:0)
在为WS-I符合的WSDL创建动态客户端时,我得到了相同的异常java.lang.IllegalArgumentException。我相信这里报告的问题是:
IllegalArgumentException when using JaxWsDynamicClientFactory
是原因。