Joined: Wed May 26, 2004 11:38 am Posts: 1 Location: Montreal, Qc
|
Hi,
Description of the problem : When im deploying my code in a websphere app. server, i have this exception (in bold) :
-------------------------------------------------------------------------------------
[04-05-26 11:38:14:884 EDT] 3fe8df3f EJBContainerI E WSVR0040E: Echec de addEjbModule pour MartEJB.jar [class com.ibm.ws.runtime.component.DeployedModuleImpl]
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:79)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:43)
at java.lang.reflect.Constructor.newInstance(Constructor.java:313)
at java.lang.Class.newInstance3(Class.java:363)
at java.lang.Class.newInstance(Class.java:301)
at com.ibm.ejs.container.EJSContainer.loadBeanMetaData(EJSContainer.java:1349)
at com.ibm.ejs.container.EJSContainer.getHomeWrapperCommon(EJSContainer.java:1012)
at com.ibm.ejs.container.EJSContainer.getHomeInstance(EJSContainer.java:934)
at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:913)
at com.ibm.ws.runtime.component.EJBContainerImpl.startBean(EJBContainerImpl.java:1301)
at com.ibm.ws.runtime.component.EJBContainerImpl.install(EJBContainerImpl.java:1034)
at com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:1508)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:418)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:787)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:575)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:271)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:249)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:125)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)
Caused by: java.lang.RuntimeException: couldn't get connection at at org.mart.session.facade.MartFacadeBean.<clinit>(MartFacadeBean.java:64).null(Unknown Source)
-------------------------------------------------------------------------------------
this error is happening when the server executes the buidSessionFactory() on the cfg object :
.....
try
{
Configuration cfg = new Configuration().addClass(Make.class).addClass(model.class);
system.out.println ("construction of cfg object done");
sessionFactory = cfg.buildSessionFactory();
}
catch (Exception e){
throw new RuntimeException("couldn't get connection");
}
------------------------------------------------------------------------------------
Here's my hibernate.properties file :
-----------------------------------------------------------------------------------
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
#hibernate.connection.url jdbc:db2:Project
#hibernate.connection.username
#hibernate.connection.password
#hibernate.dialect cirrus.hibernate.sql.DB2Dialect
## JNDI Datasource
hibernate.connection.datasource jdbc/ProjectDS
#hibernate.connection.username allo
#hibernate.connection.password allo
## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager
hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
#WebSphere
hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-------------------------------------------------------------------------------------
My Datasource is seems to work well....
My version of hibernate is : version 2.1.3, 25 April 2004
Im using db2 udb 8.1
Here are my two mapping documents :
----------------------------------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="org.mart.hibernate.Make" table="make">
<id name="makeID" column="makeID" type="int">
<generator class="assigned"/> </id>
<property name="description" column="description" type="string"/>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->
------------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="org.mart.hibernate.model" table="model">
<id name="modelID" column="modelID" type="int">
<generator class="assigned"/> </id>
<property name="description" column="description" type="string"/>
<!-- <property name="makeID" column="makeID" type="int"/>-->
<many-to-one name="makeID" column="makeID"/>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->
--------------------------------------------------------------------------
here's my code between sessionFactory.openSession() and session.close()
--------------------------
Session session = sessionFactory.openSession();
System.out.println("opensession ");
List list = session.find("from model in class org.mart.hibernate.model");
session.flush();
session.close();
Thanks for your help !
|
|