我有一个应用程序将ejb模块打包到一个ear文件中。当我想部署到Wildfly时,我得到以下错误。根据{{3}}帖子,standalone.xml文件不行。我检查过我的,很好。
有人可以告诉我这里可能出现什么问题吗?
的persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="PU" transaction-type="JTA">
<jta-data-source>jdbc:postgresql://localhost:5432/Database</jta-data-source>
<properties>
<property name="hibernate.connection.username" value="postgres"/>
<property name="hibernate.connection.password" value="postgres" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL95Dialect"/>
</properties>
</persistence-unit>
</persistence>
Wildfly控制台日志。
16:41:50,200 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."DigitalLibrary.MasterData.Dataservice.ear"."MasterData.Ejb.jar".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."DigitalLibrary.MasterData.Dataservice.ear"."MasterData.Ejb.jar".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of subdeployment "MasterData.Ejb.jar" of deployment "DigitalLibrary.MasterData.Dataservice.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
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.IllegalArgumentException: Empty name segment is not allowed for jdbc:postgresql:
at org.jboss.msc.service.ServiceName.of(ServiceName.java:90)
at org.jboss.msc.service.ServiceName.append(ServiceName.java:117)
at org.jboss.as.naming.deployment.ContextNames.buildServiceName(ContextNames.java:203)
at org.jboss.as.naming.deployment.ContextNames$BindInfo.<init>(ContextNames.java:215)
at org.jboss.as.naming.deployment.ContextNames$BindInfo.<init>(ContextNames.java:206)
at org.jboss.as.naming.deployment.ContextNames.bindInfoFor(ContextNames.java:136)
at org.jboss.as.naming.deployment.ContextNames.bindInfoForEnvEntry(ContextNames.java:190)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:502)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:276)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleJarDeployment(PersistenceUnitServiceHandler.java:163)
at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:133)
at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
答案 0 :(得分:2)
“jta-data-source指向此持久性单元映射到的数据库的JNDI名称。”来自链接https://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/ch01s02s01.html
但您已经配置了connection-url。可以从jboss管理页面配置数据源,也可以通过修改独立文件来配置数据源。一个例子 - https://developer.jboss.org/wiki/JBossAS7-DatasourceConfigurationForPostgresql?_sscc=t