动态Web模块和gradle API未公开

时间:2017-03-30 16:02:41

标签: java-ee gradle jaxb wildfly

我在Wildfly 10上运行了一个JEE动态Web模块。我为这个项目设置了gradle,所以我可以从命令行构建它以实现CI目的。

要设置gralde,我创建了一个新的gradle项目,然后我从旧项目中复制了所有文件。

我的模块在wildfly启动时正确部署,我的webapp没问题,但我无法访问API。

这是我的web.xml文件,它应该告诉JBOSS将所有/api/* url映射到myservices:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
    id="WebApp_ID" version="3.1">
    <display-name>SuperAvenir</display-name>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <servlet-mapping>
        <servlet-name>javax.ws.rs.core.Application</servlet-name>
        <url-pattern>/api/*</url-pattern>
    </servlet-mapping>
</web-app>

这是我从Wildfly开始的日志:

17:52:17,308 INFO  [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
17:52:17,591 INFO  [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
17:52:17,760 INFO  [org.jboss.as] (MSC service thread 1-6) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
17:52:19,758 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: Found SuperAvenir.war in deployment directory. To trigger deployment create a file called SuperAvenir.war.dodeploy
17:52:19,801 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
17:52:19,838 INFO  [org.xnio] (MSC service thread 1-8) XNIO version 3.3.4.Final
17:52:19,855 INFO  [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.3.4.Final
17:52:19,915 WARN  [org.jboss.as.txn] (ServerService Thread Pool -- 50) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
17:52:19,933 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 49) WFLYSEC0002: Activating Security Subsystem
17:52:19,939 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 36) WFLYCLINF0001: Activating Infinispan subsystem.
17:52:19,954 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 44) WFLYNAM0001: Activating Naming Subsystem
17:52:19,962 INFO  [org.jboss.as.jsf] (ServerService Thread Pool -- 42) WFLYJSF0007: Activated the following JSF Implementations: [main]
17:52:19,977 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 52) WFLYWS0002: Activating WebServices Extension
17:52:19,996 INFO  [org.jboss.as.security] (MSC service thread 1-6) WFLYSEC0001: Current PicketBox version=4.9.4.Final
17:52:20,026 INFO  [org.wildfly.extension.io] (ServerService Thread Pool -- 35) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
17:52:20,166 INFO  [org.jboss.as.connector] (MSC service thread 1-6) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
17:52:20,189 INFO  [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.18.Final
17:52:20,196 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 51) WFLYUT0003: Undertow 1.3.15.Final starting
17:52:20,202 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 1.3.15.Final starting
17:52:20,223 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 30) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
17:52:20,242 INFO  [org.jboss.as.naming] (MSC service thread 1-6) WFLYNAM0003: Starting Naming Service
17:52:20,243 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-6) WFLYMAIL0001: Bound mail session [java:/Mail]
17:52:20,260 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = h2
17:52:20,285 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 30) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
17:52:20,286 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) WFLYJCA0018: Started Driver service with driver-name = mysql24
17:52:20,451 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 51) WFLYUT0014: Creating file handler for path 'C:\Programmation\JBoss\wildfly-10.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
17:52:20,471 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: Started server default-server.
17:52:20,472 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0018: Host default-host starting
17:52:20,565 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
17:52:20,926 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Programmation\JBoss\wildfly-10.0.0.Final\standalone\deployments
17:52:20,939 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "SuperAvenir.war" (runtime-name: "SuperAvenir.war")
17:52:21,235 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:/superavenir-datasource]
17:52:21,323 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-1) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
17:52:21,408 INFO  [org.jboss.ws.common.management] (MSC service thread 1-4) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4) 
17:52:24,841 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb-api.jar in /C:/Programmation/JBoss/wildfly-10.0.0.Final/standalone/deployments/SuperAvenir.war/WEB-INF/lib/jaxb-core-2.2.7.jar  does not point to a valid jar for a Class-Path reference.
17:52:24,842 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb-api.jar in /C:/Programmation/JBoss/wildfly-10.0.0.Final/standalone/deployments/SuperAvenir.war/WEB-INF/lib/jaxb-impl-2.2.7.jar  does not point to a valid jar for a Class-Path reference.
17:52:24,842 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0059: Class Path entry jaxb-core.jar in /C:/Programmation/JBoss/wildfly-10.0.0.Final/standalone/deployments/SuperAvenir.war/WEB-INF/lib/jaxb-impl-2.2.7.jar  does not point to a valid jar for a Class-Path reference.
17:52:25,498 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0003: Processing weld deployment SuperAvenir.war
17:52:25,585 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-4) HV000001: Hibernate Validator 5.2.3.Final
17:52:25,709 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'EmailCRON' in deployment unit 'deployment "SuperAvenir.war"' are as follows:

    java:global/SuperAvenir/EmailCRON!fr.superavenir.ejb.EmailCRON
    java:app/SuperAvenir/EmailCRON!fr.superavenir.ejb.EmailCRON
    java:module/EmailCRON!fr.superavenir.ejb.EmailCRON
    java:global/SuperAvenir/EmailCRON
    java:app/SuperAvenir/EmailCRON
    java:module/EmailCRON

17:52:25,710 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'GeneralCRON' in deployment unit 'deployment "SuperAvenir.war"' are as follows:

    java:global/SuperAvenir/GeneralCRON!fr.superavenir.ejb.GeneralCRON
    java:app/SuperAvenir/GeneralCRON!fr.superavenir.ejb.GeneralCRON
    java:module/GeneralCRON!fr.superavenir.ejb.GeneralCRON
    java:global/SuperAvenir/GeneralCRON
    java:app/SuperAvenir/GeneralCRON
    java:module/GeneralCRON

17:52:25,710 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-4) WFLYEJB0473: JNDI bindings for session bean named 'MulticastCRON' in deployment unit 'deployment "SuperAvenir.war"' are as follows:

    java:global/SuperAvenir/MulticastCRON!fr.superavenir.ejb.MulticastCRON
    java:app/SuperAvenir/MulticastCRON!fr.superavenir.ejb.MulticastCRON
    java:module/MulticastCRON!fr.superavenir.ejb.MulticastCRON
    java:global/SuperAvenir/MulticastCRON
    java:app/SuperAvenir/MulticastCRON
    java:module/MulticastCRON

17:52:25,954 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0006: Starting Services for CDI deployment: SuperAvenir.war
17:52:25,992 INFO  [org.jboss.weld.Version] (MSC service thread 1-4) WELD-000900: 2.3.2 (Final)
17:52:26,036 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0009: Starting weld service for deployment SuperAvenir.war
17:52:26,947 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 6) WELD-001125: Illegal bean type class org.jboss.resteasy.plugins.providers.AbstractEntityProvider<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes @Produces class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider
17:52:26,948 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 6) WELD-001125: Illegal bean type interface javax.ws.rs.ext.MessageBodyReader<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes @Produces class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider
17:52:26,948 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 6) WELD-001125: Illegal bean type org.jboss.resteasy.plugins.providers.jaxb.AbstractJAXBProvider<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes @Produces class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider
17:52:26,948 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 6) WELD-001125: Illegal bean type interface javax.ws.rs.ext.MessageBodyWriter<javax.xml.bind.JAXBElement<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes @Produces class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider
17:52:26,964 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 9) WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyReader<java.util.List<?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes class org.jboss.resteasy.plugins.providers.multipart.ListMultipartReader
17:52:26,967 INFO  [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 9) WELD-001125: Illegal bean type javax.ws.rs.ext.MessageBodyReader<java.util.Map<?, ?>> ignored on [EnhancedAnnotatedTypeImpl] public @ApplicationScoped @Provider @Consumes class org.jboss.resteasy.plugins.providers.multipart.MapMultipartFormDataReader
17:52:28,794 INFO  [io.undertow.websockets.jsr] (ServerService Thread Pool -- 62) UT026003: Adding annotated server endpoint class fr.superavenir.servlet.ChatWebsocket for path /chat-ws
17:52:28,900 INFO  [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 62) Initialisation de Mojarra 2.2.12-jbossorg-2 20150729-1131 pour le contexte «»
17:52:30,626 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 62) WFLYUT0021: Registered web context: /
17:52:30,698 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 31) WFLYSRV0010: Deployed "SuperAvenir.war" (runtime-name : "SuperAvenir.war")
17:52:30,883 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
17:52:30,883 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
17:52:30,883 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 13946ms - Started 439 of 743 services (396 services are lazy, passive or on-demand)

时间17:52:24,841的三个日志对我来说很奇怪,我不知道那三个人的影响是什么。我应该为build.gradle添加一些依赖项吗?这是:

apply plugin: 'java-library'
apply plugin: 'war'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    compile  'org.json:json:20160810'
    compile 'org.apache.poi:poi-ooxml:3.15'

    compile 'commons-validator:commons-validator:1.6'

    compile 'org.apache.commons:commons-csv:1.4'
    compile 'commons-io:commons-io:2.5'

    compile 'javax.ejb:javax.ejb-api:3.2'
    compile 'javax.inject:javax.inject:1'
    compile 'javax.ws.rs:javax.ws.rs-api:2.0.1'
    compile 'javax.websocket:javax.websocket-api:1.1'
    compile 'javax.enterprise:cdi-api:1.2'
    compile 'javax.mail:mail:1.4.7'
    compile 'javax.json:javax.json-api:1.0'
    compile 'javax.servlet:javax.servlet-api:3.1.0'
    compile 'org.apache.poi:poi-ooxml:3.9'
    compile 'org.jboss.resteasy:resteasy-multipart-provider:3.1.1.Final'
    compile files('WebContent/WEB-INF/lib/DKIMforJavaMail.jar')

}

war {
    from('src/main/java/fr/superavenir/i18n/') {
        into('WEB-INF/classes/fr/superavenir/i18n')
        include "**/*"     
    }
}

1 个答案:

答案 0 :(得分:0)

我正在使用WildFly 10.1 Final,当使用JAXB时会遇到类似的错误:

  

JBWS022052:启动JBossWS 5.1.3.Final(Apache CXF 3.1.4)   WFLYSRV0059:/C:/...war/WEB-INF/lib/jaxb-core-2.2.7.jar中的类路径条目jaxb-api.jar未指向类路径引用的有效jar。< / p>      

WFLYSRV0059: /C:/...war/WEB-INF/lib/jaxb-impl-2.2.7.jar中的类路径条目jaxb-api.jar未指向类路径引用的有效jar。

     

WFLYSRV0059: /C:/...war/WEB-INF/lib/jaxb-impl-2.2.7.jar中的类路径条目jaxb-core.jar未指向类路径引用的有效jar。

     

WELD-001125:非法bean类型类org.jboss.resteasy.plugins.providers.AbstractEntityProvider&gt;在[...] public @ApplicationScoped @Provider @Consumes @Produces class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider

上忽略

只有当我在父pom中添加这些依赖项时,警告/错误才会停止显示:

<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>3.1.4.Final</version>
    <scope>provided</scope>
</dependency>

<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jettison-provider</artifactId>
    <version>3.1.4.Final</version>
    <scope>provided</scope>
</dependency>

我的项目是Maven,尝试在Gradle中应用这些依赖项。