我试图从Glassfish AS迁移到WildFly AS。
在Wildfly中创建JDBC数据源并相应地更改了persistnce.xml后,我在部署时遇到此错误:
的server.log:
2014-04-10 10:34:26,496 INFO [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.2.0.Final
2014-04-10 10:34:26,552 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
2014-04-10 10:34:26,569 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 39) JBAS012615: Activated the following JSF Implementations: [main]
2014-04-10 10:34:26,589 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem
2014-04-10 10:34:26,601 INFO [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem
2014-04-10 10:34:26,604 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
2014-04-10 10:34:26,612 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting
2014-04-10 10:34:26,619 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem.
2014-04-10 10:34:26,729 INFO [org.jboss.as.connector.logging] (MSC service thread 1-7) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.3.Final)
2014-04-10 10:34:26,744 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017502: Undertow 1.0.0.Final starting
2014-04-10 10:34:26,612 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
2014-04-10 10:34:26,770 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\Users\xy\Desktop\wildfly2/welcome-content
2014-04-10 10:34:26,742 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 4.0.0.Final
2014-04-10 10:34:26,776 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = h2
2014-04-10 10:34:26,785 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010417: Started Driver service with driver-name = mysql
2014-04-10 10:34:26,813 INFO [org.jboss.as.security] (MSC service thread 1-4) JBAS013170: Current PicketBox version=4.0.20.Final
2014-04-10 10:34:26,823 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017525: Started server default-server.
2014-04-10 10:34:26,841 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017531: Host default-host starting
2014-04-10 10:34:26,850 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default]
2014-04-10 10:34:26,859 INFO [org.jboss.as.naming] (MSC service thread 1-6) JBAS011802: Starting Naming Service
2014-04-10 10:34:27,117 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:/jdbc/Application]
2014-04-10 10:34:27,194 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080
2014-04-10 10:34:27,196 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) JBAS015012: Started FileSystemDeploymentService for directory C:\Users\xy\Desktop\wildfly2\standalone\deployments
2014-04-10 10:34:27,201 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "bg-application-1.0.war" (runtime-name: "bg-application-1.0.war")
2014-04-10 10:34:27,309 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
2014-04-10 10:34:27,448 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final
2014-04-10 10:34:29,406 WARN [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016017: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It is not portable to use both locations at the same time. Weld is going to use the former location for this deployment.
2014-04-10 10:34:29,610 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for Application
2014-04-10 10:34:30,019 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "bg-application-1.0.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"bg-application-1.0.war#Application\" is missing [jboss.naming.context.java.jboss.datasources.Application]"]}
2014-04-10 10:34:30,067 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "bg-application-1.0.war" (runtime-name : "bg-application-1.0.war")
2014-04-10 10:34:30,069 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.Application (missing) dependents: [service jboss.persistenceunit."bg-application-1.0.war#Application"]
2014-04-10 10:34:30,219 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
2014-04-10 10:34:30,221 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
2014-04-10 10:34:30,222 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.0.0.Final "WildFly" started (with errors) in 5908ms - Started 202 of 253 services (2 services failed or missing dependencies, 82 services are lazy, passive or on-demand)
2014-04-10 10:34:30,383 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment bg-application-1.0.war (runtime-name: bg-application-1.0.war) in 72ms
2014-04-10 10:34:30,725 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "bg-application-1.0.war" (runtime-name: "bg-application-1.0.war")
2014-04-10 10:34:30,727 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.persistenceunit."bg-application-1.0.war#Application" (missing) dependents: [service jboss.deployment.unit."bg-application-1.0.war".POST_MODULE]
2014-04-10 10:34:35,092 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found bg-application-1.0.war in deployment directory. To trigger deployment create a file called bg-application-1.0.war.dodeploy
2014-04-10 10:35:12,499 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "bg-application-1.0.war" (runtime-name: "bg-application-1.0.war")
2014-04-10 10:35:16,972 WARN [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016017: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It is not portable to use both locations at the same time. Weld is going to use the former location for this deployment.
2014-04-10 10:35:16,988 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for Application
2014-04-10 10:35:17,345 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ({"deployment" => "bg-application-1.0.war"}) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"bg-application-1.0.war#Application\" is missing [jboss.naming.context.java.jboss.jdbc.Application]"]}
2014-04-10 10:35:17,349 ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "bg-application-1.0.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"bg-application-1.0.war#Application\" is missing [jboss.naming.context.java.jboss.jdbc.Application]"]}
2014-04-10 10:35:18,696 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment bg-application-1.0.war (runtime-name: bg-application-1.0.war) in 1347ms
2014-04-10 10:35:18,698 INFO [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.jdbc.Application (missing) dependents: [service jboss.persistenceunit."bg-application-1.0.war#Application"]
JBAS014776: Newly corrected services:
service jboss.naming.context.java.jboss.datasources.Application (no longer required)
2014-04-10 10:54:57,813 INFO [org.jboss.as.repository] (management-handler-thread - 7) JBAS014900: Content added at location C:\Users\xy\Desktop\wildfly2\standalone\data\content\bd\45d5d7e308fcffae0443c0bda8783997978d52\content
2014-04-10 10:54:57,818 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "bg-application-1.0.war" (runtime-name: "bg-application-1.0.war")
2014-04-10 10:55:02,312 WARN [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016017: Found both WEB-INF/beans.xml and WEB-INF/classes/META-INF/beans.xml. It is not portable to use both locations at the same time. Weld is going to use the former location for this deployment.
2014-04-10 10:55:02,327 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for Application
2014-04-10 10:55:03,145 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 52) JBAS011402: Starting Persistence Unit Service 'bg-application-1.0.war#Application'
2014-04-10 10:55:03,464 WARN [org.jboss.modules] (ServerService Thread Pool -- 52) Failed to define class org.eclipse.persistence.internal.helper.Helper in Module "deployment.bg-application-1.0.war:main" from Service Module Loader: java.lang.StackOverflowError
at java.lang.ref.Finalizer.<init>(Finalizer.java:85) [rt.jar:1.7.0_25]
at java.lang.ref.Finalizer.register(Finalizer.java:90) [rt.jar:1.7.0_25]
at java.lang.Object.<init>(Object.java:37) [rt.jar:1.7.0_25]
at java.io.InputStream.<init>(InputStream.java:45) [rt.jar:1.7.0_25]
at java.util.zip.ZipFile$ZipFileInputStream.<init>(ZipFile.java:659) [rt.jar:1.7.0_25]
at java.util.zip.ZipFile.getInputStream(ZipFile.java:356) [rt.jar:1.7.0_25]
at java.util.jar.JarFile.getInputStream(JarFile.java:409) [rt.jar:1.7.0_25]
at org.jboss.vfs.spi.JavaZipFileSystem.openInputStream(JavaZipFileSystem.java:186) [jboss-vfs-3.2.2.Final.jar:3.2.2.Final]
at org.jboss.vfs.VirtualFile.openStream(VirtualFile.java:258) [jboss-vfs-3.2.2.Final.jar:3.2.2.Final]
at org.jboss.as.server.deployment.module.VFSResourceLoader$2.run(VFSResourceLoader.java:133)
at org.jboss.as.server.deployment.module.VFSResourceLoader$2.run(VFSResourceLoader.java:124)
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_25]
at org.jboss.as.server.deployment.module.VFSResourceLoader.getClassSpec(VFSResourceLoader.java:124)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:252) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.Module.loadModuleClass(Module.java:548) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:189) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4667) [eclipselink-2.6.0-M2.jar:2.6.0.v20130815-a4708b6]
at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4639) [eclipselink-2.6.0-M2.jar:2.6.0.v20130815-a4708b6]
at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4615) [eclipselink-2.6.0-M2.jar:2.6.0.v20130815-a4708b6]
at org.eclipse.persistence.internal.sessions.AbstractSession.log(AbstractSession.java:4564) [eclipselink-2.6.0-M2.jar:2.6.0.v20130815-a4708b6]
at org.eclipse.persistence.internal.jpa.weaving.PersistenceWeaver.transform(PersistenceWeaver.java:127) [eclipselink-2.6.0-M2.jar:2.6.0.v20130815-a4708b6]
at org.jboss.as.jpa.classloader.JPADelegatingClassFileTransformer.transform(JPADelegatingClassFileTransformer.java:48) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]
at org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:415) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76) [jboss-modules.jar:1.3.0.Final]
at org.jboss.modules.Module.loadModuleClass(Module.java:548) [jboss-modules.jar:1.3.0.Final]
我的persistence.xml如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="Application" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/jdbc/Application</jta-data-source>
<!--<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.deploy-on-startup" value="True" />
</properties>-->
</persistence-unit>
</persistence>
standalone.xml中的子系统部分:
<subsystem xmlns="urn:jboss:domain:datasources:2.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jta="false" jndi-name="java:/jdbc/Application" pool-name="Application" enabled="true" use-ccm="false">
<connection-url>jdbc:mysql://**:3306/test</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>15</max-pool-size>
</pool>
<security>
<user-name>test</user-name>
<password>**</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.jdbc.Driver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
任何人都可以帮助我吗? 经过几个小时的谷歌搜索后,卡住了。
提前谢谢!!
答案 0 :(得分:0)
在persistence.xml中试用<non-jta-data-source>java:/jdbc/Application</non-jta-data-source>
,因为您已将数据源声明的jta-property设置为false。