-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate& struts :java.lang.ExceptionInInitializerError
PostPosted: Wed Jul 12, 2006 3:20 pm 
Newbie

Joined: Wed Jul 12, 2006 3:00 pm
Posts: 1
I have a app using Struts and communicatiung with Hibernate to talk to the DB2 backend. : For some reason I havent been able to make both of them talk to each other.

The hibernate.cfg.xml (in web-inf) is like:

Code:
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">


<hibernate-configuration>
   <session-factory name="foo:/hibernate/SessionFactory">
      <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
      <property name="connection.driver_class">com.ibm.db2.jcc.DB2Driver</property>
      <property name="connection.username">user</property>
      <property name="connection.password">pwd</property>
      <property name="connection.url">jdbc:db2://localhost/test</property>
      <property name="show_sql"> true</property>
    


      <mapping resource="/com/hibernatestruts/beans/bank.hbm.xml"/>
   </session-factory>

</hibernate-configuration>



Whenever I start my server I get this error:


Quote:
[7/12/06 14:55:12:234 EDT] 333fa52c PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
[7/12/06 14:55:12:250 EDT] 333fa52c PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
[7/12/06 14:55:12:734 EDT] 333fa52c PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='net.pkg.submit.resources.ApplicationResources', returnNull=true
[7/12/06 14:55:12:781 EDT] 333fa52c SystemOut O Initializing Hibernate from /WEB-INF/hibernate.cfg.xml...file:/C:/MyProject/Submit/WebContent/WEB-INF/hibernate.cfg.xml
[7/12/06 14:55:12:844 EDT] 333fa52c HibernatePlug E net.pkg.submit.actions.HibernatePlugin Exception while initializing Hibernate.
[7/12/06 14:55:12:844 EDT] 333fa52c HibernatePlug E net.pkg.submit.actions.HibernatePlugin Rethrowing exception...
[7/12/06 14:55:12:859 EDT] 333fa52c HibernatePlug E net.pkg.submit.actions.HibernatePlugin TRAS0014I: The following exception was logged java.lang.ExceptionInInitializerError
at net.pkg.submit.actions.HibernatePlugin.initHibernate(HibernatePlugin.java:112)
at net.pkg.submit.actions.HibernatePlugin.init(HibernatePlugin.java:90)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1279)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:392)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:211)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
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:152)
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:243)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:189)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:92)
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1200)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:994)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:991)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:572)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
... 42 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1190)
... 49 more
.
java.lang.ExceptionInInitializerError
at net.pkg.submit.actions.HibernatePlugin.initHibernate(HibernatePlugin.java:112)
at net.pkg.submit.actions.HibernatePlugin.init(HibernatePlugin.java:90)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1279)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:392)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:211)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
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:152)
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:243)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:189)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:92)
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1200)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:994)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:991)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:572)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
... 42 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1190)
... 49 more

[7/12/06 14:55:13:000 EDT] 333fa52c ServletInstan E SRVE0100E: Did not realize init() exception thrown by servlet action: javax.servlet.ServletException
at net.pkg.submit.actions.HibernatePlugin.initHibernate(HibernatePlugin.java:125)
at net.pkg.submit.actions.HibernatePlugin.init(HibernatePlugin.java:90)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1279)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:392)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:211)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
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:152)
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:243)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:189)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:92)
---- Begin backtrace for Nested Throwables
java.lang.ExceptionInInitializerError
at net.pkg.submit.actions.HibernatePlugin.initHibernate(HibernatePlugin.java:112)
at net.pkg.submit.actions.HibernatePlugin.init(HibernatePlugin.java:90)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1279)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:392)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:211)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
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:152)
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:243)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:189)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:92)
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1200)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:994)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:991)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:572)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
... 42 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1190)
... 49 more

[7/12/06 14:55:13:078 EDT] 333fa52c WebGroup E SRVE0020E: [Servlet Error]-[action]: Failed to load servlet: java.lang.ExceptionInInitializerError
at net.pkg.submit.actions.HibernatePlugin.initHibernate(HibernatePlugin.java:112)
at net.pkg.submit.actions.HibernatePlugin.init(HibernatePlugin.java:90)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:876)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1279)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:283)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:392)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:211)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:1005)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:505)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:808)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:578)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:299)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:256)
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:152)
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:243)
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:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:189)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:92)
Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration. (Caused by java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory)
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1200)
at org.apache.commons.logging.LogFactory$2.run(LogFactory.java:994)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:991)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:572)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:645)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:116)
... 42 more
Caused by: java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
at java.lang.Class.forName1(Native Method)
at java.lang.Class.forName(Class.java(Compiled Code))
at org.apache.commons.logging.LogFactory.createFactory(LogFactory.java:1190)
... 49 more

[7/12/06 14:55:13:125 EDT] 333fa52c TraceNLS u No message text associated with key NULL_MESSAGE_KEY_PASSED in bundle com.ibm.ejs.resources.seriousMessages
[7/12/06 14:55:13:125 EDT] 333fa52c WebAppServlet E NULL_MESSAGE_KEY_PASSED
[7/12/06 14:55:13:188 EDT] 333fa52c ApplicationMg A WSVR0221I: Application started: SubmitEAR
[7/12/06 14:55:13:203 EDT] 333fa52c HttpTransport A SRVE0171I: Transport http is listening on port 10,080.
[7/12/06 14:55:15:172 EDT] 333fa52c HttpTransport A SRVE0171I: Transport https is listening on port 9,443.
[7/12/06 14:55:15:188 EDT] 333fa52c HttpTransport A SRVE0171I: Transport http is listening on port 10,090.
[7/12/06 14:55:15:250 EDT] 333fa52c HttpTransport A SRVE0171I: Transport https is listening on port 9,043.
[7/12/06 14:55:15:266 EDT] 333fa52c RMIConnectorC A ADMC0026I: RMI Connector available at port 2809
[7/12/06 14:55:15:391 EDT] 333fa52c WsServer A WSVR0001I: Server server1 open for e-business


Code:
package net.pkg.submit.actions;


import java.net.URL;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ModuleConfig;

/**
* Implements the <code>PlugIn</code> interface to configure the Hibernate
* data persistence library.  A configured
* <code>net.sf.hibernate.SessionFactory</code> is stored in the
* <code>ServletContext</code> of the web application unless the property
* <code>storedInServletContext</code> is set to <code>false</code>.
*
* <plugin class="net.sf.hibernate.plugins.struts.HibernatePlugIn">
*   <set-property name="configFilePath"
*                 value="path-to-config-file"/>
*   <set-property name="storedInServletContext&quot"
*                value="true-or-false"/>
* </plugin>
*
* @author  <a href="mailto:bhandy@users.sf.net">Bradley M. Handy</a>
* @version 1.0
*/
public class HibernatePlugin implements PlugIn {
   
    /**
     * the key under which the <code>SessionFactory</code> instance is stored
     * in the <code>ServletContext</code>.
     */
    public static final String SESSION_FACTORY_KEY   = SessionFactory.class.getName();

    private static Log _log = LogFactory.getLog(HibernatePlugin.class);
   
    /**
     * indicates whether the <code>SessionFactory</code> instance will be stored
     * in the <code>ServletContext</code>, or not.
     */
    private boolean _storedInServletContext = true;
   
    /**
     * the path to the xml configuration file.  the path should start with a
     * '/' character and be relative to the root of the class path.
     * (DEFAULT:  "/hibernate.cfg.xml")
     */
    private String _configFilePath = "/WEB-INF/hibernate.cfg.xml";

    private ActionServlet _servlet = null;
    private ModuleConfig _config = null;
    private SessionFactory _factory = null;

    /**
     * Destroys the <code>SessionFactory</code> instance.
     */
    public void destroy() {
        _servlet = null;
        _config = null;
       
        try {
            _log.debug("Destroying SessionFactory...");
           
            _factory.close();
           
            _log.debug("SessionFactory destroyed...");
        } catch (Exception e) {
            _log.error("Unable to destroy SessionFactory...(exception ignored)",
                    e);
        }
    }
   
    /**
     * Initializes the <code>SessionFactory</code>.
     * @param servlet the <code>ActionServlet</code> instance under which the
     *        plugin will run.
     * @param config the <code>ModuleConfig</code> for the module under which
     *        the plugin will run.
     */
    public void init(ActionServlet servlet, ModuleConfig config)
    throws ServletException {
        _servlet = servlet;
        _config = config;
       
        initHibernate();
    }
   
    /**
     * Initializes Hibernate with the config file found at
     * <code>configFilePath</code>.
     */
    private void initHibernate() throws ServletException {
        Configuration configuration = null;
        URL configFileURL = null;
        ServletContext context = null;
       
        try {
            configFileURL = HibernatePlugin.class.getResource(_configFilePath);

            context = _servlet.getServletContext();

           
               System.out.println("Initializing Hibernate from "
                        + _configFilePath + "..."+configFileURL);
           
           
            configuration = (new Configuration()).configure(configFileURL);
            _factory = configuration.buildSessionFactory();
           
            if (_storedInServletContext) {
                _log.debug("Storing SessionFactory in ServletContext...");
               
                context.setAttribute(SESSION_FACTORY_KEY, _factory);
            }
           
        } catch (Throwable t) {
            _log.error("Exception while initializing Hibernate.");
            _log.error("Rethrowing exception...", t);
           
            throw (new ServletException(t));
        }
    }
   
    /**
     * Setter for property configFilePath.
     * @param configFilePath New value of property configFilePath.
     */
    public void setConfigFilePath(String configFilePath) {
        if ((configFilePath == null) || (configFilePath.trim().length() == 0)) {
            throw new IllegalArgumentException(
                    "configFilePath cannot be blank or null.");
        }
       
        if (_log.isDebugEnabled()) {
            _log.debug("Setting 'configFilePath' to '"
                    + configFilePath + "'...");
        }
       
        _configFilePath = configFilePath;
    }
   
    /**
     * Setter for property storedInServletContext.
     * @param storedInServletContext New value of property storedInServletContext.
     */
    public void setStoredInServletContext(String storedInServletContext) {
        if ((storedInServletContext == null)
                || (storedInServletContext.trim().length() == 0)) {
            storedInServletContext = "false";
        }
       
        if (_log.isDebugEnabled()) {
            _log.debug("Setting 'storedInServletContext' to '"
                    + storedInServletContext + "'...");
        }
       
        _storedInServletContext
                = new Boolean(storedInServletContext).booleanValue();
    }
   
}


I have tried all dffernt alternatives..but no luck....Any help will be greatly appreciated... I will post mre info if required


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 12, 2006 3:30 pm 
Beginner
Beginner

Joined: Mon Jan 23, 2006 12:01 pm
Posts: 46
Did you check your Exception trace carefully?

java.lang.ClassNotFoundException: com.ibm.ws.commons.logging.TrLogFactory

This is at the bottom of the stack. Could it be that you're simply missing that class in your classpath?

Just a thought,

Bratek


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.