我在Spring Boot(1.5.13.RELEASE)Maven应用程序中使用了一些外部/自定义库。我将自定义jar上载到我们的本地工件服务器,并将它们作为依赖项添加到pom.xml中。当我从Eclipse(Oxygen)运行Spring boot Application主类时,一切运行良好。当我打包应用程序并使用java -jar“ jar filename”在Eclipse(如命令行)之外运行它时,我正在收到ClassNotFoundException。我验证了打包的jar文件,并且可以看到我正在\ BOOT-INF \ lib目录中使用的自定义jar,但仍收到ClassNotFoundException。我使用的其他自定义jar很少,但只有一个特定的jar有问题。有人可以帮我解决这个问题吗?。
例外:
Caused by: java.lang.RuntimeException: Unable to resolve class com.ciq.pubsub.tr
ansport.esb.EsbTransport in assembly CapitalIQ.PubSub.Transport.ESB.jar: com.ciq
.pubsub.transport.esb.EsbTransport
at com.ciq.pubsub.transport.TransportFactory.createTransport(TransportFa
ctory.java:71) ~[CapitalIQPubSubTransport-4.1.jar!/:na]
at com.spgmi.pipeline.implV2.HermesObjSetProvider.<init>(HermesObjSetPro
vider.java:56) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.DeliveryContextManager.get(DeliveryContextM
anager.java:92) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.DeliveryContextManager.ResolveContext(Deliv
eryContextManager.java:74) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.ContentPipeline.getDeliveryContext(ContentP
ipeline.java:260) ~[SPGMIPipeline-4.4.jar!/:4.4]
... 58 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.ciq.pubsub.transport.esb.EsbTra
nsport
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_121]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_121]
at java.net.FactoryURLClassLoader.loadClass(Unknown Source) ~[na:1.8.0_1
21]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_121]
at com.ciq.pubsub.transport.TransportFactory.createTransport(TransportFa
ctory.java:67) ~[CapitalIQPubSubTransport-4.1.jar!/:na]
... 62 common frames omitted
下面是pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gcc-news-publishing-service</groupId>
<artifactId>gcc-news-publishing-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gcc-news-publishing-service</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.13.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Interfaces</groupId>
<artifactId>CapitalIQPubSubInterfaces</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Dynamic</groupId>
<artifactId>CapitalIQPubSubJavaConfigDynamic</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Factory</groupId>
<artifactId>CapitalIQPubSubJavaConfigFactory</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Interfaces</groupId>
<artifactId>CapitalIQPubSubJavaConfigInterfaces</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Internal</groupId>
<artifactId>CapitalIQPubSubJavaConfigInternal</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config</groupId>
<artifactId>CapitalIQPubSubJavaConfig</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.ConfigServiceStub</groupId>
<artifactId>CapitalIQPubSubJavaConfigServiceStub</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport.ESB</groupId>
<artifactId>CapitalIQPubSubTransportESB</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport.Informatica</groupId>
<artifactId>CapitalIQPubSubTransportInformatica</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport</groupId>
<artifactId>CapitalIQPubSubTransport</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>SPGMIPipelineInterfaces</groupId>
<artifactId>SPGMIPipelineInterfaces</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>cSPGMIPipelineConfiguration</groupId>
<artifactId>SPGMIPipelineConfiguration</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>SPGMIPipelineObjectSets</groupId>
<artifactId>SPGMIPipelineObjectSets</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>SPGMIPipeline</groupId>
<artifactId>SPGMIPipeline</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>persistence-api</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.osgi.core</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>osgi-resource-locator</artifactId>
<version>1.0.1</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
<version>1.0</version>
</dependency>
-->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>2.5.0-b32</version>
</dependency>
<dependency>
<groupId>sonic_Client</groupId>
<artifactId>sonic_Client</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_Client_ext</groupId>
<artifactId>sonic_Client_ext</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_Crypto</groupId>
<artifactId>sonic_Crypto</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_mgmt_client</groupId>
<artifactId>sonic_mgmt_client</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>UMS_6.8_jdk1.5.0_12</groupId>
<artifactId>UMS_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>UMSPDM_6.8_jdk1.5.0_12</groupId>
<artifactId>UMSPDM_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>UMSSDM_6.8_jdk1.5.0_12</groupId>
<artifactId>UMSSDM_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>registry</groupId>
<artifactId>registry</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>saaj</groupId>
<artifactId>saaj</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>jaxrpc</groupId>
<artifactId>jaxrpc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>openmdx-kernel</groupId>
<artifactId>openmdx-kernel</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>aopalliance-repackaged</artifactId>
<version>2.5.0-b32</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>artifactory</id>
<name>S and P artifactory server</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</repository>
<repository>
<id>artifactory-snapshot</id>
<name>S and P artifactory server</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<name>central</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
<id>central</id>
</repository>
<snapshotRepository>
<id>central-snap</id>
<name>central-snap</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</snapshotRepository>
</distributionManagement>
</project>
答案 0 :(得分:0)
尝试使用mvn install:install-file
。
以下是一个示例:http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/
mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code
-DartifactId=kaptcha -Dversion={version} -Dpackaging=jar