Announcement Announcement Module
Collapse
No announcement yet.
Spring Hibernate on GlassFish Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Hibernate on GlassFish

    Hi,
    I am trying to develop and Spring and Hibernate Application. When i run it from the NetBeans IDE as a standalone java class i can hit the Database and everything is fine. When i create a WAR file and deploy to Glassfish i get the following:

    Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named SpringJPAPU: Provider named org.hibernate.ejb.HibernatePersistence threw unexpected exception at create EntityManagerFactory:
    java.lang.NoSuchMethodError
    java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
    at org.hibernate.cfg.AnnotationBinder.processElementA nnotations(AnnotationBinder.java:1830)
    at org.hibernate.cfg.AnnotationBinder.processIdProper tiesIfNotAlready(AnnotationBinder.java:762)
    at org.hibernate.cfg.AnnotationBinder.bindClass(Annot ationBinder.java:726)
    at org.hibernate.cfg.AnnotationConfiguration.processA rtifactsOfType(AnnotationConfiguration.java:636)
    at org.hibernate.ejb.Ejb3Configuration.buildMappings( Ejb3Configuration.java:1449)
    at org.hibernate.ejb.EventListenerConfigurator.config ure(EventListenerConfigurator.java:193)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3 Configuration.java:1077)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3 Configuration.java:275)
    at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3 Configuration.java:359)
    at org.hibernate.ejb.HibernatePersistence.createEntit yManagerFactory(HibernatePersistence.java:55)
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:110)
    at org.springframework.orm.jpa.LocalEntityManagerFact oryBean.createNativeEntityManagerFactory(LocalEnti tyManagerFactoryBean.java:92)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:308)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1460)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1400)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:513)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:450)
    at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 90)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:545)
    at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:871)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:423)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:272)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:196)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at com.sun.enterprise.v3.server.ApplicationLifecycle. start(ApplicationLifecycle.java:547)
    at com.sun.enterprise.v3.server.ApplicationLifecycle. deploy(ApplicationLifecycle.java:189)
    at org.glassfish.deployment.admin.DeployCommand.execu te(DeployCommand.java:329)
    at com.sun.enterprise.v3.admin.CommandRunner$2.execut e(CommandRunner.java:297)
    at com.sun.enterprise.v3.admin.CommandRunner.doComman d(CommandRunner.java:312)
    at com.sun.enterprise.v3.admin.CommandRunner.doComman d(CommandRunner.java:119)
    at com.sun.enterprise.v3.admin.CommandRunner.doComman d(CommandRunner.java:99)
    at org.glassfish.admingui.common.util.LocalDeployment Facility$LocalDFCommandRunner.run(LocalDeploymentF acility.java:140)
    at org.glassfish.deployment.client.AbstractDeployment Facility.deploy(AbstractDeploymentFacility.java:24 3)
    at org.glassfish.admingui.common.util.DeployUtil.invo keDeploymentFacility(DeployUtil.java:93)
    at org.glassfish.admingui.common.util.DeployUtil.depl oy(DeployUtil.java:70)
    at org.glassfish.admingui.handlers.DeploymentHandler. deploy(DeploymentHandler.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.jsftemplating.layout.descriptors.handler.H andler.invoke(Handler.java:422)
    at com.sun.jsftemplating.layout.descriptors.LayoutEle mentBase.dispatchHandlers(LayoutElementBase.java:4 20)
    at com.sun.jsftemplating.layout.descriptors.LayoutEle mentBase.dispatchHandlers(LayoutElementBase.java:3 94)
    at com.sun.jsftemplating.layout.event.CommandActionLi stener.invokeCommandHandlers(CommandActionListener .java:132)
    at com.sun.jsftemplating.layout.event.CommandActionLi stener.processAction(CommandActionListener.java:80 )
    at javax.faces.event.ActionEvent.processListener(Acti onEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UI ComponentBase.java:771)
    at javax.faces.component.UICommand.broadcast(UIComman d.java:372)
    at com.sun.webui.jsf.component.WebuiCommand.broadcast (WebuiCommand.java:160)
    at javax.faces.component.UIViewRoot.broadcastEvents(U IViewRoot.java:475)
    at javax.faces.component.UIViewRoot.processApplicatio n(UIViewRoot.java:756)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.exe cute(InvokeApplicationPhase.java:82)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:1 00)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(Life cycleImpl.java:118)
    at com.sun.faces.extensions.avatar.lifecycle.PartialT raversalLifecycle.execute(PartialTraversalLifecycl e.java:80)
    at javax.faces.webapp.FacesServlet.service(FacesServl et.java:265)
    at org.apache.catalina.core.ApplicationFilterChain.se rvletService(ApplicationFilterChain.java:431)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:337)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:218)
    at com.sun.webui.jsf.util.UploadFilter.doFilter(Uploa dFilter.java:370)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:218)
    at org.apache.catalina.core.StandardWrapperValve.preI nvoke(StandardWrapperValve.java:460)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:139)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:186)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipel ine.java:96)
    at com.sun.enterprise.web.PESessionLockingStandardPip eline.invoke(PESessionLockingStandardPipeline.java :98)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:187)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1030)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:142)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:719)
    at org.apache.catalina.core.StandardPipeline.doInvoke (StandardPipeline.java:657)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:651)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:1030)
    at org.apache.catalina.connector.CoyoteAdapter.doServ ice(CoyoteAdapter.java:325)
    at com.sun.grizzly.util.WorkerThreadImpl.run(WorkerTh readImpl.java:184)
    The following providers:
    org.eclipse.persistence.jpa.PersistenceProvider
    Returned null to createEntityManagerFactory.
    at javax.persistence.Persistence.createEntityManagerF actory(Persistence.java:154)
    at org.springframework.orm.jpa.LocalEntityManagerFact oryBean.createNativeEntityManagerFactory(LocalEnti tyManagerFactoryBean.java:92)
    at org.springframework.orm.jpa.AbstractEntityManagerF actoryBean.afterPropertiesSet(AbstractEntityManage rFactoryBean.java:308)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1460)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1400)
    ... 92 more


    I tried copying all the Hibernate specific files and other App libraries to the Domain of glassfish { though i am not sure why we need to do that}

    Is there anything else i need to do? Is anything got to do with any spring configuration?

    Thanks in Advance.
Working...
X