gpt4 book ai didi

java - 由 : java. lang.LinkageError 引起:无法链接 com/---

转载 作者:行者123 更新时间:2023-11-30 02:50:02 24 4
gpt4 key购买 nike

下面是我的maven配置

<modelVersion>4.0.0</modelVersion>

<groupId>com.trbrew.commerce.brewtique</groupId>
<artifactId>BrewtiqueProject</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<modules>
<module>ejb</module>
<module>ear</module>
<module>web</module>
</modules>

<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>

<dependencies>
</dependencies>

还有 children

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.trbrew.commerce</groupId>
<artifactId>TrBrewCommerce</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>TrBrewCommerce</name>
<url>http://maven.apache.org</url>

<dependencies>


<dependency>
<groupId>com.koinplus</groupId>
<artifactId>KoinPlusCommons</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C://Users/trbrewjars/KoinPlusCommons-1.0.jar</systemPath>
</dependency>

<dependency>
<groupId>com.trbrew.common</groupId>
<artifactId>TrBrewCommons</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C://Users/trbrewjars/TrendBrewCommons-1.0.jar</systemPath>
</dependency>



<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.20</version>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

</project>

入耳模块Pom

<?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">
<parent>
<artifactId>BrewtiqueProject</artifactId>
<groupId>com.tbrew.commerce.brewtique</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Brewtique</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.trbrew.commerce.brewtique</groupId>
<artifactId>ejb</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.trbrew.commerce.brewtique</groupId>
<artifactId>web</artifactId>
<version>1.0</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<!--<defaultLibBundleDir>lib</defaultLibBundleDir>-->
<modules>
<webModule>
<groupId>com.trbrew.commerce.brewtique</groupId>
<artifactId>web</artifactId>
</webModule>
<ejbModule>
<groupId>com.trbrew.commerce.brewtique</groupId>
<artifactId>ejb</artifactId>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>


</project>

ejb模块的Pom

<?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">
<parent>
<artifactId>BrewtiqueProject</artifactId>
<groupId>com.trbrew.commerce.brewtique</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ejb</artifactId>
<packaging>ejb</packaging>

<dependencies>
<dependency>
<groupId>com.trbrew.commerce</groupId>
<artifactId>TrBrewCommerce</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

我在运行生成的ear文件时遇到的错误是

17:31:09,694 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.subunit."Brewtique-1.0.ear"."ejb-1.0.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Brewtique-1.0.ear"."ejb-1.0.jar".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "ejb-1.0.jar" of deployment "Brewtique-1.0.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.LinkageError: Failed to link com/trendbrew/commerce/brewtique/catalog/CatalogManagementService (Module "deployment.Brewtique-1.0.ear.ejb-1.0.jar:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:560)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:85)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
... 5 more
Caused by: java.lang.NoClassDefFoundError: com/koinplus/common/GenericKoinPlusService
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 19 more
Caused by: java.lang.ClassNotFoundException: com.koinplus.common.GenericKoinPlusService from [Module "deployment.Brewtique-1.0.ear.ejb-1.0.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 23 more

17:31:09,725 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0003: Processing weld deployment web-1.0.war
17:31:09,804 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "Brewtique-1.0.ear")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.subunit.\"Brewtique-1.0.ear\".\"ejb-1.0.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"Brewtique-1.0.ear\".\"ejb-1.0.jar\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"ejb-1.0.jar\" of deployment \"Brewtique-1.0.ear\"
Caused by: java.lang.LinkageError: Failed to link com/trendbrew/commerce/brewtique/catalog/CatalogManagementService (Module \"deployment.Brewtique-1.0.ear.ejb-1.0.jar:main\" from Service Module Loader)
Caused by: java.lang.NoClassDefFoundError: com/koinplus/common/GenericKoinPlusService
Caused by: java.lang.ClassNotFoundException: com.koinplus.common.GenericKoinPlusService from [Module \"deployment.Brewtique-1.0.ear.ejb-1.0.jar:main\" from Service Module Loader]"},
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"Brewtique-1.0.ear\".batch.environment is missing [jboss.deployment.unit.\"Brewtique-1.0.ear\".beanmanager]",
"jboss.deployment.unit.\"Brewtique-1.0.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"Brewtique-1.0.ear\".beanmanager]",
"jboss.deployment.subunit.\"Brewtique-1.0.ear\".\"web-1.0.war\".batch.environment is missing [jboss.deployment.subunit.\"Brewtique-1.0.ear\".\"web-1.0.war\".beanmanager]",
"jboss.persistenceunit.\"Brewtique-1.0.ear/ejb-1.0.jar#tbCommPersistence\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasource.wishinity]",

ear文件部署在Wildfly上,无法破解原因。有什么线索吗?

尝试重新安装...重新打包、maven 更新/刷新,但没有成功。

最佳答案

这里:

<dependency>
<groupId>com.koinplus</groupId>
<artifactId>KoinPlusCommons</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C://Users/trbrewjars/KoinPlusCommons-1.0.jar</systemPath>
</dependency>

<dependency>
<groupId>com.trbrew.common</groupId>
<artifactId>TrBrewCommons</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>C://Users/trbrewjars/TrendBrewCommons-1.0.jar</systemPath>
</dependency>

您使用系统范围声明您的依赖项。
它可以防止您在 TrBrewCommerce Artifact 的解析中以及最终的 EAR Artifact 中拥有这些依赖项。
如果您希望将这些 jar 包含在您的 EAR 中,那么使用技巧来保留 system 范围并不是一个干净的构建。
更简洁的方法是将这两个 jar 安装到您的 Maven 存储库中。之后,您可以删除依赖项声明中的范围system(在本例中,默认情况下将使用范围runtime)和系统路径,例如:

<dependency>
<groupId>com.koinplus</groupId>
<artifactId>KoinPlusCommons</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>com.trbrew.common</groupId>
<artifactId>TrBrewCommons</artifactId>
<version>1.0</version>
</dependency>

要安装 Maven Artifact ,您有 install-file 目标:

https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

关于java - 由 : java. lang.LinkageError 引起:无法链接 com/---,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38997277/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com