- This topic has 1 reply, 2 voices, and was last updated 18 years, 10 months ago by Riyad Kalla.
-
AuthorPosts
-
arao06MemberI have a problem when I try to run my application. I’m using struts with hibernate. I followed the MyEclipse instructions to add hibernate capabilities to my project and created the HibernateSessionFactory class as required. I get an error when I try to run my application on the sun web server. Following is the error:
[#|2006-03-23T17:41:20.843-0600|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=11;|WebModule[/MyOSB]action: null
java.lang.ClassCastException: com.osb.hibernate.HibernateSessionFactory
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1142)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1093)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:931)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4183)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4536)
at com.sun.enterprise.web.WebModule.start(WebModule.java:241)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:827)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:125)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:147)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:809)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:646)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1331)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1040)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:160)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:246)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:918)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:905)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:427)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:139)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:288)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:155)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:258)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:87)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:639)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:185)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:305)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:360)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:272)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeployer.java:504)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployModule(AutoDeployer.java:485)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployWarModule(AutoDeployer.java:433)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployWarModule(AutoDeployer.java:426)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:246)
at com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(AutoDeployControllerImpl.java:345)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
|#][#|2006-03-23T17:41:20.843-0600|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=11;|WebModule[/MyOSB]Marking servlet action as unavailable|#]
[#|2006-03-23T17:41:20.843-0600|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=11;|WebModule[/MyOSB]Servlet /MyOSB threw load() exception
javax.servlet.UnavailableException
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1169)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:261)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1093)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:931)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4183)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4536)
at com.sun.enterprise.web.WebModule.start(WebModule.java:241)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:827)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:125)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:147)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:809)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:646)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1331)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1040)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:160)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:246)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:918)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:905)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:427)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:139)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:288)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:155)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:258)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:87)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:71)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:639)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:185)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:305)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:360)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at sun.reflect.GeneratedMethodAccessor24.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:272)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeployer.java:504)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployModule(AutoDeployer.java:485)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployWarModule(AutoDeployer.java:433)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployWarModule(AutoDeployer.java:426)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:246)
at com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(AutoDeployControllerImpl.java:345)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)My application is a very simple one – adding the name and category of a product into the database. It uses struts for the control and modelling (ActionForm, Action and ActionServlet) and hibernate for the database transactions.
I followed the standard instructions to add the hibernate capabilities. I added both the hibernate core and advanced libraries and I’m pretty sure it copied everything into my project workspace. I’m stumped as to why I’m getting this error. I’m not sure if this is a hibernate related problem but it sure looks that way to me. Any assistance in debugging this problem would be highly appreciated!
Riyad KallaMember#|2006-03-23T17:41:20.843-0600|SEVERE|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=11;|WebModule[/MyOSB]action: null
java.lang.ClassCastException: com.osb.hibernate.HibernateSessionFactory
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1142)I think the key to the problem will start in here. Did you setup your datasource in Sun App Server or in your Struts config file? It looks like that Session Factory is throwing a ClassCastException for some reason, I wonder if it’s expecting a DataSource and getting back something else?
Also it looks like the issue is starting from the struts servlet in the initPlugins method, so I would chekc your struts-config.xml file and see what plugins you are starting that could be calling to the session factory and causing the CCE.
-
AuthorPosts