Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6613

java.lang.NoSuchFieldError: REFLECTION in CFX 3.1.4-SNAPSHOT

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.1.4
    • Fix Version/s: 3.1.4
    • Component/s: Core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I think that i found a bug in CXF 3.1.4-SNAPSHOT - when i'm try to launch my dynamic client to simple mock service(generated in Soapui) i got:

      Exception in thread "main" java.lang.NoSuchFieldError: REFLECTION
      	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:89)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:456)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:202)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:172)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:334)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:394)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:241)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:234)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:189)
      	at pl.nbp.traverse.Main.main(Main.java:33)
      

      Full log (DEBUG):

      2015-09-28 15:59:12 DEBUG LogUtils - Using org.apache.cxf.common.logging.Log4jLogger for logging.
      2015-09-28 15:59:12 DEBUG DynamicClientFactory - Creating client from WSDL https://localhost:1081/?WSDL
      2015-09-28 15:59:12 DEBUG DefaultResourceManager - resolving resource <org.apache.cxf.wsdl11.WSDLManagerImpl/bus> type <interface org.apache.cxf.Bus>
      2015-09-28 15:59:12 DEBUG DefaultResourceManager - resolving resource <null> type <interface org.apache.cxf.Bus>
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been (re)configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Auth Supplier configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@27cd61b
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The location of the key store has not been set via a system parameter or through configuration so the default value of /home/osbdev/.keystore will be used.
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The key store password has not been set via a system property or through configuration, reading data from the keystore will fail.
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The key password has not been set via a system property or through configuration, reading data from the keystore will fail.
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The cipher suites have been set to [Ljava.lang.String;@520d8436.  
      2015-09-28 15:59:13 DEBUG Headers - Accept: */*
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'. An afirmative Trust Decision is assumed.
      2015-09-28 15:59:13 WARN  StaxUtils - Could not create a secure Stax XMLInputFactory.  Found class com.ctc.wstx.stax.WstxInputFactory.  Suggest Woodstox 4.2.0 or newer.
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been (re)configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Auth Supplier configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@4a3a051f
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The cipher suites have been set to [Ljava.lang.String;@67de324d.  
      2015-09-28 15:59:13 DEBUG Headers - Accept: */*
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'. An afirmative Trust Decision is assumed.
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been (re)configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Auth Supplier configured for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'
      2015-09-28 15:59:13 DEBUG HTTPConduit - Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit' has been configured for plain http.
      2015-09-28 15:59:13 DEBUG HTTPConduit - registering incoming observer: org.apache.cxf.transport.TransportURIResolver$1@3185a34
      2015-09-28 15:59:13 DEBUG HttpsURLConnectionFactory - The cipher suites have been set to [Ljava.lang.String;@33ca0d82.  
      2015-09-28 15:59:13 DEBUG Headers - Accept: */*
      2015-09-28 15:59:13 DEBUG HTTPConduit - No Trust Decider for Conduit '{http://cxf.apache.org}TransportURIResolver.http-conduit'. An afirmative Trust Decision is assumed.
      2015-09-28 15:59:13 DEBUG WSDLServiceBuilder - Operation {http://www.examples.com/wsdl/HelloService.wsdl}sayHello cannot be unwrapped, input message must reference global element declaration with same localname as operation
      2015-09-28 15:59:14 INFO  DynamicClientFactory - Created classes: com.examples.wsdl.helloservice.ObjectFactory, com.examples.wsdl.helloservice.StringAndIntComplexType, com.examples.wsdl.helloservice.StringComplexType
      Exception in thread "main" java.lang.NoSuchFieldError: REFLECTION
      	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.<init>(RuntimeModelBuilder.java:89)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:456)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
      	at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
      	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:202)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:172)
      	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
      	at javax.xml.bind.ContextFinder.find(ContextFinder.java:334)
      	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:394)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:241)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:234)
      	at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:189)
      	at pl.nbp.traverse.Main.main(Main.java:33)
      

      My pom:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      	<modelVersion>4.0.0</modelVersion>
      
      	<groupId>pl.nbp</groupId>
      	<artifactId>traverse</artifactId>
      	<version>4.0</version>
      	<packaging>jar</packaging>
      
      	<name>${project.artifactId}</name>
      
      	<build>
      		<plugins>
      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-compiler-plugin</artifactId>
      				<version>3.3</version>
      				<configuration>
      					<source>${targetJdk}</source>
      					<target>${targetJdk}</target>
      				</configuration>
      			</plugin>
      			<plugin>
      				<groupId>org.apache.maven.plugins</groupId>
      				<artifactId>maven-shade-plugin</artifactId>
      				<version>2.4.1</version>
      				<executions>
      					<execution>
      						<phase>package</phase>
      						<goals>
      							<goal>shade</goal>
      						</goals>
      						<configuration>
      							<filters><!-- bez tego java.lang.SecurityException: Invalid signature 
      									file digest for Manifest main attributes -->
      								<filter>
      									<artifact>*:*</artifact>
      									<excludes>
      										<exclude>META-INF/*.SF</exclude>
      										<exclude>META-INF/*.DSA</exclude>
      										<exclude>META-INF/*.RSA</exclude>
      									</excludes>
      								</filter>
      							</filters>
      							<transformers>
      								<transformer
      									implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
      									<mainClass>pl.nbp.traverse.Main</mainClass>
      								</transformer>
      							</transformers>
      						</configuration>
      					</execution>
      				</executions>
      			</plugin>
      		</plugins>
      		<resources>
      			<resource>
      				<directory>src/main/resources</directory>
      				<filtering>true</filtering>
      			</resource>
      		</resources>
      	</build>
      	<properties>
      		<targetJdk>1.7</targetJdk>
      		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      		<logger>org.apache.log4j.ConsoleAppender</logger>
      		<logger.severity>DEBUG</logger.severity><!-- DEBUG, INFO -->
      		<do.i.need.dev.osb>TRUE</do.i.need.dev.osb>
      		
      		<cxf.version>3.1.4-SNAPSHOT</cxf.version>
      		<!-- cxf.version>3.0.0-SNAPSHOT</cxf.version-->
      		
      		<ws.CHANNEL_SECURITY_TIME_TO_LIVE>300</ws.CHANNEL_SECURITY_TIME_TO_LIVE>
      		<ws.KEY_STORE_FILE>all.jks</ws.KEY_STORE_FILE>
      		<ws.KEY_STORE_FILE_PASSWORD>Soatest2012</ws.KEY_STORE_FILE_PASSWORD>
      		<ws.CHANNEL_RECIPIENT_SERVER_ALIAS>soatest@nbp.pl</ws.CHANNEL_RECIPIENT_SERVER_ALIAS>
      	</properties>
      
      	<dependencies>
      		<!-- <cxf.version>3.1.4-SNAPSHOT</cxf.version> -->
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-frontend-jaxws</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-transports-http</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-core</artifactId>
      			<version>2.7.9</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-ws-security</artifactId>
      			<version>3.1.3</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-transports-http-jetty</artifactId>
      			<version>3.1.3</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-common-utilities</artifactId>
      			<version>2.5.9</version>
      		</dependency>
      		
      		<!-- <cxf.version>3.0.0-SNAPSHOT</cxf.version> -->
      		<!-- 
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-frontend-jaxws</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-transports-http</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-transports-http-jetty</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-core</artifactId>
      			<version>${cxf.version}</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-rt-ws-security</artifactId>
      			<version>2.8.0-SNAPSHOT</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.cxf</groupId>
      			<artifactId>cxf-common-utilities</artifactId>
      			<version>2.5.12-SNAPSHOT</version>
      		</dependency>
      		-->
      		
      		<dependency>
      			<groupId>org.apache.ws.security</groupId>
      			<artifactId>wss4j</artifactId>
      			<version>1.6.9</version>
      		</dependency>
      		<dependency>
      			<groupId>org.apache.commons</groupId>
      			<artifactId>commons-lang3</artifactId>
      			<version>3.4</version>
      		</dependency>
      		<dependency>
      			<groupId>org.membrane-soa</groupId>
      			<artifactId>service-proxy-core</artifactId>
      			<version>4.1.0</version>
      		</dependency>
      		<!-- wymagane przez CXF - nie jawnie -->
      		<dependency>
      			<groupId>com.eviware.soapui</groupId>
      			<artifactId>bcprov-jdk15-144</artifactId>
      			<version>4.5.1</version>
      		</dependency>
      	</dependencies>
      </project>
      

      My client

      public static void main(String[] args) {
      		final String uri = "https://localhost:1081/?WSDL";
      		Properties properties = System.getProperties(); 
      		properties.put("org.apache.cxf.stax.allowInsecureParser","1");
      		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
      		Client client = dcf.createClient(uri);
      		
      		try
      		{
      			Object StringAndIntComplexType = Thread.currentThread().getContextClassLoader().loadClass("com.examples.wsdl.helloservice.StringAndIntComplexType").newInstance();
      		 
      			Method setString = StringAndIntComplexType.getClass().getMethod("setString", String.class);
      			Method setInt = StringAndIntComplexType.getClass().getMethod("setInt", int.class);
      
      			setString.invoke(StringAndIntComplexType, "Joe Schmoe");
      			setInt.invoke(StringAndIntComplexType, 1);
      		 
      			Object[] objects = client.invoke("sayHello", StringAndIntComplexType);
      			for(int i=0; i < objects.length; i++)
      			{
      				System.out.println("An object: "+ToStringBuilder.reflectionToString(objects[i]));
      			}
      		}
      		catch(Exception e)
      		{
      			e.printStackTrace();
      		}
      		CreateTemplates(uri);
      	}
      

      Endpoint is protected with SSL and i'm using WS-Security, on version 3.0.0-SNAPSHOT everything works fine.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              h3x0r Sebastian Krupa
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: