2017-01-09 19 views
1

Я получаю в наследство EAR application, который мне нужно продолжать развивать. Проблема, что я не могу заставить ее работать с Websphere Liberty 16.0.0.4, а на WebSphere Application Server Full Profile 8.5 работает отлично. К сожалению или (к счастью :)) моей рабочей станцией является Macbook Pro, и полный профиль WAS не может быть установлен на OSX (сейчас не удается найти ссылки, но сделал некоторые поиски и нашел достаточно доказательств для него), поэтому мне нужно используйте VirtualBox с Linux или попробуйте запустить это приложение на 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> ЦСИ> META-INF> persistence.xml

в упакованном EAR 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> 
+0

Хорошим началом было бы опубликовать ваш server.xml и persistence.xml. –

+0

@FRowe, сделано. Спасибо! – 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. Я считаю, что это будет BigEnterpriseAppEAR/Библиотека по умолчанию, но вы можете настроить это с/META-INF/application.xml в EAR

Также обратите внимание, что имя живучесть-блок должен быть уникальным. Убедитесь, что все имена единиц хранения не используют одно и то же имя.