我得到繼承EAR application,我需要繼續開發。在Websphere Application Server完整配置文件8.5中,我無法使其在Websphere Liberty 16.0.0.4上工作,但它工作正常。不幸的是(或幸運:))我的工作站是Macbook Pro,並且WAS Full Profile無法安裝在OSX上(目前無法找到鏈接,但已經完成了一些搜索並找到了足夠的證據),所以我需要在Linux上使用VirtualBox或嘗試在Liberty上運行此應用程序。EAR應用程序在Websphere8.5上工作,但拒絕在Websphere Liberty上工作16.0.0.4
最新的解決方案並沒有爲我工作這麼好,我得到以下錯誤:
[ERROR ] CWWJP0012E: The persistence unit name is not specified and a unique persistence unit is not found in the BigEnterpriseAppEAR application and BigEnterpriseAppEJB.jar module. [ERROR ] CWWJP0029E: The server cannot find the persistence unit in the BigEnterpriseAppEJB.jar module and the BigEnterpriseAppEAR application. [ERROR ] CWNEN0035E: The java:comp/env/BigEnterpriseApp reference of type javax.persistence.EntityManager for the DataProvider component in the BigEnterpriseAppEJB.jar module of the BigEnterpriseAppEAR application cannot be resolved. [ERROR ] CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "getDataByOwner" on bean "BeanId(BigEnterpriseAppEAR#BigEnterpriseAppWEB.war#DataAPI, null)". Exception data: javax.ejb.EJBTransactionRolledbackException: nested exception is: javax.ejb.EJBException: The java:comp/env/BigEnterpriseApp reference of type javax.persistence.EntityManager for the DataProvider component in the BigEnterpriseAppEJB.jar module of the BigEnterpriseAppEAR application cannot be resolved.
應用程序是非常簡單的EAR
= JPA
+ EJB
+ WAR
我不知道哪些配置文件會有幫助,所以只需在評論中寫下要發佈的內容,然後我就可以做到。
預先感謝您。
UPDATE 1:
server.xml
文件:
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>localConnector-1.0</feature>
<feature>servlet-3.1</feature>
<feature>ejbLite-3.1</feature>
<feature>jndi-1.0</feature>
<feature>jaxrs-1.1</feature>
<feature>ssl-1.0</feature>
<feature>jpa-2.0</feature>
<feature>cdi-1.0</feature>
</featureManager>
<basicRegistry id="basic" realm="BasicRealm">
<!-- <user name="yourUserName" password="" /> -->
</basicRegistry>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="true"/>
<applicationMonitor updateTrigger="mbean"/>
<library id="DB2JCC4Lib">
<fileset dir="/Users/anatoly/developer/sql_drivers" includes="*.jar"/>
</library>
<dataSource id="db2_slc" jndiName="jdbc/BEADB" type="javax.sql.DataSource">
<jdbcDriver libraryRef="DB2JCC4Lib"/>
<properties.db2.jcc databaseName="beadb" password="********" portNumber="50000" serverName="db2server" user="db2username"/>
</dataSource>
<keyStore id="defaultKeyStore" password="******"/>
<enterpriseApplication id="BigEnterpriseAppEAR" location="BigEnterpriseAppEAR.ear" name="BigEnterpriseAppEAR"/>
</server>
persistence.xml
文件,位於BigEnterpriseAppJPA>來源>在位於打包的EAR persistence.xml
META-INF>的persistence.xml
BigEnterpriseAppEAR - > BigEnterpriseAppJPA.jar - > META-INF - > 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="BigEnterpriseApp">
<jta-data-source>jdbc/BEADB</jta-data-source>
<class>com.bea.entities.System</class>
<class>com.bea.entities.Data</class>
<class>com.bea.entities.User</class>
<class>com.bea.entities.Group</class>
<properties>
<property name="openjpa.jdbc.Schema" value="BEADB" />
<property name="openjpa.ConnectionRetainMode" value="transaction" />
</properties>
</persistence-unit>
</persistence>
一個好的開始是發佈你的server.xml和persistence.xml。 –
@Fowowe,完成。謝謝! – Anatoly
persistence.xml的位置是什麼? –