java - EJB 的数据源问题

标签 java jboss ejb

在让我的 EJB 正常工作时遇到了一些问题 - 最终设法让我的 JBoss 服务器与 Netbeans 正常工作,现在我收到以下错误,这似乎与我的数据源有关:

服务器日志如下:

2012-03-11 19:05:11,181 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) undeploy, ctxPath=/group4_Implementation-war
2012-03-11 19:05:12,373 INFO  [org.jboss.profileservice.management.upload.remoting.DeployHandler] (WorkerThread#0[127.0.0.1:30606]) invoke, payload: {DeploymentTargetID=names=[group4_Implementation.ear], clientAddress=/127.0.0.1}, parameter: start
2012-03-11 19:05:12,374 WARN  [org.jboss.profileservice.management.upload.remoting.DeployHandler] (WorkerThread#0[127.0.0.1:30606]) Failed to complete command: [start] for deployment: names=[group4_Implementation.ear]: org.jboss.profileservice.spi.NoSuchDeploymentException: group4_Implementation.ear
    at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.resolveProfileForDeployment(AbstractDeployHandler.java:291) [:0.2.2]
    at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.resolveProfiles(AbstractDeployHandler.java:248) [:0.2.2]
    at org.jboss.profileservice.plugins.deploy.AbstractDeployHandler.startDeployments(AbstractDeployHandler.java:157) [:0.2.2]
    at org.jboss.profileservice.management.upload.remoting.DeployHandlerDelegate.startDeployments(DeployHandlerDelegate.java:74) [:6.1.0.Final]
    at org.jboss.profileservice.management.upload.remoting.DeployHandler.invoke(DeployHandler.java:156) [:6.1.0.Final]
    at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:967) [:6.1.0.Final]
    at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791) [:6.1.0.Final]
    at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744) [:6.1.0.Final]
    at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548) [:6.1.0.Final]
    at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234) [:6.1.0.Final]

2012-03-11 19:05:16,436 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/group4_Implementation-war
2012-03-11 19:05:16,469 WARN  [org.jboss.profileservice.deployment.hotdeploy.HDScanner] (HDScanner) Scan failed: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "persistence.unit:unitName=group4_Implementation.ear/group4_Implementation-ejb.jar#wvp08heuPU" is missing the following dependencies:
    Dependency "jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding' **")

DEPLOYMENTS IN ERROR:
  Deployment "jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding' **

    at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370) [:2.2.2.GA]
    at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316) [:2.2.2.GA]
    at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968) [:2.2.2.GA]
    at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:82) [:6.1.0.Final]
    at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.checkComplete(ProfileControllerContext.java:138) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:246) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) [:0.2.2]
    at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:57) [:0.2.2]
    at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) [:0.2.2]
    at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:95) [:0.2.2]
    at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) [:0.2.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_20]
    at java.lang.Thread.run(Unknown Source) [:1.6.0_20]

2012-03-11 19:05:21,516 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) undeploy, ctxPath=/group4_Implementation-war
2012-03-11 19:05:21,703 INFO  [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (HDScanner) deploy, ctxPath=/group4_Implementation-war
2012-03-11 19:05:21,734 WARN  [org.jboss.profileservice.deployment.hotdeploy.HDScanner] (HDScanner) Scan failed: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "persistence.unit:unitName=group4_Implementation.ear/group4_Implementation-ejb.jar#wvp08heuPU" is missing the following dependencies:
    Dependency "jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding' **")

DEPLOYMENTS IN ERROR:
  Deployment "jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=POSTGRES-EJB,service=DataSourceBinding' **

    at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370) [:2.2.2.GA]
    at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316) [:2.2.2.GA]
    at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968) [:2.2.2.GA]
    at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.checkComplete(MainDeployerPlugin.java:82) [:6.1.0.Final]
    at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.checkComplete(ProfileControllerContext.java:138) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.deploy(HDScanner.java:246) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner$HDScanAction.complete(HDScanner.java:192) [:0.2.2]
    at org.jboss.profileservice.management.TwoPCActionWrapper.doComplete(TwoPCActionWrapper.java:57) [:0.2.2]
    at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.complete(AbstractTwoPhaseModificationAction.java:74) [:0.2.2]
    at org.jboss.profileservice.management.actions.AbstractTwoPhaseModificationAction.prepare(AbstractTwoPhaseModificationAction.java:95) [:0.2.2]
    at org.jboss.profileservice.management.ModificationSession.prepare(ModificationSession.java:87) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.internalPerfom(AbstractActionController.java:234) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.performWrite(AbstractActionController.java:213) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:150) [:0.2.2]
    at org.jboss.profileservice.management.AbstractActionController.perform(AbstractActionController.java:135) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner.scan(HDScanner.java:146) [:0.2.2]
    at org.jboss.profileservice.deployment.hotdeploy.HDScanner.run(HDScanner.java:90) [:0.2.2]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.FutureTask.runAndReset(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_20]
    at java.lang.Thread.run(Unknown Source) [:1.6.0_20]

我的持久性单元:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
  <!-- The name attribute gives the name that the persistence unit will have
  when it's loaded inside JBoss.
  This is what you use in the PersistenceContext annotation in your class.
  -->
  <persistence-unit name="wvp08heuPU" transaction-type="JTA">
    <!-- This is a reference to the datasource that is used.
    By keeping this seperate it allow the container to pool database connections
    for you, improving performance. It also provide as extra layer of indirection
    allowing the details of the database to be kept seperate from this code.
    -->
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>java:/POSTGRES-EJB</jta-data-source>
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
      <property name="hibernate.show_sql" value="true"/>
      <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

我已经设置了一个数据源,并且它已确认与数据库的连接。

以下技术不确定是否有帮助:

JBoss 6.1.0

Netbeans 7.1.1

Postgres:8.4

任何帮助将不胜感激......

刘易斯

最佳答案

您必须在 JBoss 的文件夹 server/default/deploy 中创建包含数据源 POSTGRES-EJB 配置的 xml,或者在 JBoss 管理控制台的帮助下设置配置。

More here

关于java - EJB 的数据源问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9658087/

相关文章:

java - 如何将 Spring 依赖项注入(inject)到消息驱动 EJB 中?

@Asynchronous bean 中的 Java 注入(inject)

java - JBoss RMI 事务

java - 软件设计: one object available from all classes?

java - 在将自定义对象返回到 mule 流时我做错了什么以及如何返回可由另一个 mule 流使用的对象?

java - Selenium Webdriver (Java) : What are the benefits (if any) of using an objectmap. 属性文件而不是页面对象类?

java - 如何使用 boolean 值添加用户输入的数字?

java - JBoss EAP 7 中缺少 Jackson 依赖项

java - quartz如何启动EJB无状态组件?

java - 如何将 jdbc-realm 配置为 jBoss jbpm