Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Tomcat 8.5.x problem with stax2  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I use Tomcat 8.5.15 (I try also with 8.5.35) and my ENV is this:
Server version:        Apache Tomcat/8.5.15
Server built:          May 5 2017 11:03:04 UTC
Server number:         8.5.15.0
OS Name:               Linux
OS Version:            3.10.0-862.9.1.el7.x86_64
Architecture:          amd64
Java Home:             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-0.el7_5.x86_64/jre
JVM Version:           1.8.0_191-b12
JVM Vendor:            Oracle Corporation

I build my WebService with jaxws version 2.2.7 and I use SoapHandler for print in my log the Request and Response SOAP; in particular case after the Response SOAP i get the follow exception:

15-Nov-2018 17:36:37.693 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 3760 ms
15-Nov-2018 17:37:40.624 SEVERE [http-nio-8080-exec-1] com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet caught throwable
java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
       at com.ctc.wstx.sw.OutputElementBase.getPrefixes(OutputElementBase.java:358)
       at com.sun.xml.ws.util.DOMUtil.isPrefixDeclared(DOMUtil.java:223)
       at com.sun.xml.ws.util.DOMUtil.writeTagWithAttributes(DOMUtil.java:158)
       at com.sun.xml.ws.message.saaj.SAAJMessage.writeTo(SAAJMessage.java:372)
       at com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:199)
       at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:134)
       at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:242)
       at com.sun.xml.ws.transport.http.HttpAdapter.encodePacket(HttpAdapter.java:432)
       at com.sun.xml.ws.transport.http.HttpAdapter.access$100(HttpAdapter.java:100)
       at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:661)
       at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:264)

In my war I force the lib stax2-api-4.0.0.jar, the first version with the correct getInstance method, but the class org.codehaus.stax2.ri.EmptyIterator loaded is in old version .

I resolve the problem with downgrade lib jaxws-rt to 2.2.5 but i do not undestand the reason why with jaxws-rt 2.2.7 obtain the exception upon.

I search in the almost all jars in tomcat dir and open-jdk dir but i do not find the same class org.codehaus.stax2.ri.EmptyIterator in different version.

Someone can give me an explanation ?

Thank you in advance for your toime and your response

 
Bartender
Posts: 19988
95
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This wouldn't be a Tomcat probablem. At least, not unless you are corrupting the Tomcat library environment.

Normally you see this kind of problem when you have compiled an app using one version of the library, but in your runtime environment (for a webapp, that's /WEB-INF/lib/) you have a different version of the library.
 
jenko petronio
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

thank you for your answer.

I had already verified into my WE-INF/lib of my war with the follow command:
find . -name "*.jar" -ls -exec jar -tvf {} \; | grep '\.jar\|EmptyIterator'

and the only single class org.codehaus.stax2.ri.EmptyIterator in jar stax2-api-4.0.0.jar (with correct getInstance method) but this is not that loaded
22236523160451859     56 -rwxrwx---   1  tomcat  tomcat    55932 Oct 17 13:58 ./activation-1.1.jar
23080948090583810      4 -rwxrwx---   1  tomcat  tomcat     3482 Jun 16 21:58 ./animal-sniffer-annotations-1.14.jar
2814749767430984      8 -rwxrwx---   1  tomcat  tomcat     4467 Jun 16 21:57 ./aopalliance-1.0.jar
22517998137162499     16 -rwxrwx---   1  tomcat  tomcat    14768 Oct 17 15:29 ./aopalliance-repackaged-2.5.0-b42.jar
7881299348211839     32 -rwxrwx---   1  tomcat  tomcat    31547 Jun 16 21:58 ./checker-compat-qual-2.0.0.jar
22799473113873172    328 -rwxrwx---   1  tomcat  tomcat   335042 Oct 10 17:35 ./commons-codec-1.11.jar
2814749767430985    492 -rwxrwx---   1  tomcat  tomcat   501879 Oct  9 18:26 ./commons-lang3-3.8.1.jar
23080948090583812     64 -rwxrwx---   1  tomcat  tomcat    61829 Oct  9 18:03 ./commons-logging-1.2.jar
4785074604395081     16 -rwxrwx---   1  tomcat  tomcat    13704 Jun 16 21:58 ./error_prone_annotations-2.1.3.jar
22799473113873157     24 -rwxrwx---   1  tomcat  tomcat    21820 Oct 26 17:51 ./gmbal-api-only-3.1.0-b001.jar
4222124650973770   2532 -rwxrwx---   1  tomcat  tomcat  2591373 Oct 14 11:08 ./guava-25.1-android.jar
22799473113873158    828 -rwxrwx---   1  tomcat  tomcat   846871 Oct 14 11:07 ./guice-4.2.1.jar
22799473113873173     36 -rwxrwx---   1  tomcat  tomcat    36085 Oct 26 17:51 ./ha-api-3.1.8.jar
22799473113873174    184 -rwxrwx---   1  tomcat  tomcat   186763 Oct 17 15:29 ./hk2-api-2.5.0-b42.jar
2814749767430986    188 -rwxrwx---   1  tomcat  tomcat   189454 Oct 17 15:29 ./hk2-locator-2.5.0-b42.jar
22799473113873175    136 -rwxrwx---   1  tomcat  tomcat   135317 Oct 17 15:29 ./hk2-utils-2.5.0-b42.jar
21110623253609240    752 -rwxrwx---   1  tomcat  tomcat   767140 Oct 10 15:38 ./httpclient-4.5.6.jar
2814749767430987    320 -rwxrwx---   1  tomcat  tomcat   326356 Oct 10 15:38 ./httpcore-4.4.10.jar
22799473113873159     28 -rwxrwx---   1  tomcat  tomcat    24727 Oct 17 14:11 ./istack-commons-runtime-3.0.5.jar
2814749767430988     12 -rwxrwx---   1  tomcat  tomcat     8782 Jun 16 21:58 ./j2objc-annotations-1.1.jar
23362423067294472     68 -rwxrwx---   1  tomcat  tomcat    66981 Oct 17 18:58 ./jackson-annotations-2.9.7.jar
2814749767430989    320 -rwxrwx---   1  tomcat  tomcat   324036 Oct 18 11:29 ./jackson-core-2.9.7.jar
23080948090583817   1320 -rwxrwx---   1  tomcat  tomcat  1350857 Oct 18 11:29 ./jackson-databind-2.9.7.jar
3659174697562958     32 -rwxrwx---   1  tomcat  tomcat    32611 Oct 23 15:31 ./jackson-jaxrs-base-2.9.7.jar
2814749767430991     16 -rwxrwx---   1  tomcat  tomcat    15900 Oct 23 15:31 ./jackson-jaxrs-json-provider-2.9.7.jar
2814749767430992     36 -rwxrwx---   1  tomcat  tomcat    32829 Oct 23 15:31 ./jackson-module-jaxb-annotations-2.9.7.jar
3096224744141649    724 -rwxrwx---   1  tomcat  tomcat   737884 Oct 17 15:29 ./javassist-3.22.0-CR2.jar
20829148276898585     80 -rwxrwx---   1  tomcat  tomcat    78030 Oct 17 15:17 ./javax.activation-1.2.0.jar
20547673300187930     24 -rwxrwx---   1  tomcat  tomcat    22294 Oct 26 17:51 ./javax.annotation-3.1.1.jar
19421773393345307     28 -rwxrwx---   1  tomcat  tomcat    26586 Oct 17 15:17 ./javax.annotation-api-1.3.2.jar
21392098230319900      4 -rwxrwx---   1  tomcat  tomcat     2497 Oct 17 13:58 ./javax.inject-1.jar
21673573207030557      8 -rwxrwx---   1  tomcat  tomcat     5951 Oct 17 15:25 ./javax.inject-2.5.0-b42.jar
9288674231762640    128 -rwxrwx---   1  tomcat  tomcat   127509 Oct 22 11:43 ./javax.ws.rs-api-2.1.jar
4222124650970834     88 -rwxrwx---   1  tomcat  tomcat    89967 Nov  5 14:52 ./jaxb-api-2.1.jar
3659174697549526      1 -rwxrwx---   1  tomcat  tomcat      425 Nov  5 14:59 ./jaxb-core-2.1.14.jar
3096224744128216    848 -rwxrwx---   1  tomcat  tomcat   867801 Nov  5 14:51 ./jaxb-impl-2.1.12.jar
2814749767430994     48 -rwxrwx---   1  tomcat  tomcat    46337 Oct 26 17:51 ./jaxws-api-2.2.8.jar
2814749767430995   2244 -rwxrwx---   1  tomcat  tomcat  2296728 Oct 26 17:51 ./jaxws-rt-2.2.7.jar
4222124650973771    180 -rwxrwx---   1  tomcat  tomcat   181496 Oct 25 15:20 ./jersey-client-2.26.jar
22236523160451850   1100 -rwxrwx---   1  tomcat  tomcat  1125788 Oct 22 11:49 ./jersey-common-2.26.jar
3096224744141624     20 -rwxrwx---   1  tomcat  tomcat    18015 Oct 25 15:20 ./jersey-container-servlet-2.26.jar
2533274790720313     60 -rwxrwx---   1  tomcat  tomcat    59261 Oct 25 15:20 ./jersey-container-servlet-core-2.26.jar
3096224744141626     64 -rwxrwx---   1  tomcat  tomcat    62474 Oct 25 15:20 ./jersey-hk2-2.26.jar
2533274790720315     72 -rwxrwx---   1  tomcat  tomcat    71869 Oct 25 15:20 ./jersey-media-jaxb-2.26.jar
2814749767430972    900 -rwxrwx---   1  tomcat  tomcat   920152 Oct 25 15:20 ./jersey-server-2.26.jar
3096224744128218      8 -rwxrwx---   1  tomcat  tomcat     7989 Oct 26 17:51 ./jsr181-api-1.0-MR1.jar
4503599627681504     20 -rwxrwx---   1  tomcat  tomcat    19936 Oct 14 11:08 ./jsr305-3.0.2.jar
5348024557813496    480 -rwxrwx---   1  tomcat  tomcat   489884 Jun 11 12:53 ./log4j-1.2.17.jar
3940649674262508     44 -rwxrwx---   1  tomcat  tomcat    42212 Oct 17 15:20 ./management-api-3.0.0-b012.jar
2814749767419949     44 -rwxrwx---   1  tomcat  tomcat    42391 Oct 26 17:51 ./mimepull-1.8.jar
2251799814009661     20 -rwxrwx---   1  tomcat  tomcat    20235 Oct 17 15:25 ./osgi-resource-locator-1.0.1.jar
4503599627683886    176 -rwxrwx---   1  tomcat  tomcat   179041 Oct 17 15:17 ./policy-2.7.5.jar
2814749767430974     28 -rwxrwx---   1  tomcat  tomcat    24747 Oct 26 17:51 ./saaj-api-1.3.4.jar
3377699720852287    420 -rwxrwx---   1  tomcat  tomcat   427559 Oct 26 17:51 ./saaj-impl-1.3.19.jar
3096224744130607     24 -rwxrwx---   1  tomcat  tomcat    23346 Oct 26 17:51 ./stax-api-1.0-2.jar
8444249301633146     36 -rwxrwx---   1  tomcat  tomcat    36073 Oct 17 14:32 ./stax-ex-1.8.jar

8725724278343803    160 -rwxrwx---   1  tomcat  tomcat   162924 Nov 15 10:46 ./stax2-api-4.0.0.jar
  894 Wed Feb 25 14:41:44 CET 2015 org/codehaus/stax2/ri/EmptyIterator.class

2251799814009664     64 -rwxrwx---   1  tomcat  tomcat    64308 Oct 26 17:51 ./streambuffer-1.5.jar
2814749767430977     60 -rwxrwx---   1  tomcat  tomcat    57624 Oct 25 18:42 ./streambuffer-2.1.1.jar
2251799814009666     24 -rwxrwx---   1  tomcat  tomcat    21750 Oct 18 11:19 ./swagger-annotations-1.5.21.jar
2814749767430996     72 -rwxrwx---   1  tomcat  tomcat    69828 Oct 17 14:11 ./txw2-2.3.0.1.jar
4785074604405572     64 -rwxrwx---   1  tomcat  tomcat    63777 Oct 18 10:48 ./validation-api-1.1.0.Final.jar
8162774324922493    504 -rwxrwx---   1  tomcat  tomcat   513602 Oct 17 15:17 ./woodstox-core-5.1.0.jar
3940649674273621    468 -rwxrwx---   1  tomcat  tomcat   478935 Oct 26 17:51 ./woodstox-core-asl-4.1.2.jar

Moreover I have download the gzip of tomcat 8.5.35 and uncompress in alternative dir and try but result is always same. I tried to change java vm from opn-jdk 1.8 with java Oracle 1.8.0_161 but nothing changes .

I do not know
 
Tim Holloway
Bartender
Posts: 19988
95
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat should not be causing this. Your STaX code is part of the webapp, irrespective of the JVM and Tomcat server.

However I see both original STaX and STaX2 jars in your WAR. Make sure that there are no conflicts.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!