Glassfish deployment exception - java

I'm developing a JavaEE application on Glasfish Application Server. I'm developing so I'm continously deployig/undeploying the application.
Everything has worked great until few hours ago when I got this error while deploying :
GRAVE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
GRAVE: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method
GRAVE: Exception while preparing the app
GRAVE: Could not resolve a persistence unit corresponding to the persistence-unit-ref-name [persistence/decreg-entite] in scope of the module called [declaration-reglementaire-ear#declaration-reglementaire-serviceweb-0.0.3-RELEASE.war]. Please verify your application.
org.glassfish.deployment.common.DeploymentException: Could not resolve a persistence unit corresponding to the persistence-unit-ref-name [persistence/decreg-entite] in scope of the module called [declaration-reglementaire-ear#declaration-reglementaire-serviceweb-0.0.3-RELEASE.war]. Please verify your application.
Has anyone an idea on how to solve this?
Thank you in andvace

it appears, the persistence unit named 'decreg-entite' is mentioned in your domain.xml file but the jpa configuration file, persistence.xml doesn't define all about the persistence unit.

Related

Spring - complete shutdown of web application

I have a web application which I'm trying to shut down by executing the close() method on the context:
((ConfigurableApplicationContext) appContext).close();
After executing this the application appears to be continuing running, health page produces the following exception:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
Is there a way to shudown the whole thing via Spring or should I resort to System.exit()?
Any help would be kindly appreciated!
PLease have a look at these questions. They are on the same line as yours:
How to manage Tomcat via Java,
Start / stop a web application from itself?
As #chrylis suggested, I think the easiest way of shutting down the server(if it's not running in embedded mode) is to use Runtime class.

Hibernate Exception during deploy

I´m using hibernate 4.3.6 in my vaadin project.
Every time I make changes in the sources code, it is expected that the application builds again and the new source code is deployed automatically to Tomcat. In other words, Tomcat should reload its context.
The problem is that during this operation hibernate throws an error:
GRAVE: Exception loading sessions from persistent storage
org.hibernate.HibernateException: registry does not contain entity manager factory: myproject
at org.hibernate.jpa.internal.EntityManagerFactoryRegistry.getNamedEntityManagerFactory
(...)
After that log, i get:
24/09/2014 13:14:43 org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/myproject] is completed
However, I cannot continue using the website, since I receive a message saying that session is lost.
My question is: what is this hibernate exception and how can I solve it?
EDIT:
This error only happens when I store in session a JPA Entity, for example: the logged user
I don´t know any way to get what you want, in Tomcat, except with JRebel. The staff of Vaadin itself uses and recommends. Link with interesting information about Vaadin+JRebel: http://zeroturnaround.com/blog/jrebel-case-study-vaadin-eliminates-redeploys-and-saves-10-of-development-time/
If in the future you decide to use Jetty instead of Tomcat, you can make settings and get dynamic reloading of the application as suggested here: https://blog.oio.de/2012/08/23/dynamic-reloading-of-vaadin-applications-with-maven-and-eclipse /

Web Service with glassfish and tomcat

I have generated a RestFul web service using NetBeans 7.2.1, Tomcat 6+ and MySQL, but When I test this Web Service I get the following exception:
java.lang.RuntimeException: javax.naming.NameNotFoundException: Name persistence-factory is not bound in this Context
This web service when implemented in the same way using glassfish.
Need some guidance, totally lost and have been searching for some fix for 3 days now' but un able to solve it' some guidance will be gud'

Hibernate exception when starting Tomcat (after upgrade to hibernate-3.5.0)

I'm getting the following exception when starting a Tomcat instance with my web app after upgrading to Hibernate 3.5.0:
org.hibernate.annotations.common.AssertionFailure: Fail to process type argument in a generic declaration. Type: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl
at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.getClassFromGenericArgument(AttributeFactory.java:836)
at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.getClassFromGenericArgument(AttributeFactory.java:833)
at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:748)
at org.hibernate.ejb.metamodel.AttributeFactory$PluralAttributeMetadataImpl.<init>(AttributeFactory.java:723)
at org.hibernate.ejb.metamodel.AttributeFactory.determineAttributeMetadata(AttributeFactory.java:518)
at org.hibernate.ejb.metamodel.AttributeFactory.buildAttribute(AttributeFactory.java:93)
As this happens on Tomcat startup, I have no idea where to look in my code to prevent that :-(
Putting that error message into google would have shown you any number of explanations, including this JIRA issue:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5098

Error injecting entity manager with Wicket/JPA

I have an app using Wicket for the presentation layer with CDI/Weld, JPA 2.0, EJB 3.1 etc. (Java EE 6) deployed on GlassFish v3.0.1.
When I try to inject an EJB into a wicket page using #EJB I get the following error:
java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName
When I try to inject using #Inject, I get the following error:
java.lang.IllegalStateException: Unable to convert ejbRef for ejb UserRepository to a business object of type class
I believe the problem is stemming from JPA. I am using the exact same configuration that I used with a JSF application which worked properly, so I am lost as to what the issue could be. The connection pools are set up properly and pinging correctly through GlassFish, I have included wicket-weld on the classpath and I have even tried using the old Java EE 5 wicketstuff project for wicketstuff-javaeeapi with the same results.
Any help would be appreciated.
If you get the exception:
Unable to retrieve EntityManagerFactory for unitName
It might mean it is not detecting your persistence.xml file. Make sure it's in the WEB-INF\classes\META-INF directory.
You can verify that your app has JPA enabled by going to the Admin Console in GlassFish, go to the Applications section and see if it shows something like [ejb, web, weld, jpa] for your app. If it doesn't show jpa then it's not finding your JPA config file.
Could always try to lookup the EJB via its standard "java:global" name. That should at least let you rule out wicket as a possible source of issues and get you a little closer to a working system.

Categories

Resources