JBoss AS 6에서 Wildfly 10으로 애플리케이션을 이전하기 위해 작업 해 왔습니다. 내가 겪었던 주요 문제는 EntityManager가 EJB에 삽입되지 않는다는 것입니다. 나는 이것을 잠시 동안 연구하고 찾은 모든 것을 시도했지만 도움이되는 것은 아무것도 없다.WildFly 10에 삽입 될 때 EntityManager가 null입니다.
아직 간단한 문제를 재현 할 수있는 응용 프로그램이 없지만 여기에 몇 가지 세부 정보 및 코드 조각이 있습니다.
SAR 파일을 사용하여 배포하고 있습니다. 이것은 Spring 프레임 워크 애플리케이션이다. 이제 2 차 수준 캐시가 꺼집니다. 그것이 내가 해결해야 할 또 다른 문제입니다.
의 persistence.xml : 독립-full.xml에서 데이터 소스의
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="1.0">
<persistence-unit name="IpsDb" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/HarmonyServerDS</jta-data-source>
<jar-file>../harmonyserver-model.jar</jar-file>
<properties>
<!-- pessimistic lock timeout in milliseconds (Integer or String), this is a hint used by Hibernate but requires support by your underlying database. -->
<property name="javax.persistence.lock.timeout" value="15000"/>
<!-- query timeout in milliseconds (Integer or String), this is a hint used by Hibernate but requires support by your underlying database -->
<property name="javax.persistence.query.timeout" value="15000"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" />
<property name="hibernate.cache.use_query_cache" value="false"/>
<property name="hibernate.cache.use_second_level_cache" value="false"/>
</properties>
</persistence-unit>
</persistence>
시작하십시오 EJB 클래스에서
<datasource jta="true" jndi-name="java:jboss/datasources/HarmonyServerDS" pool-name="HarmonyServerDS" enabled="true" use-java-context="true" spy="false" use-ccm="true" connectable="false">
(이것들은 중요한 부분 만있는 것은 아닙니다에서 모든 코드 클래스) :
@Stateless
@Clustered
public class DataModificationBean implements DataModificationLocal {
@PersistenceUnit(unitName="IpsDb")
private EntityManagerFactory entityMgrFactory;
@PersistenceContext(unitName="IpsDb")
private EntityManager entityMgr;
@Override
@Transactional(propagation=Propagation.REQUIRES_NEW)
@InterruptOnTransactionTimeout(value=true)
public DataModificationResponse handleModification(DataModification mod, ModificationHandler handler, AdaptationContext adaptation, boolean bulk_lock)
{
try {
// Handler's data update monitor for delta changes.
DataUpdateMonitor updateMonitor = null;
// Pre-process the request and gather up the dataContext for processing.
logger.info("DataModificationBean EntityMgr=" + (entityMgr == null ? "null" : entityMgr.toString()));
logger.info("DataModificationBean EntityMgrFactory=" + (entityMgrFactory == null ? "null" : entityMgrFactory.toString()));
handler.preProcess(this, entityMgr);
...
해당 스니 j의 맨 아래에있는 로깅은 entityMgr 및 ent ityMgrFactory가 null입니다.
내가 놓친 다른 것이 있습니까? 아니면 제가 도움이 될만한 것을 보여 줄 수있는 다른 것?