D
Donkey Hottie
We used to have lots of trouble trying to make our ejb2-application
portable across platforms.
I have converted the app to EJB3 now, and trying to get it to run on
several Application Servers without much modifications.
=== 1 ===
The biggest problem is in the persistence.xml. There is lots of stuff in
it that can be left out.
My current persistence.xml is as follows
---
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="Mydata" transaction-type="JTA">
<!-- <jta-data-source>java:/MyDataSourceDS</jta-data-source> -->
<jta-data-source>jdbc/MyDataSource</jta-data-source>
<properties>
</properties>
</persistence-unit>
</persistence>
---
Everything else but the jta-data-source can be left off. But the problem
is in the data source. I can use "jdbc/MyDataSource" with many
Application Servers, if not all... except JBoss. It requires
java:/MyDataSource
How to make persistence.xml portable? I have not managed to use an ENC
name for a datasource in persistence.xml with JBoss.
=== 2 ===
My application has several ejb-modules (jar-files) in it, and currently
the persistence.xml had been copied into each of them.
I tried to put persistence.xml to the EAR META-INF -folder, but it did
not work.
I remember having read that persistence.xml does not have to reside in
the ejb-jar. Where could I have it, so that it would work in a portable
way?
=== 3 ===
So far I have managed to run this app under JBoss 4.x and JBoss 5.x and
GlassFish V2 (with different persistence.xml between the brands).
Dependendy Injection seem not to work at all, but I have a Factory
pattern, which does several JNDI lookups and eventually finds the session
beans. Weblogic 10 is a disaster, it does not even deploy this, can't
find classes from other modules (jars) of mine, no matter how I tune the
classpaths in the jar manifests. The EAR running happily in JBoss or
GlassFish does not deploy on Weblogic!
Websphere 6.1 will be tested tomorrow.
Any ideas?
portable across platforms.
I have converted the app to EJB3 now, and trying to get it to run on
several Application Servers without much modifications.
=== 1 ===
The biggest problem is in the persistence.xml. There is lots of stuff in
it that can be left out.
My current persistence.xml is as follows
---
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="Mydata" transaction-type="JTA">
<!-- <jta-data-source>java:/MyDataSourceDS</jta-data-source> -->
<jta-data-source>jdbc/MyDataSource</jta-data-source>
<properties>
</properties>
</persistence-unit>
</persistence>
---
Everything else but the jta-data-source can be left off. But the problem
is in the data source. I can use "jdbc/MyDataSource" with many
Application Servers, if not all... except JBoss. It requires
java:/MyDataSource
How to make persistence.xml portable? I have not managed to use an ENC
name for a datasource in persistence.xml with JBoss.
=== 2 ===
My application has several ejb-modules (jar-files) in it, and currently
the persistence.xml had been copied into each of them.
I tried to put persistence.xml to the EAR META-INF -folder, but it did
not work.
I remember having read that persistence.xml does not have to reside in
the ejb-jar. Where could I have it, so that it would work in a portable
way?
=== 3 ===
So far I have managed to run this app under JBoss 4.x and JBoss 5.x and
GlassFish V2 (with different persistence.xml between the brands).
Dependendy Injection seem not to work at all, but I have a Factory
pattern, which does several JNDI lookups and eventually finds the session
beans. Weblogic 10 is a disaster, it does not even deploy this, can't
find classes from other modules (jars) of mine, no matter how I tune the
classpaths in the jar manifests. The EAR running happily in JBoss or
GlassFish does not deploy on Weblogic!
Websphere 6.1 will be tested tomorrow.
Any ideas?