我有一个使用batik-bridge 1.6-1
依赖项的jsf项目。
当我在glassfish 4.1.1上运行项目时,它工作得很好但是当我使用Payara 4.1.2.173时,我获得了这个错误堆栈
Grave: org.xml.sax.SAXNotRecognizedException: http://javax.xml.XMLConstants/feature/secure-processing
at org.apache.xerces.parsers.AbstractSAXParser.setFeature(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.setFeatures(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParserImpl(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.setFeature(Unknown Source)
at org.eclipse.persistence.internal.helper.XMLHelper.createParserFactory(XMLHelper.java:98)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:628)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:617)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:503)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:178)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:160)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:141)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
...
这是产生错误的代码部分:
@Stateless
public class MyEventListener extends DescriptorEventAdapter {
@PersistenceContext(unitName = StaticUtil.UNIT_NAME)
private EntityManager em;
protected EntityManager getEntityManager() {
EntityManagerFactory entityFactory = Persistence.createEntityManagerFactory(StaticUtil.UNIT_NAME);
em = (JpaEntityManager) entityFactory.createEntityManager();
return em;
}
...
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="mypersistence-ejbPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>myJNDI</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.jpa.uppercase-column-names" value="true"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<!-- <property name="eclipselink.logging.level.sql" value="FINEST"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.logging.logger" value="ServerLogger"/>-->
<!--<property name="eclipselink.logging.level" value="FINE"/>-->
<!--<property name="eclipselink.logging.level.cache" value="FINE"/>-->
<!--property name="eclipselink.logging.level" value="FINE"/-->
<!--property name="eclipselink.weaving" value="static"/-->
<!--<property name="eclipselink.logging.level.sql" value="FINE"/>-->
<!--property name="eclipselink.logging.level.cache" value="FINEST"/-->
<property name="javax.persistence.schema-generation.database.action" value="create"/>
<!--<property name="javax.persistence.schema-generation.database.action" value="create"/>-->
</properties>
</persistence-unit>
</persistence>
NB :当我删除Batik-bridge 1.6-1
依赖项时,该项目在Payara&amp; glassfish,但我需要这种依赖
答案 0 :(得分:0)
问题解决了升级到Batik 1.7,必须使用这种依赖:
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.7</version>
</dependency>
代替:
<dependency>
<groupId>batik</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.6-1</version>
</dependency>
正如@OndrejM所说,蜡染1.6-1取决于xercesImpl,这导致Sax解析器的问题似乎Batik 1.7使用另一个解析器,现在它完美地工作