我的 Java EE 项目有问题。我尝试访问我的数据库,但出现以下异常:
cannot Deploy SupinBank
Deployment Error for module: SupinBank:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException:
javax.ejb.EJBTransactionRolledbackException. Please see server.log for more details.
此外,我的项目中没有创建任何 persistence.xml
。这正常吗?
如果您想了解 server.log 的更多详细信息,请告诉我。
最佳答案
来自您的日志文件:
Caused by: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName SupinBank-PU
如果您使用 JPA,您将需要 persistence.xml 文件。服务器日志指出它应该有一个名为 SupinBank-PU 的持久单元。您需要提供此文件才能使您的项目运行。
关于java - 我的项目中没有 persistence.xml,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9446360/