There is xercesImpl-2.12.0.jar in the axis2/lib I put it there.
from what I understand for some reason this jar is lode from system
classloader and not from the axis2/lib as it should
Is there any Djavax or any other way to force it to use the correct
axis2/lib/xercesImpl-2.12.0.jar?
What is the system classloader is it the Ant lib?
Is there any flag or any other way to print the parent loader location?
BR,
Yogev Levi
Senior Software Engineer
TEOCO Ltd.
c:
+972 52 4455 708
p:
+972 3 9269752
E-mail: [email protected]<mailto:[email protected]>
www.teoco.com<http://www.teoco.com/>
From: robertlazarski [mailto:[email protected]]
Sent: Thursday, October 15, 2020 5:58 PM
To: [email protected]
Subject: Re: axis2-1.7.9 running with invalid JAXP
What it looks to me, is that you lack a xerces jar in your lib dir.
Your logs show this below, that the xerces implementation is coming from the
system classloader:
Finding class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
Class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl loaded from parent
loader (parentFirst)
The latest xerxes is xercesImpl-2.12.0.jar. I noticed the axis2 samples use
2.9.1 but otherwise we don't distribute xerces, as it's most often already in a
higher preference classpath.
Anyways, with that jar in your lib dir you should see something like this:
Finding class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
Loaded from /home/robert/repos/webserviceclient/lib/xercesImpl-2.12.0.jar
org/apache/xerces/jaxp/DocumentBuilderFactoryImpl.class
Also, an extra step is confirming the jar location by adding something like
this to your build.xml:
<target name="run_test" depends="compile_client" description="run simple test">
<java classname="client.TestClient" >
<classpath refid="axis2_client.classpath"/>
</java>
</target>
package client;
import static java.lang.System.out;
import javax.xml.parsers.DocumentBuilderFactory;
public class TestClient {
/**
* Simple Test client.
*
* @param args Main
*/
public static void main(String[] args) {
try {
DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
Class<? extends DocumentBuilderFactory> clazz =
documentBuilderFactory.getClass();
out.println("DocumentBuilderFactory was loaded from: " +
clazz.getProtectionDomain().getCodeSource().getLocation());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
output:
[java] DocumentBuilderFactory was loaded from:
file:/home/robert/repos/webserviceclient/lib/xercesImpl-2.12.0.jar
On Thu, Oct 15, 2020 at 3:46 AM Levi, Yogev
<[email protected]<mailto:[email protected]>> wrote:
Thank you for the fast reply.
unfortunately, it's still not working and with the same problem
What is the meaning of parent_First?
who is this parent if I run the code using ant only?!
is it the ant itself?
1) If I understand the document correctly, the 3
prefer-application-packages will be relevant only if I’m generating the stub
files using WebLogic but I’m not.
I’m using Ant to generate axis2-1.7.9 stub files from the WSDL
file and not the server.
You can see below the ant task that lode all the jars to the classpath and I’m
using only the axis2 release jars with the addition of xml-apis-1.4.01.jar and
xercesImpl-2.12.0.jar that I added.
(jcore-axis2-codegen-*.jar is not exist)
<taskdef name="AntCodegenTask"
classname="org.apache.axis2.tool.ant.AntCodegenTask">
<classpath>
<!-- This assumes that the user defined the
3rdparty.development in his build.xml!? -->
<!-- I hope that the order doesnt matter (ie: that jcore-axis2
doesn't have to be first -->
<!-- Note: there was an issue with order with UName or
something. (weblogic.jar had to be removed) -->
<!-- NOTE: we need to force the jcore jar at front of the
classpath. Otherwise it silently generated different code !! -->
<!--pathelement
location="${3rdparty.development}/axis2/lib/jcore-axis2-codegen-1.4.jar"/-->
<fileset dir="${3rdparty.development}/axis2/lib">
<include name="jcore-axis2-codegen-*.jar"/>
<!-- This will catch both 1.2.jar and 1.4.jar depending on 3rdparty label -->
</fileset>
<fileset dir="${3rdparty.development}/axis2/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
2) I try to run the ant with the parameters you recommend. please see the
attach antOutput2.txt
the command I use is: ant -verbose -debug -Djaxp.debug=1
-Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
generate > C:\Users\leviy\Desktop\save\antOutput2.txt
3) Same with these parameters please see antOutput3.txt. the command I
used is: ant -verbose -debug -Djaxp.debug=1
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
generate > C:\Users\leviy\Desktop\save\antOutput3.txt
BR,
Yogev Levi
Senior Software Engineer
TEOCO Ltd.
c:
+972 52 4455 708
p:
+972 3 9269752
E-mail: [email protected]<mailto:[email protected]>
www.teoco.com<http://www.teoco.com/>
From: robertlazarski
[mailto:[email protected]<mailto:[email protected]>]
Sent: Thursday, October 15, 2020 2:51 PM
To: [email protected]<mailto:[email protected]>
Subject: Re: axis2-1.7.9 running with invalid JAXP
3)
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
On Thu, Oct 15, 2020 at 1:41 AM robertlazarski
<[email protected]<mailto:[email protected]>> wrote:
Looks like you are running the axis2 client in Weblogic, and it is loading
xerces from the parent classloader instead of the application classloader.
Two things you could try:
1) Add this to your weblogic-application.xml:
<prefer-application-packages>
<package-name>com.ctc.wstx.*</package-name>
<package-name>javax.xml.*</package-name>
<package-name>org.apache.*</package-name>
</prefer-application-packages>
https://axis.apache.org/axis2/java/core/docs/app_server.html
2)
-Djavax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
On Wed, Oct 14, 2020 at 9:24 PM Levi, Yogev
<[email protected]<mailto:[email protected]>> wrote:
Hi
In addition to the ant output in the attached file, I got the following error
printed to the screen.
I hope it will help you help me :)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=256m;
support was removed in 8.0
BUILD FAILED
D:\snap_views\11_2_for_3rdParty\netrac2_j2ee\jcore_mt\assembly\build\build.xml:22:
The following error occurred while executing this line:
D:\snap_views\11_2_for_3rdParty\netrac2_j2ee\jcore_ant\release\ant\common.xml:2292:
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:294)
at
org.apache.axis2.tool.ant.AntCodegenTask.execute(AntCodegenTask.java:416)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:440)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:112)
at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:247)
... 42 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.axis2.wsdl.codegen.extension.JAXBRIExtension.engage(JAXBRIExtension.java:101)
... 43 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: You are
running with invalid JAXP api or implementation. JAXP api/implementation of
version 1.3.1 (included in JDK6) or higher is required. In case you are using
ant, make sure ant 1.7.0 or higher is used - older versions of ant contain JAXP
api/impl version 1.2 (in xml-apis.jar). If you want to keep using older ant
versions, you have to configure it to use higher the JAXP api/impl versions.
at
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:355)
... 48 more
Caused by: java.lang.IllegalStateException: You are running with invalid JAXP
api or implementation. JAXP api/implementation of version 1.3.1 (included in
JDK6) or higher is required. In case you are using ant, make sure ant 1.7.0 or
higher is used - older versions of ant contain JAXP api/impl version 1.2 (in
xml-apis.jar). If you want to keep using older ant versions, you have to
configure it to use higher the JAXP api/impl versions.
at
com.sun.xml.bind.v2.util.XmlFactory.createDocumentBuilderFactory(XmlFactory.java:183)
at
com.sun.tools.xjc.reader.internalizer.DOMForest.<init>(DOMForest.java:162)
at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.resetSchema(SchemaCompilerImpl.java:215)
at
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.<init>(SchemaCompilerImpl.java:114)
at com.sun.tools.xjc.api.XJC.createSchemaCompiler(XJC.java:72)
at
org.apache.axis2.jaxbri.CodeGenerationUtility.processSchemas(CodeGenerationUtility.java:178)
... 48 more
Caused by: java.lang.AbstractMethodError:
javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
at
com.sun.xml.bind.v2.util.XmlFactory.createDocumentBuilderFactory(XmlFactory.java:176)
... 53 more
Total time: 0 seconds
BR,
Yogev Levi
Senior Software Engineer
TEOCO Ltd.
c:
+972 52 4455 708
p:
+972 3 9269752
E-mail: [email protected]<mailto:[email protected]>
www.teoco.com<http://www.teoco.com/>
From: Levi, Yogev
Sent: Thursday, October 15, 2020 9:41 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: axis2-1.7.9 running with invalid JAXP
Hi Robert
Thank you for the fast reply
Please see the attached file with the output of the flags you recommended
BR,
Yogev Levi
Senior Software Engineer
TEOCO Ltd.
c:
+972 52 4455 708
p:
+972 3 9269752
E-mail: [email protected]<mailto:[email protected]>
www.teoco.com<http://www.teoco.com/>
From: robertlazarski [mailto:[email protected]]
Sent: Thursday, October 15, 2020 1:40 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: axis2-1.7.9 running with invalid JAXP
I suggest using these flags to ant, then paste the entire output:
ant -verbose -debug -Djaxp.debug=1
Robert
On Wed, Oct 14, 2020 at 4:08 AM Levi, Yogev
<[email protected]<mailto:[email protected]>> wrote:
Hi
I'm trying to generate axis2-1.7.9 stub files from wsdl file by calling axis2
classname="org.apache.axis2.tool.ant.AntCodegenTask"
but I keep getting the following error:
java.lang.RuntimeException: java.lang.IllegalStateException:
You are running with invalid JAXP api or implementation.
JAXP api/implementation of version 1.3.1 (included in JDK6) or higher is
required.
In case you are using ant, make sure ant 1.7.0 or higher is used - older
versions of ant contain JAXP api/impl version 1.2 (in xml-apis.jar).
If you want to keep using older ant versions, you have to configure it to
use higher the JAXP api/impl versions.
at the classpath, I'm using xalan-2.7.2.jar, xml-apis-1.4.01.jar and
xercesImpl-2.12.1.jar
my ant version is: Apache Ant(TM) version 1.9.1 compiled on May 15 2013
and my java version is: java version "1.8.0_91" Java(TM) SE Runtime Environment
(build 1.8.0_91-b15)
I don't understand what is the problem? what I'm missing here? from where JAXP
with version 1.3.1 comes from?
I also updated the ant jars with xml-apis-1.4.01.jar and xercesImpl-2.12.1.jar
and still no luck.... what am I doing wrong?
any help will be appreciated
BR,
Yogev Levi
Senior Software Engineer
TEOCO Ltd.
c:
+972 52 4455 708
p:
+972 3 9269752
E-mail: [email protected]<mailto:[email protected]>
www.teoco.com<http://www.teoco.com/>
________________________________
PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and
confidential, and is intended only for the use of the individual to whom it is
addressed and others who have been specifically authorized to receive it. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, or if any
problems occur with transmission, please contact sender. Thank you.
________________________________
PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and
confidential, and is intended only for the use of the individual to whom it is
addressed and others who have been specifically authorized to receive it. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, or if any
problems occur with transmission, please contact sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail:
[email protected]<mailto:[email protected]>
For additional commands, e-mail:
[email protected]<mailto:[email protected]>
________________________________
PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and
confidential, and is intended only for the use of the individual to whom it is
addressed and others who have been specifically authorized to receive it. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, or if any
problems occur with transmission, please contact sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail:
[email protected]<mailto:[email protected]>
For additional commands, e-mail:
[email protected]<mailto:[email protected]>
________________________________
PRIVILEGED AND CONFIDENTIAL
PLEASE NOTE: The information contained in this message is privileged and
confidential, and is intended only for the use of the individual to whom it is
addressed and others who have been specifically authorized to receive it. If
you are not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited. If you have received this communication in error, or if any
problems occur with transmission, please contact sender. Thank you.