|
From: Milind R. <mi...@gm...> - 2019-04-10 20:01:39
|
I'm using Spring Boot to create an executable jar with an embedded
Tomcat container.
This is the relevant information from the MANIFEST.MF file
Spring-Boot-Version: 2.0.5.RELEASE
Main-Class: org.springframework.boot.loader.JarLauncher
Start-Class: com.example.PaymentBridge
Spring-Boot-Classes: BOOT-INF/classes/
Spring-Boot-Lib: BOOT-INF/lib/
Created-By: Apache Maven 3.0.5
Build-Jdk: 1.8.0_191
I can run the jar file on Linux with no problem.
java -jar example.jar
I used method 4 to wrap the jar file and when I run it, I get an error
Caused by: java.lang.RuntimeException: XPathFactory#newInstance()
failed to create an XPathFactory for the default object model:
http://java.sun.com/jaxp/xpath/dom with the
XPathFactoryConfigurationException:
javax.xml.xpath.XPathFactoryConfigurationException:
java.util.ServiceConfigurationError: javax.xml.xpath.XPathFactory:
Provider com.saxonica.config.EnterpriseXPathFactory could not be
instantiated
This is because it couldn't find the Saxon-EE-9.5.1.9.jar file which is
in the BOOT-INF/lib/ directory of the spring boot jar file.
I pulled out all the jars in the BOOT-INF/lib directory and copied them
to a directory that I added to a lib2 directory to test. Added the
following property to the wrapper.conf file
wrapper.java.classpath.2=../lib2/*.jar
and it worked.
Clearly I don't want to do that with every file in the first place. And
I don't want to have to keep doing that every time my dependencies change.
How can I get the wrapper to add all the embedded jars to the classpath?
On startup, I do see this line.
Application started with classpath:
[jar:file:/opt/example/0.1.0/bin/../lib/example-bridge-0.1.0-SNAPSHOT.jar!/BOOT-INF/classes!/,
jar:file:/opt/example/0.1.0/bin/../lib/example-bridge-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-boot-starter-web-2.0.5.RELEASE.jar!/,
jar:file:/opt/example/0.1.0/bin/../lib/example-bridge-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-boot-starter-2.0.5.RELEASE.jar!/,
...
,
jar:file:/opt/example/0.1.0/bin/../lib/example-bridge-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/*Saxon-EE-9.5.1.9.jar!*/,
jar:file:/opt/example/0.1.0/bin/../lib/example-bridge-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/xercesImpl-2.10.0.jar!
On linux the classpath is separated by ':', I'm not sure if the comma
between the jars is causing a problem or what.
Any help would be appreciated.
|