0

I am a one more noobie in web service programming who faced an unknown error:

I am trying to use JaxWsDynamicClientFactory in order to invoke dynamically the requested service (the address of the service and its parameters are read from a file, but this is irrelevant here).

The problem is caused by this standard initialisation of JaxWsDynamicClientFactory.

JaxWsDynamicClientFactory dcf= JaxWsDynamicClientFactory.newInstance();

After execution of this line Karaf (Felix) returns the following error:

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)

In fact, I have no problem with the following execution (the program continue without any effect), but I would like to remove this nasty stack of errors from the screen. I tried to hide the error by try-catch environment, but Karaf simply ignores it (i.e., does not trigger catch part, although prints the whole stack).

Could you help me to solve the problem (or at least help to understand why this simple line generates it)?

In general. Code is created in Eclipse Kepler, built with Maven 2, and executed in Karaf (felix). Here is the dependency part from the pom file:

<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>
Artsiom
  • 1
  • 2

2 Answers2

0

As stated on the CXF website!

Note that, in general, CXF only supports WSI-BP services. If you attempt to create a dynamic client for a WSDL that uses features outside of WSI-BP, CXF may throw an exception.

This might be your problem. Check it with tools like SOAPUI were you right-click the binding and select : Check WSI Compliance

EMBEE
  • 1
  • 1
0

I get the same exception, java.lang.IllegalArgumentException, when creating a dynmaic client for a WSDL that is WS-I conformant. I believe the problem reported here :

IllegalArgumentException when using JaxWsDynamicClientFactory

is the reason.

Morten Banzon
  • 33
  • 1
  • 8