I'm using a tika parsers in my project.
I'm using three classes from this package:
org.apache.tika.Tika;
org.apache.tika.parser.txt.CharsetDetector;
org.apache.tika.parser.txt.CharsetMatch;
Last time I rised an version from Tika 1.0 to Tika 1.20.
Then it started to throwing warnings like:
WARN org.apache.tika.parser.SQLite3Parser : org.xerial's sqlite-jdbc is not loaded.
Please provide the jar on your classpath to parse sqlite files.
See tika-parsers/pom.xml for the correct version.
I don't need these dependencies in my app so I tried to avoid it in following ways:
0. Created an tika-config.xml file
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<service-loader initializableProblemHandler="ignore"/>
</properties>
Added to application.yaml tika.config property with relative and not-relative path to tika-config.xml file. Didn't worked.
Added an TIKA_CONFIG enviroment variable. Also didn't worked.
Is there any other solution that can I try to get rid of these warnings?
the reason you have this warning is because the sqlite is no longer embeded with tika jar
https://cwiki.apache.org/confluence/display/tika/SQLite%20Parser
try exluding sql with this, or add sqlite dependency
<?xml version="1.0" encoding="UTF-8"?>
<properties>
<parsers>
<parser class="org.apache.tika.parser.DefaultParser">
<mime-exclude>application/sql</mime-exclude>
</parser>
</parsers>
</properties>
if you want to add sqlite dependency
add this to your pom.xml
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.8.10.1</version>
</dependency>
Related
I am using JSF 2.2 taglibs but Eclipse is displaying the following warning message:
Can't find facelet tag library for uri http://xmlns.jcp.org/jsf
What bugs me is that I've faced this issue before and it was related to classpath JARs, but now it is only affecting JSF 2.2 tag libs.
Taglib xmlns:h="http://xmlns.jcp.org/jsf/html" is working fine, the warning is shown to JSF 2.2 specifics like "/jsf" and "/jsf/passthrough". Here is an image showing warnings for JSF 2.2. tag libs, but prior namespaces are loaded correctly.
I have tried to solve the issue with help of posts like this but none of the procedures (clean, restart, close/open, validate, etc) have worked for me.
Dependencies for JSF (derived from WildFly 10.1 pom.xml):
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.13</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.13.SP1</version>
<scope>provided</scope>
</dependency>
Eclipse info:
Version: Neon.1a Release (4.6.1)
Build id: 20161007-1200
Update
After looking into the taglib files I found no "passthrough" or "friendly markup" reference. So there is no surprise Eclipse won't find it...
There is no file under com.sun.faces.metadata.taglib for Friendly Markup and Passthrough, for both Glassfish and JBoss implementations.
The question now is where should these files be?
Update: opened issue WFLY-9579
It seems that the taglib files are missing from the implementation JARs, for both Glassfish and JBoss projects. I hope to be wrong but I found no other explanation.
I've posted a thread so this behavior can be investigated.
https://developer.jboss.org/thread/274046
Workaround
To stop the IDE from warning simply create empty taglibs files and associate to the web.xml. Files should go under /WEB-INF/ and have the appropriate extension taglib.xml.
The JSF implementation will behave normally and should process the facelets correctly.
friendly_markup.taglib.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
version="2.2">
<namespace>http://xmlns.jcp.org/jsf</namespace>
</facelet-taglib>
passthrough.taglib.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<facelet-taglib xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
version="2.2">
<namespace>http://xmlns.jcp.org/jsf/passthrough</namespace>
</facelet-taglib>
web.xml
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/passthrough.taglib.xml;/WEB-INF/friendly_markup.taglib.xml</param-value>
</context-param>
Here is what it looks like. Now the warnings are gone (and my OCD is calm again). I would like to try and make JAR dependency for it, if I find some spare time.
I am implementing XML validation which prevents XXE (External XML Entity) Injection. I borrowed some code from OWASP XXE Prevention Cheat Sheet. My code looks like this -
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = factory.newSchema(xsdFileURL);
Validator validator = schema.newValidator();
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
validator.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
validator.validate(new StreamSource(new StringReader(xml)));
The code runs correctly on my local windows machine (JDK 1.8.0_92, Wildfly 8.2). But on a QA Red Hat machine with similar config (JDK - 1.8.0_101, Wildfly 8.2), it throws an exception with the message -
Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
After some reading my suspicion is that during runtime, incorrect class definition is being read for the validator class. How do I fix this?
Update
Turns out Jboss comes with its own implementation of JAXP, and my code needs to pick the JAXP implementation from JDK and not from JBoss. I can do this easily by passing -jaxpmodule argument in standalone.sh (using this, my code picked the correct JAXP implementation as well) -
java -jar jboss-modules.jar -jaxpmodule "javax.xml.jaxp-provider"
But I'd like to do this using jboss-deployment-structure.xml and add an exclusion like this -
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
<module name="javax.api" /> // is the module name correct?
</exclusions>
</deployment>
</jboss-deployment-structure>
But this isn't working, how can I fix this?
As you mentioned in your update, JBoss/Wildfly does ship its own JAXP implementation - Xalan (and Xerces). As such, it uses that implementation as it builds the classpath for your deployed application(s).
You can override this behavior in your jboss-deployment-structure.xml file as follows:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclusions>
<module name="org.apache.xalan" />
<module name="org.apache.xerces" />
</exclusions>
</deployment>
</jboss-deployment-structure>
Instead of trying to remove JARs from the Server's runtime.It is always advisable to exclude these JARs from your project at runtime.E.g. If you are using Maven for dependency management,then for this particular JAR in your pom.xml,you can just provide scope for this JAR as "provided".Provided scope indicates that this JAR will be used for compile time and at runtime it will be provided by runtime itself.
I am getting this error:
java.lang.ClassCastException: org.apache.jcp.xml.dsig.internal.dom.DOMReference cannot be cast to org.jcp.xml.dsig.internal.dom.DOMReference
Maybe the problem is on the jboss-deployment-structure.xml of the servlet:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<module name="javax.api"/>
<module name="org.apache.santuario.xmlsec"/>
<module name="org.apache.xerces" />
<system export="true">
<paths>
<path name="com/sun/org/apache/xerces/internal/dom"/>
</paths>
</system>
</dependencies>
</deployment>
</jboss-deployment-structure>
Do you have any hint of whats going on?
Thanks in advance.
Your problem is different xmlsec library version.
org.apache.jcp.xml.dsig.internal.dom.DOMReference located in xmlsec-1.5.1.jar (org.apache.santuario.xmlsec module in JBoss)
org.jcp.xml.dsig.internal.dom.DOMReference located in xmlsec-1.4.3.jar (dependency in your pom.xml)
Jboss 7 uses isolated modules https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7 it is complicated and i really don't know how it works inside.
But if simplify, when jboss start, it loads xmlsec-1.5.1, when start your application, it loads xmlsec-1.4.3. As result you have class cast exception, when pass DOMReference object between jboss and webapp classloders.
You can resolve your issue in different ways:
remove dependency of org.apache.santuario.xmlsec module in jboss-deployment-structure.xml. Application will use his own defined xmlsec-1.4.3 library
locate dependency xmlsec in pom.xml, set version to 1.5.1, and set scope to provided. Application will use JBoss module with xmlsec-1.5.1
locate dependency xmlsec in pom.xml and exclude it completly, if your code complies without xmlsec dependency. Application will use JBoss module with xmlsec-1.5.1
mvn:dependency:tree command helps here.
I want to change the version of pom file in all the projects based on single common config file.I have the property defined in parent pom file. But tag version cannot be replaced with ${common-project.version} which is defined in properties of parent pom file. Is there way to achieve it.
Please find the example below.
<parent>
<groupId>com.test</groupId>
<artifactId>test-project</artifactId>
<version>11.0.1-SNAPSHOT</version> <!-- PROJECT VERSION -->
<relativePath>../pom.xml</relativePath>
</parent>
I want to change the 'version' tag in all the projects based on single config file to remove the duplication.
I have followed the guide for JQueryUI for GWT in Eclipse, but I get the error:
The type com.google.gwt.query.client.GQuery cannot be resolved. It is indirectly referenced from required .class files
I'm not quite sure if I'm doing everything correctly, though. I never imported JQueryUI (I have no clue how to import non-jar files correctly), but I think that the Google CDN network takes care of that, no? The tutorial I followed is here:
http://code.google.com/p/gwtquery-ui/wiki/GettingStarted
I tried converting my file to Maven by right clicking and choosing convert to maven. This created a POM.xml file. I added this to the pom file:
<repositories>
<repository>
<id>gwtquery-ui-repository</id>
<url>http://gwtquery-ui.googlecode.com/svn/mavenrepo</url>
</repository>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwtquery-ui</artifactId>
<version>r146</version>
<scope>provided</scope>
</dependency>
I have this for JQueryUI part in my.gwt.xml file:
<inherits name='gwtquery.plugins.UiGoogleCdn' />
<inherits name='gwtquery.plugins.UiEmbedded' />
Any tips at all would be appreciated!
I found my error. You are required to install and setup GWTQuery before you can use GWTQueryUI. I thought it was standalone, but it was not.