2017-01-09 16 views
1

私は開発を続ける必要がある継承EAR applicationを取得します。私がそれをWebsphere Liberty 16.0.0.4で動作させることができないという問題は、Websphere Application Server Full Profile 8.5ではうまくいきます。残念ながら、(幸いにも:))私のワーキングステーションは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> SRC>に位置するパッケージ化EAR persistence.xml

persistence.xmlのMETA-INF> 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> 
+0

良いスタートは、server.xmlとpersistence.xmlを投稿することです。 –

+0

@FRowe、done。ありがとうございました! – Anatoly

+0

persistence.xmlの場所はどこですか? –

答えて

0

[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.

これはあなたのpersistence.xmlのルーツはJPAの仕様で定義された法的な場所ではないことを意味するものだろう、セクション8.2:

In Java EE environments, the root of a persistence unit must be one of the following:

  • an EJB-JAR file
  • the WEB-INF/classes directory of a WAR file[87]
  • a jar file in the WEB-INF/lib directory of a WAR file
  • a jar file in the EAR library directory
  • an application client jar file

NOTE: Java Persistence 1.0 supported use of a jar file in the root of the EAR as the root of a persistence unit. This use is no longer supported. Portable applications should use the EAR library directory for this case instead

あなたのセットアップは、#を使用しようとしているように見えます4

BigEnterpriseAppEAR -> BigEnterpriseAppJPA.jar -> META-INF -> persistence.xml

BigEnterpriseAppJPA.jarは、あなたのEARライブラリディレクトリ内に配置する必要があります。私は、これはデフォルトでのlib BigEnterpriseAppEAR/になると信じていますが、EAR

であなたの/ META-INF/のapplication.xmlまた永続ユニット名は一意である必要があることに、注意してこれを設定することができます。すべての永続ユニット名が同じ名前を使用していないことを確認してください。

関連する問題