This afternoon, I encountered a very annoying exception. I haven't figured it out for a long time! Although we know it is a package conflict, we cannot find the cause.
] Root cause of servletexception.
Java. lang. linkageerror: loader Constraint Violation: when resolving method "javax. XML. validation. schemafactory. newschema (ljavax/XML/transform/source;) ljavax/XML/validation/Schema; "The Class Loader (instance of WebLogic/utils/classloaders/changeawareclassloader) of the current class, COM/geostar/csw/util/jaxbutil, and the class loader (instance of <bootloader>) for resolved class, javax/XML/validation/schemafactory, have different class objects for the Type javax/XML/transform/source used in the signature
At com. geostar. CSW. util. jaxbutil. xml2object (jaxbutil. Java: 122)
At com. geostar. CSW. servlet. cswservlet. dopost (cswservlet. Java: 85)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 727)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 820)
At weblogic. servlet. Internal. stubsecurityhelper $ servletserviceaction. Run (stubsecurityhelper. Java: 227)
Truncated. See log file for complete stacktrace
>
Key code: at com. geostar. CSW. util. jaxbutil. xml2object (jaxbutil. Java: 122) is implemented as follows:
View code
1 public static object xml2object (class <?> Clazz, inputstream is, inputstream schema) throws saxexception, jaxbexception {
2 object OBJ = NULL;
3 try {
4 validationeventcollector VEC = new validationeventcollector ();
5 schemafactory Sf = schemafactory. newinstance (xmlconstants. w3c_xml_schema_ns_uri );
6 inputsource insource = new inputsource (schema );
7 saxsource sax = new saxsource (insource );
8 schema Sch = SF. newschema (SAX); // error location
9 JAXBContext jc = JAXBContext. newInstance (clazz. getPackage (). getName ());
10 Unmarshaller u = jc. createUnmarshaller ();
11 u. setSchema (sch );
12 u. setEventHandler (vec );
13 obj = u. unmarshal (is );
14}
15 catch (SAXException e ){
16 throw new SAXException (e. getMessage ());
17} catch (JAXBException e ){
18 throw new JAXBException (e. getMessage ());
19}
20 return obj;
21 };
Schema: javax. xml. validation. Schema; SchemaFactory: javax. xml. validation. SchemaFactory; JDK: 1.6. I don't know how to solve this problem!
Khan ~~~~~~~~~~~~~~~~.
After reading it online, someone said it may conflict with the weblogic package, so I configured another weblogic. xml
The content is as follows:
View code
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">
<jsp-descriptor>
<keepgenerated>true</keepgenerated>
<page-check-seconds>60</page-check-seconds>
<precompile>true</precompile>
<precompile-continue>true</precompile-continue>
</jsp-descriptor>
<container-descriptor>
<optimistic-serialization>true</optimistic-serialization>
<show-archived-real-path-enabled>true</show-archived-real-path-enabled>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>