I have a jsf project which uses the batik-bridge 1.6-1
dependency.
When I run the project on glassfish 4.1.1 it works perfectly but when I use Payara 4.1.2.173 I obtain this error stack
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)
...
this the part of code which produces the error:
@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;
}
...
The 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:When I remove the Batik-bridge 1.6-1
dependency the project works both in Payara & glassfish but I need this dependency
the problem was solved with upgrading to Batik 1.7, must use this dependency :
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.7</version>
</dependency>
instead:
<dependency>
<groupId>batik</groupId>
<artifactId>batik-bridge</artifactId>
<version>1.6-1</version>
</dependency>
As @OndrejM said the batik 1.6-1 depends on xercesImpl which causes the probleme with the Sax parser seems that Batik 1.7 uses another parser, now it works perfectly