我有一个以WAR格式打包的功能齐全的Web应用程序,我试图从/ WEB-INF / lib中删除* .jar文件并放入WildFly 10中。
到目前为止我所做的事情(失败)以及我所引用的资源如下所示。
上述尝试是对Share util jar file with war deployments in Wildfly
的回应我也愿意尝试其他方法。我认为可以将我的WEB-INF / lib中的所有jar包装到一个jar中,并让WildFly 10为jar创建一个id。然后我的war文件会在某个地方指定这个id。问题是我不太确定如何使用特定的Wildfly / J2EE术语来说明我刚才所说的内容。引用https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly并没有真正给我提供帮助我的具体示例。
的JBoss部署-structure.xml
<jboss-deployment-structure>
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
<module name="deployment.aesh-0.33.11.jar" />
<module name="deployment.aether-api-1.13.1.jar" />
<module name="deployment.aether-impl-1.13.1.jar" />
<module name="deployment.aether-spi-1.13.1.jar" />
<module name="deployment.aether-util-1.13.1.jar" />
<module name="deployment.angular2-2.0.0-beta.7.jar" />
<module name="deployment.antlr-2.7.7.jar" />
<module name="deployment.antlr4-runtime-4.5.2-1.jar" />
<module name="deployment.aopalliance-1.0.jar" />
<module name="deployment.bcpkix-jdk15on-1.48.jar" />
<module name="deployment.bcprov-jdk15on-1.48.jar" />
<module name="deployment.bootstrap-3.3.6.jar" />
<module name="deployment.cglib-nodep-2.1_3.jar" />
<module name="deployment.checkstyle-6.16.1.jar" />
<module name="deployment.commons-beanutils-1.9.2.jar" />
<module name="deployment.commons-cli-1.3.1.jar" />
<module name="deployment.commons-codec-1.10.jar" />
<module name="deployment.commons-collections-3.2.1.jar" />
<module name="deployment.commons-compress-1.5.jar" />
<module name="deployment.commons-exec-1.3.jar" />
<module name="deployment.commons-io-2.4.jar" />
<module name="deployment.commons-lang3-3.4.jar" />
<module name="deployment.commons-logging-1.2.jar" />
<module name="deployment.dom4j-1.6.1.jar" />
<module name="deployment.gson-2.3.1.jar" />
<module name="deployment.guava-19.0.jar" />
<module name="deployment.hibernate-commons-annotations-4.0.5.Final.jar" />
<module name="deployment.hibernate-core-4.3.11.Final.jar" />
<module name="deployment.hibernate-jpa-2.1-api-1.0.0.Final.jar" />
<module name="deployment.httpclient-4.3.5.jar" />
<module name="deployment.httpcore-4.3.2.jar" />
<module name="deployment.jackson-core-asl-1.9.13.jar" />
<module name="deployment.jackson-mapper-asl-1.9.13.jar" />
<module name="deployment.jandex-1.1.0.Final.jar" />
<module name="deployment.jansi-1.9.jar" />
<module name="deployment.javassist-3.12.1.GA.jar" />
<module name="deployment.javassist-3.18.1-GA.jar" />
<module name="deployment.javax.servlet.jsp-api-2.3.1.jar" />
<module name="deployment.javax.servlet-api-3.1.0.jar" />
<module name="deployment.jboss-dmr-1.2.0.Final.jar" />
<module name="deployment.jboss-logging-3.1.3.GA.jar" />
<module name="deployment.jboss-logging-annotations-1.2.0.Beta1.jar" />
<module name="deployment.jboss-marshalling-1.4.2.Final.jar" />
<module name="deployment.jboss-marshalling-river-1.4.2.Final.jar" />
<module name="deployment.jboss-remoting-4.0.3.Final.jar" />
<module name="deployment.jboss-sasl-1.0.4.Final.jar" />
<module name="deployment.jboss-threads-2.1.1.Final.jar" />
<module name="deployment.jboss-transaction-api_1.2_spec-1.0.0.Final.jar" />
<module name="deployment.jboss-vfs-3.2.5.Final.jar" />
<module name="deployment.jcip-annotations-1.0.jar" />
<module name="deployment.jcommander-1.48.jar" />
<module name="deployment.jetty-rc-repacked-5.jar" />
<module name="deployment.jetty-repacked-9.2.13.v20150730.jar" />
<module name="deployment.jna-4.1.0.jar" />
<module name="deployment.jna-platform-4.1.0.jar" />
<module name="deployment.jquery-1.11.1.jar" />
<module name="deployment.jstl-1.2.jar" />
<module name="deployment.log4j-api-2.0.jar" />
<module name="deployment.log4j-core-2.0.jar" />
<module name="deployment.log4j-slf4j-impl-2.5.jar" />
<module name="deployment.maven-aether-provider-3.0.5.jar" />
<module name="deployment.maven-artifact-3.0.5.jar" />
<module name="deployment.maven-core-3.0.5.jar" />
<module name="deployment.maven-model-3.0.5.jar" />
<module name="deployment.maven-model-builder-3.0.5.jar" />
<module name="deployment.maven-plugin-annotations-3.2.jar" />
<module name="deployment.maven-plugin-api-3.0.5.jar" />
<module name="deployment.maven-repository-metadata-3.0.5.jar" />
<module name="deployment.maven-settings-3.0.5.jar" />
<module name="deployment.maven-settings-builder-3.0.5.jar" />
<module name="deployment.mx4j-tools-3.0.1.jar" />
<module name="deployment.mysql-connector-java-5.1.38.jar" />
<module name="deployment.netty-3.5.7.Final.jar" />
<module name="deployment.plexus-cipher-1.4.jar" />
<module name="deployment.plexus-classworlds-2.4.jar" />
<module name="deployment.plexus-component-annotations-1.5.5.jar" />
<module name="deployment.plexus-interpolation-1.14.jar" />
<module name="deployment.plexus-sec-dispatcher-1.3.jar" />
<module name="deployment.plexus-utils-3.0.10.jar" />
<module name="deployment.remoting-jmx-2.0.0.Final.jar" />
<module name="deployment.selenium-api-2.53.0.jar" />
<module name="deployment.selenium-chrome-driver-2.53.0.jar" />
<module name="deployment.selenium-edge-driver-2.53.0.jar" />
<module name="deployment.selenium-firefox-driver-2.53.0.jar" />
<module name="deployment.selenium-ie-driver-2.53.0.jar" />
<module name="deployment.selenium-java-2.53.0.jar" />
<module name="deployment.selenium-leg-rc-2.53.0.jar" />
<module name="deployment.selenium-remote-driver-2.53.0.jar" />
<module name="deployment.selenium-safari-driver-2.53.0.jar" />
<module name="deployment.selenium-server-2.53.0.jar" />
<module name="deployment.selenium-support-2.53.0.jar" />
<module name="deployment.sisu-guava-0.9.9.jar" />
<module name="deployment.sisu-guice-3.1.0-no_aop.jar" />
<module name="deployment.sisu-inject-bean-2.3.0.jar" />
<module name="deployment.sisu-inject-plexus-2.3.0.jar" />
<module name="deployment.slf4j-api-1.7.18.jar" />
<module name="deployment.snakeyaml-1.8.jar" />
<module name="deployment.spring-aop-4.1.6.RELEASE.jar" />
<module name="deployment.spring-beans-4.1.6.RELEASE.jar" />
<module name="deployment.spring-context-4.1.6.RELEASE.jar" />
<module name="deployment.spring-core-4.1.6.RELEASE.jar" />
<module name="deployment.spring-expression-4.1.6.RELEASE.jar" />
<module name="deployment.spring-jdbc-4.2.4.RELEASE.jar" />
<module name="deployment.spring-security-acl-4.0.3.RELEASE.jar" />
<module name="deployment.spring-security-config-4.0.1.RELEASE.jar" />
<module name="deployment.spring-security-core-4.0.1.RELEASE.jar" />
<module name="deployment.spring-security-taglibs-4.0.3.RELEASE.jar" />
<module name="deployment.spring-security-web-4.0.1.RELEASE.jar" />
<module name="deployment.spring-tx-4.2.4.RELEASE.jar" />
<module name="deployment.spring-web-4.1.6.RELEASE.jar" />
<module name="deployment.spring-webmvc-4.1.6.RELEASE.jar" />
<module name="deployment.stacks-client-1.0.2.Final.jar" />
<module name="deployment.staxmapper-1.1.0.Final.jar" />
<module name="deployment.wildfly-build-config-8.1.0.Final.jar" />
<module name="deployment.wildfly-cli-8.1.0.Final.jar" />
<module name="deployment.wildfly-controller-client-8.1.0.Final.jar" />
<module name="deployment.wildfly-maven-plugin-1.0.2.Final.jar" />
<module name="deployment.wildfly-protocol-8.1.0.Final.jar" />
<module name="deployment.wildfly-security-manager-1.0.0.Final.jar" />
<module name="deployment.xml-apis-1.0.b2.jar" />
<module name="deployment.xnio-api-3.2.2.Final.jar" />
<module name="deployment.xnio-nio-3.2.2.Final.jar" />
<module name="deployment.xz-1.2.jar" />
</dependencies>
<!-- These add additional classes to the module. In this case it is the same as including the jar in the EAR's lib directory -->
<resources>
<resource-root path="md.jar" />
</resources>
</deployment>
</jboss-deployment-structure>
来自WildFly的错误日志表明它无法部署我的ROOT.war
13:27:30,977 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "antlr4-runtime-4.5.2-1.jar" (runtime-name : "antlr4-runtime-4.5.2-1.jar")
13:27:30,978 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "antlr-2.7.7.jar" (runtime-name : "antlr-2.7.7.jar")
13:27:30,978 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "angular2-2.0.0-beta.7.jar" (runtime-name : "angular2-2.0.0-beta.7.jar")
13:27:30,979 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "aether-util-1.13.1.jar" (runtime-name : "aether-util-1.13.1.jar")
13:27:30,979 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "aether-spi-1.13.1.jar" (runtime-name : "aether-spi-1.13.1.jar")
13:27:30,979 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "aether-impl-1.13.1.jar" (runtime-name : "aether-impl-1.13.1.jar")
13:27:30,979 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "aether-api-1.13.1.jar" (runtime-name : "aether-api-1.13.1.jar")
13:27:30,981 INFO [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "aesh-0.33.11.jar" (runtime-name : "aesh-0.33.11.jar")
13:27:30,983 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.deployment.unit."ROOT.war".beanmanager (missing) dependents: [service jboss.deployment.unit."ROOT.war".weld.weldClassIntrospector, service jboss.deployment.unit."ROOT.war".batch.environment]
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."ROOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ROOT.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "ROOT.war"
13:27:31,234 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
13:27:31,234 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
13:27:31,234 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started (with errors) in 47550ms - Started 4867 of 5891 services (3 services failed or missing dependencies, 1357 services are lazy, passive or on-demand)
13:27:44,221 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0028: Stopped deployment ROOT.war (runtime-name: ROOT.war) in 11969ms
13:27:44,285 INFO [org.jboss.as.repository] (DeploymentScanner-threads - 2) WFLYDR0002: Content removed from location C:\home\toazi\apps\wildfly-10.0.0.Final\standalone\data\content\71\0188d928a988dddca670dade8e87ac9ec64b57\content
13:27:44,285 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0009: Undeployed "ROOT.war" (runtime-name: "ROOT.war")
13:27:44,286 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) WFLYCTL0183: Service status report
WFLYCTL0186: Services which failed to start: service jboss.deployment.unit."ROOT.war".INSTALL
答案 0 :(得分:1)
Wildfly在列表中提供了许多依赖项(例如,Hibernate,日志记录)。因此,您不需要包含它们,或者如果您需要包含它们(例如,如果您需要其他版本而不是Wildfly),则应将其排除在外。
如果每个jar都是自己的部署,我不确定他们是否可以看到对方。
除此之外,将您的Jars放入模块可能更好。然后你只需要在jboss-deployment-structure中包含对该模块的引用而不是30.在你链接的问题中也给出了一个例子。