我正在尝试将wildfly-swarm与project-stages.yml
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="somePU" transaction-type="JTA">
<jta-data-source>someDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="javax.persistence.validation.mode" value="CALLBACK" />
</properties>
</persistence-unit>
</persistence>
project:
stage: default
---
project:
stage: development
logger:
level: DEBUG
swarm:
jdbc:
driver: org.apache.derby.jdbc.EmbeddedDriver
ds:
name: someDS
connection:
url: jdbc:derby:memory:someDB;create=true
port:
offset: 200
---
project:
stage: integration
---
project:
stage: staging
---
project:
stage: production
2017-01-07 18:09:48,782 ERROR [stderr] (main) java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,782 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,783 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,784 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,784 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,784 ERROR [stderr] (main) ... 7 more
2017-01-07 18:09:48,784 ERROR [stderr] (main) Exception in thread "main" java.lang.reflect.InvocationTargetException
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at java.lang.reflect.Method.invoke(Method.java:498)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:37)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.run(Main.java:44)
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.bootstrap.Main.main(Main.java:35)
2017-01-07 18:09:48,785 ERROR [stderr] (main) Caused by: org.wildfly.swarm.container.DeploymentException: WFSWARM0007: Deployment failed: {"WFLYCTL0412: Required services that are not installed:" => ["jboss.naming.context.java.jboss.datasources.someDS"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"some-server.war#somePU\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.someDS]","jboss.persistenceunit.\"some-server.war#somePU\" is missing [jboss.naming.context.java.jboss.datasources.someDS]"]}
2017-01-07 18:09:48,785 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:280)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.container.runtime.RuntimeDeployer.deploy(RuntimeDeployer.java:95)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.deploy(Swarm.java:475)
2017-01-07 18:09:48,786 ERROR [stderr] (main) at org.wildfly.swarm.Swarm.main(Swarm.java:612)
2017-01-07 18:09:48,786 ERROR [stderr] (main) ... 7 more
答案 0 :(得分:3)
我正在为他人分享我的解决方案。
正如simas_ch所指出的那样,How to create a datasource足以解决这个问题。
swarm:
datasources:
data-sources:
someDS:
driver-name: h2
connection-url: jdbc:h2:mem:someDB
这部分总是最痛苦的。我不得不这样做。
<jta-data-source>java:jboss/datasources/someDS</jta-data-source>