Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Installation of EclipseLink with Tomcat 7
Installation of EclipseLink with Tomcat 7 [message #693092] Tue, 05 July 2011 19:05 Go to next message
DenisGL  is currently offline DenisGL Friend
Messages: 6
Registered: July 2011
Junior Member
Hi,

I've tried to make work Tomcat 7 + JSF (myFaces 2) and EclipseLink with Eclipse Helios (tomcat configured and run from Eclipse also) and JDK 1.6, but I have the following problem :
- the first time i try to create an EntityManagerFactory :

emf = Persistence.createEntityManagerFactory("Bank", properties);

I get an exception.
I do this call in a session managed bean call from a web page. If I refresh the page, the call succeeds !

The exception is :


javax.faces.FacesException: Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: WebappClassLoader
  context: /Bank
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@13e8d89

Internal Exception: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: java.net.MalformedURLException
	at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
	at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:258)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: WebappClassLoader
  context: /Bank
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@13e8d89

Internal Exception: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: java.net.MalformedURLException
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:115)
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at net.mywebsrv.bank.dao.Dao.<init>(Dao.java:29)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider.newInstance(Tomcat7AnnotationLifecycleProvider.java:56)
	at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:155)
	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
	at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
	at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
	at org.apache.myfaces.el.convert.ValueExpressionToValueBinding.getValue(ValueExpressionToValueBinding.java:161)
	at org.apache.myfaces.config.impl.digester.elements.ManagedProperty.getRuntimeValue(ManagedProperty.java:120)
	at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(ManagedBeanBuilder.java:321)
	at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(ManagedBeanBuilder.java:162)
	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.createManagedBean(ManagedBeanResolver.java:332)
	at org.apache.myfaces.el.unified.resolver.ManagedBeanResolver.getValue(ManagedBeanResolver.java:295)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
	at org.apache.myfaces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:65)
	at org.apache.myfaces.el.convert.VariableResolverToELResolver.getValue(VariableResolverToELResolver.java:116)
	at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
	at org.apache.myfaces.el.unified.resolver.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:142)
	at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:71)
	at org.apache.el.parser.AstValue.getValue(AstValue.java:147)
	at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
	at org.apache.myfaces.view.facelets.el.TagValueExpression.getValue(TagValueExpression.java:85)
	at javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
	at javax.faces.component.UIData.getValue(UIData.java:1735)
	at javax.faces.component.UIData.createDataModel(UIData.java:1683)
	at javax.faces.component.UIData.getDataModel(UIData.java:1660)
	at javax.faces.component.UIData.getRowCount(UIData.java:471)
	at org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:289)
	at org.apache.myfaces.shared_impl.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:173)
	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:488)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:661)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:668)
	at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1483)
	at org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
	at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:85)
	at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
	... 17 more
Caused by: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: java.net.MalformedURLException
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionLoadingFromUrl(PersistenceUnitLoadingException.java:99)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:538)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:444)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:172)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:154)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:135)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:73)
	... 68 more
Caused by: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: file:/C:/WORK/DEV/Bank/EclipseWKS/Bank/WebContent/WEB-INF/classes/
Internal Exception: java.net.MalformedURLException
	at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnitLoadingException.java:117)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:579)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:536)
	... 73 more
Caused by: java.net.MalformedURLException
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:577)
	... 74 more



It seems that it searched for the META-INF/persistence.xml in the WEB-INF/classes directory, which does not exists on my installation.
If I create the 'classes' directory, i get another exception :

Internal Exception: java.io.FileNotFoundException: C:\WORK\DEV\Bank\EclipseWKS\Bank\WebContent\WEB-INF\classes


If I copy the META-INF/persistence.xml to this directory, the error disappears.

After looking at source code of JPA, it seems that two directories are searched for the persistence.xml file, but on first "not found" an exception is raised, and the second path is not searched.


Help would be appreciated.
Thanks in advance.
Re: Installation of EclipseLink with Tomcat 7 [message #693579 is a reply to message #693092] Wed, 06 July 2011 19:31 Go to previous messageGo to next message
DenisGL  is currently offline DenisGL Friend
Messages: 6
Registered: July 2011
Junior Member
I succeeded to get a workaround of this issue by making a little modification of the source code de EclipseLink :

in the PersistenceUnitProcessor class, I have added a try/catch FileNotFoundException, like this :

public static Set<Archive> findPersistenceArchives(ClassLoader loader, String descriptorPath){
        Archive archive = null;

        Set<Archive> archives = new HashSet<Archive>();

        // See if we are talking about an embedded descriptor
        int splitPosition = descriptorPath.indexOf("!/");

        try {
            // If not embedded descriptor then just use the regular descriptor path
            if (splitPosition == -1) {
                Enumeration<URL> resources = loader.getResources(descriptorPath);
                while (resources.hasMoreElements()){

                    URL descUrl = resources.nextElement();
                    URL puRootUrl = computePURootURL(descUrl, descriptorPath);
                    
                    // *** Here is the "patch"
                    try {
                    	archive = PersistenceUnitProcessor.getArchiveFactory(loader).createArchive(puRootUrl, descriptorPath, null);
                    catch (FileNotFoundException ex)
	            {                        // Ignore this path
	              	archive = null;
	            }
	            // End of patch


I don't know if it's the good way to do, but it works.
(no subject) [message #693584 is a reply to message #693092] Wed, 06 July 2011 19:31 Go to previous messageGo to next message
DenisGL  is currently offline DenisGL Friend
Messages: 6
Registered: July 2011
Junior Member
I succeeded to get a workaround of this issue by making a little modification of the source code de EclipseLink :

in the PersistenceUnitProcessor class, I have added a try/catch FileNotFoundException, like this :

public static Set<Archive> findPersistenceArchives(ClassLoader loader, String descriptorPath){
Archive archive = null;

Set<Archive> archives = new HashSet<Archive>();

// See if we are talking about an embedded descriptor
int splitPosition = descriptorPath.indexOf("!/");

try {
// If not embedded descriptor then just use the regular descriptor path
if (splitPosition == -1) {
Enumeration<URL> resources = loader.getResources(descriptorPath);
while (resources.hasMoreElements()){

URL descUrl = resources.nextElement();
URL puRootUrl = computePURootURL(descUrl, descriptorPath);

// *** Here is the "patch"
try {
archive = PersistenceUnitProcessor.getArchiveFactory(loader).createArchive(puRootUrl, descriptorPath, null);
catch (FileNotFoundException ex)
{ // Ignore this path
archive = null;
}
// End of patch


I don't know if it's the good way to do, but it works.
Re: (no subject) [message #698493 is a reply to message #693579] Tue, 19 July 2011 14:58 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please log a bug for this issue and include your patch.



James : Wiki : Book : Blog : Twitter
(no subject) [message #698504 is a reply to message #693579] Tue, 19 July 2011 14:58 Go to previous messageGo to next message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
Please log a bug for this issue and include your patch.


--
James : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
Re: (no subject) [message #702585 is a reply to message #698504] Tue, 26 July 2011 14:45 Go to previous message
DenisGL  is currently offline DenisGL Friend
Messages: 6
Registered: July 2011
Junior Member
Bug #353121 has been submitted.

By the way, I found a workaround that does not require patching of code : I disabled the "Serve modules without publishing" of the Tomcat configuration in Eclipse.

[Updated on: Tue, 26 July 2011 14:46]

Report message to a moderator

Previous Topic:(no subject)
Next Topic:Invalid column name problem
Goto Forum:
  


Current Time: Thu Apr 25 07:45:40 GMT 2024

Powered by FUDForum. Page generated in 0.03945 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top