Hi Michael,
thank you for trying to help me.
I'm running Sun ONE Application Server 7.0 (PE) on SuSE 8.1; j2sdk1.4.1_03.
Here's what I did:
1. JAR that contains Hibernate-Objects, *.hbm.xml, hibernate.cfg.xml, hibernat.properties
hibernat.properties:
Code:
...
hibernate.dialect net.sf.hibernate.dialect.OracleDialect
hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.SunONETransactionManagerLookup
hibernate.cache.use_query_cache true
hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider
...
2. Stateless Session EJB (transaction-type = "Container")
business method:
Code:
...
try {
Configuration cfg = new Configuration();
cfg.configure();
SessionFactory sf = cfg.buildSessionFactory();
conn = ds.getConnection();
session = sf.openSession(conn);
tx = session.beginTransaction();
final List alleMandanten = session.find(
"FROM MandantVO m"
+ " WHERE m.name != m.datenlieferant");
tx.commit();
} catch (HibernateException e) {
try {
if (tx != null) { tx.rollback(); }
} catch (HibernateException ignore) {
}
throw new RuntimeException(e.getMessage());
}
...
3. added to server.policy
Code:
grant codeBase "file:/var/opt/SUNWappserver7/domains/domain1/server1/-" {
permission java.security.AllPermission;
};
4. finally changed Hibernate 2.1.3 code:
...cfg.Environmentstatic{ }
Code:
GLOBAL_PROPERTIES.putAll( System.getProperties() );
to
Code:
try {
GLOBAL_PROPERTIES.putAll( System.getProperties() );
} catch (SecurityException ex) {
log.warn("could not get system properties", ex);
}
...cfg.ConfigurationaddResource(String)
Code:
Thread.currentThread().getContextClassLoader().getResourceAsStream(...
to
Code:
getClass().getResourceAsStream(...
addJar(String)
Code:
Thread.currentThread().getContextClassLoader().getResource(...
to
Code:
getClass().getResource(...
getConfigurationInputStream(String)
Code:
Environment.class.getResourceAsStream(...
to
Code:
getClass().getResourceAsStream(...
...jmx.HibernateServicebuildSessionFactory()
Code:
cfg.addResource( mappingFiles[i], Thread.currentThread().getContextClassLoader() );
to
Code:
cfg.addResource( mappingFiles[i] );
...transaction.SunONETransactionManagerLookupCode:
public class SunONETransactionManagerLookup extends JNDITransactionManagerLookup {
protected String getName() {
return "java:/TransactionManager";
}
public String getUserTransactionName() {
return "UserTransaction";
}
}
to
Code:
import java.util.Properties;
import javax.transaction.TransactionManager;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.transaction.TransactionManagerLookup;
public class SunONETransactionManagerLookup implements TransactionManagerLookup
{
/**
* @see net.sf.hibernate.transaction.TransactionManagerLookup#getUserTransactionName()
*/
public String getUserTransactionName()
{
return "UserTransaction";
}
/**
* @see
* net.sf.hibernate.transaction.TransactionManagerLookup#
* getTransactionManager(java.util.Properties)
*/
public TransactionManager getTransactionManager(Properties props)
throws HibernateException
{
try
{
Class clazz = Class.forName("com.sun.jts.jta.TransactionManagerImpl");
return
(TransactionManager)
clazz.getMethod("getTransactionManagerImpl", null)
.invoke(null, null);
}
catch (Exception e)
{
throw new HibernateException(
"Could not obtain Sun ONE transaction manager instance",
e );
}
}
}
5. I had the following JARs in the EAR & Class-Path (EJB/MANIFEST) set
Code:
hibernate-2.1.3 (my patched version)
cglib-full-2.0.1
commons-logging-1.0.3
commons-collections-2.1
dom4j-1.4
odmg-3.0
jar-containing-hibernate-objects
6. Log4j is configured as Lifecycle Module at the AppServer; Datasource is installed and working.
All jar, ejb.jar, ear etc. is generated using Maven (& XDoclet). Other Projects build with this technology is working very well.
The EJB is called via a Servlet (that's for parsing an input XML).
Now what I found in the server.log:
Code:
...
[25/May/2004:16:48:07] WARNING ( 7728): CORE3283: stderr: 481565 [service-j2ee] DEBUG util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-configur
ation-2.0.dtd in classpath under net/sf/hibernate/
[25/May/2004:16:48:07] WARNING ( 7728): CORE3283: stderr: 481571 [service-j2ee] DEBUG util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-configuration-2.0.d
td in classpath
[25/May/2004:16:48:07] WARNING ( 7728): CORE3283: stderr: 481585 [service-j2ee] DEBUG cfg.Configuration - null<-org.dom4j.tree.DefaultAttribute@126c885 [Attribute: name resource v
alue "de/jkv/tel/syspo/vo/MandantVO.hbm.xml"]
[25/May/2004:16:48:25] WARNING ( 7728): CORE3283: stderr: 499820 [service-j2ee] INFO cfg.Configuration - Mapping resource: de/jkv/tel/syspo/vo/MandantVO.hbm.xml
[25/May/2004:16:48:25] WARNING ( 7728): CORE3283: stderr: 500140 [service-j2ee] DEBUG util.DTDEntityResolver - trying to locate http://hibernate.sourceforge.net/hibernate-mapping-
2.0.dtd in classpath under net/sf/hibernate/
[25/May/2004:16:48:25] WARNING ( 7728): CORE3283: stderr: 500165 [service-j2ee] DEBUG util.DTDEntityResolver - found http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd in
classpath
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500619 [service-j2ee] INFO cfg.Binder - Mapping class: de.jkv.tel.syspo.vo.MandantVO -> MANDANTEN
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500629 [service-j2ee] DEBUG cfg.Binder - Mapped property: pk -> MANDANTEN_NR, type: long
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500640 [service-j2ee] DEBUG cfg.Binder - Mapped property: name -> MANDANT, type: string
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500649 [service-j2ee] DEBUG cfg.Binder - Mapped property: nameLang -> NAME, type: string
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500666 [service-j2ee] DEBUG cfg.Binder - Mapped property: strasse -> STRASSE, type: string
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500676 [service-j2ee] DEBUG cfg.Binder - Mapped property: plz -> PLZ, type: string
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500686 [service-j2ee] DEBUG cfg.Binder - Mapped property: ort -> ORT, type: string
[25/May/2004:16:48:26] WARNING ( 7728): CORE3283: stderr: 500698 [service-j2ee] INFO util.ReflectHelper - reflection optimizer disabled for: de.jkv.tel.syspo.vo.AdresseVO, NoClass
DefFoundError: null
[25/May/2004:16:48:26] SCHWERWIEGEND ( 7793): StandardWrapperValve[OrderPosServlet]: Servlet.service() for servlet OrderPosServlet threw exception
javax.servlet.ServletException
at de.jkv.tel.journalsvr.web.OrderPosServlet.doPost(OrderPosServlet.java:132)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at de.jkv.tel.journalsvr.web.SchemaVerifyFilterBase.doFilter(SchemaVerifyFilterBase.java:157)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:265)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
----- Root Cause -----
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:1872)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1773)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1585)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:510)
at de.jkv.tel.journalsvr.ejb.Session2EJB_EJBLocalObjectImpl.getOrderPos(Session2EJB_EJBLocalObjectImpl.java:29)
at de.jkv.tel.journalsvr.web.OrderPosServlet.doPost(OrderPosServlet.java:122)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at de.jkv.tel.journalsvr.web.SchemaVerifyFilterBase.doFilter(SchemaVerifyFilterBase.java:157)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:98)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:265)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(
...
The program crashed at this line in the EJB code:
Code:
SessionFactory sf = cfg.buildSessionFactory();
I hope you can imagine what I did and what my problem is.
Thank's a lot for spending your time
-Christian