NamenotFoundException for entity manager factory JBoss EAP 6.3 - java

I am using Seam 2.2, Hibernate 4 and JBOSS EAP 6.3. I have received the following error,
Caused by: javax.naming.NameNotFoundException: AmasterEntityManagerFactory -- service jboss.naming.context.java.jboss.AmasterEntityManagerFactory
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:103)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:174)
at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:243)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_11]
at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_11]
at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:241) [jboss-seam-2.2.0.GA.jar:2.2.0.GA]
... 168 more
In my persistence.xml
<property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/AmasterEntityManagerFactory"/>
In components.xml
<persistence:managed-persistence-context name="entityManager"
auto-create="true"
persistence-unit-jndi-name="java:jboss/AmasterEntityManagerFactory"/>
Anyone faced this problem before? Please provide your suggestions.

I have resolved the issue.
Instead of persistence-unit-jndi-name attribute I have added persistence-unit-name in the persistence:entity-manager-factory
And instead of persistence-unit-jndi-name attribute added entity-manager-factory="#{entityManagerFactory}"
<persistence:entity-manager-factory name="entityManagerFactory" persistence-unit-name="AccountMaster"/>
<persistence:managed-persistence-context name="entityManager"
auto-create="true" entity-manager-factory="#{entityManagerFactory}"/>

Seam 2.2 is only compatible with hibernate 3 (I think 3.6).
According to seam 2 Initialization, migration hibernate 3 to hibernate 4 Seam 2.3 should be compatible with hibernate 4.
In our company environment, we had about 10 seam applications which also used seams persistence integration and wanted to use them on JBoss EAP 6. After spending weeks on the migration and struggling with a lot of issues, we decided to get rid of seam and migrated the applications to JSF.

Related

using JPA 2.0 on hibernate 5 when deploy to websphere

when I try to deploy my application on Websphere Application Server 9.0 I got this error
An error occurred in the org.hibernate.jpa.HibernatePersistenceProvider persistence provider when it attempted to create the container entity manager factory for the ApplicationEntityManager persistence unit. The following error occurred: java.lang.ClassCastException: org.hibernate.jpa.HibernatePersistenceProvider incompatible with javax.persistence.spi.PersistenceProvider
and someone suggests me to downgrade my JPA to 2.0. is this possible to use JPA 2.0 with Hibernate 5.2.1. or there is another solution to solve my problem.
If using WebSphere Application Server traditional,
here are the instructions to set the JPA spec level provided by the server,
https://www.ibm.com/support/knowledgecenter/en/SSEQTP_9.0.0/com.ibm.websphere.base.doc/ae/tejb_idmod_jpaspec.html
That said, Hibernate 5.2.1 appears to have a dependency on JPA 2.1, not 2.0. See the dependencies indicated here,
https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.2.1.Final
The issue might be caused by including a copy of the JPA spec JARs within the application such that the server and the application are trying to load different copies of the same class which collide and produce this error. Check your application and remove all copies of the JPA spec JAR from it (including any supplied by Hibernate), such that the server copy alone is always used to load JPA.

WebSphere 7 Entity Manager creation issue with Hibernate Provider?

I keep getting
The server cannot create an EntityManagerFactory factory for the default persistent unit from the org.hibernate.ejb.HibernatePersistence provider
when I try to run the web application(.war) on the WebSphere 7 + Oracle .This worked well so far under the tomcat + MySql.
my persistance.xml's config
<persistence-unit name="default">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>src/test</non-jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.Oracle10gDialect"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
<property name="hibernate.connection.release_mode" value="after_transaction"/>
</persistence-unit>
There were several solutions for this, after googling. But there was no luck even after trying them for about 2 days.
To fix this issue do we need to install any fix-pack in WebSphere?
Please find the stack-trace files in below link.
https://www.ibm.com/developerworks/community/forums/html/topic?id=e54136aa-fbe0-4576-a41c-4b438475f0a5
In WebSphere v7 to use container managed JPA you need to install feature pack for JPA and it will only support JPA 2.0.
Based on your logs it looks like you are using Hibernate 4.3 which is JPA 2.1.
You cant use that with classic WebSphere Application Server, see Deploying application using Hibernate JPA 2.1 to IBM WebSphere for more details.
So you either would need to downgrade to Hibernate 4.2, use application managed Entity manager, or migrate to WebSphere Liberty Profile server 8.5.5.6 or later which fully supports JPA 2.1.
If your application works on Tomcat, I'd suggest trying WebSphere Liberty, which is also lightweight, developer friendly server, available to download for free - https://developer.ibm.com/wasdev/

how to configure #localbinding and #remoteBinding in wildfly

We are migrating from JBOSS6 to wildfly8.2 and as wildfly support EJB3.2 and EJB3.2 does not support #LocalBinding / #RemoteBinding ,so how will I do the same in wildfly using standalone.xml / ejb-jar.xml / any other configuration.
I tried JBoss: Binding values into JNDI in JBoss EAP 6 similar to JNDIBindingServiceMgr thread but could not link where i will map the jndi name to my EJB and how lookup will be happened.
Please help.
Many Thanks.
This information provided into wildfly documents, can be used by others also as I am going to test with it to implement for my question:
https://docs.jboss.org/author/display/WFLY8/JNDI+Reference

Weblogic 12 with java7 doesnt set nill in JAXBElement

We have application running on weblogic 11g using java 6. Now we want to use use weblogic 12c with java 7 but we have some problem. We are using JAXB to un/marshal soap request. Now when we deploy our application to wls12 we have problem with nillable atribut in element. When I send xml with:
<data:MyElement state="ok" xsi:nil="true"/>
element in my app isnt nill:
element.isNil() return false
JUnit with this test still works so I supposed that there is no problem with java7. This problem occurs just on wls12. How should I fix this problem or at least how should I debug it
thx for help
Difference Between WebLogic 11 & 12
Starting in WebLogic 12.1.1 EclipseLink MOXy is the default JAXB (JSR-222) provider.
http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb-provider-in.html
What is Causing the Failure
You are hitting the following MOXy bug.
http://bugs.eclipse.org/404926
What You Can Do:
If you are an Oracle Support customer then you can contact them to get an official fix.
You can revert to using the JAXB RI at the server or application level using the offical instructions that can be found here: http://docs.oracle.com/cd/E24329_01/web.1211/e24964/data_types.htm#CIHBHDGI
To future generation which will have this problem too:
When I turn on tracing messages, this problem occurs again.
org.springframework.ws.server.MessageTracing=TRACE
By debugging I saw that wls 12 use oracle.j2ee.ws.saaj.soap.soap11.Message11and wls 10 use weblogic.xml.saaj.SOAPMessageImpl
All I need to do is to add this class to messageFactory:
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean class="weblogic.xml.saaj.MessageFactoryImpl" />
</property>
</bean>

Hibernate Validator 5 version compatibility with Hibernate 3.5

Is it safe to use the Hibernate Validator 5.0.1 with Hibernate 3.5.4? From what I've read it should not be a problem and I'm not running into any errors so far (i.e. application compiles, runs and tests pass), but I'm not sure if they fit well together.
Related Hibernate & JPA libs (inside /WEB-INF/libs):
hibernate3.jar
hibernate-annotations-3.5.4-Final.jar
hibernate-commons-annotations-3.2.0.Final.jar
hibernate-core-3.5.4-Final.jar
hibernate-entitymanager-3.5.4-Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-5.0.1.Final.jar
hibernate-validator-annotation-processor-5.0.1.Final.jar
validation-api-1.1.0.Final.jar
FYI:
Tomcat 7.0.39
Spring 3.0.3
PostgreSQL 9.2
Flyway 2.1.1
BoneCP 0.7.1
You should be fine with using Bean Validation 1.1/Hibernate Validator 5.0.1; Hibernate ORM depends on the Bean Validation API only, and BV 1.1 is compatible with BV 1.0.
I recommend to check the Hibernate Validator migration guide to see whether any of the issues listed there might affect you (for instances changes around logging and the usage of Java 6).

Categories

Resources