Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with EclipseLink in Tomcat 7 (with RAP bridge)(MalformedURLException as soon as the EntityManager is instanciated)
Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #870083] Sun, 06 May 2012 09:55 Go to next message
Jan Brinkmann is currently offline Jan BrinkmannFriend
Messages: 5
Registered: May 2012
Junior Member
My application (Eclipse RAP 1.4 or 1.5, EclipseLink ORM, PostgreSQL) runs fine in my IDE or in a Eclipse OSGI server (just the binary without GUI). The second one only works if the application is unpacked (jar-Archive does not work).

For a deployment on a Tomcat7-Server I had to pack the plugin into a WAR-file (using the plugin from the incubation update site). It starts well but as soon as the EntityManager is instanciated (meaning the persistence.xml is accessed by EclipseLink), I get this error:
Quote:

Exception Description: An exception was thrown while trying to load persistence unit at url: bundleresource://1.fwk678808126:5
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persisten ce.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: bundleresource://1.fwk678808126:5
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(Persist enceUnitLoadingException.java:126)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:115)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.booking4.business.TestElementFactory.<init>(TestElementFactory.java:56)
at com.booking4.business.TestElementFactory.getInstance(TestElementFactory.java:38)
at com.booking4.util.session.AdminUserSession.login(AdminUserSession.java:28)
at com.booking4.gui.login.AdminLoginView.doDebugLogin(AdminLoginView.java:214)
at com.booking4.gui.login.AdminLoginView$1.mouseDoubleClick(AdminLoginView.java:61)
at org.eclipse.swt.events.MouseEvent.dispatchToObserver(MouseEvent.java:142)
at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:46)
at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:166)
at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:188)
at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1145)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1135)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2733)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2694)
at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:702)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:685)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
at com.booking4.BookingEntryPoint.createUI(BookingEntryPoint.java:15)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:177)
at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:289)
at java.lang.Thread.run(Thread.java:662)
at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:101)
Caused by: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.except ions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: bundleresource://1.fwk678808126:5
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persisten ce.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: bundleresource://1.fwk678808126:5
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionLoadingFromUrl(PersistenceUnitLoadingExc eption.java:99)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitPr ocessor.java:538)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcesso r.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)
... 25 more
Caused by: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.except ions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: bundleresource://1.fwk678808126:5
Internal Exception: java.net.MalformedURLException
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionProcessingPersistenceXML(PersistenceUnit LoadingException.java:117)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProces sor.java:579)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitPr ocessor.java:536)
... 30 more
Caused by: java.net.MalformedURLException
at java.net.URL.<init>(URL.java:601)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProces sor.java:577)
... 31 more

I tried to change parts of my XML but that doesnot seem to help. I debugged deeply into the EclipseLink library and the SAXParser parsing the config file and found that the MalformedURLException seems to be through because of a missing System-ID or encoding.

Is my general setup wrong? Maybe the Parser is not able to read from the jar-File in this context..
Any help is appreciated...
Re: Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #870283 is a reply to message #870083] Mon, 07 May 2012 14:59 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 include your persistence.xml and the structure of your war file.

James : Wiki : Book : Blog : Twitter
Re: Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #870365 is a reply to message #870283] Mon, 07 May 2012 19:37 Go to previous messageGo to next message
Jan Brinkmann is currently offline Jan BrinkmannFriend
Messages: 5
Registered: May 2012
Junior Member
persistence.xml is:
Quote:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http: //java.sun.com/xml/ns/persistence" xmlns:xsi="http: //www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http: //java.sun.com/xml/ns/persistence http: //java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="administration" transaction-type="RESOURCE_LOCAL">
<class>com.company.business.objects.persisted.Element</class>
<class>com.company.business.objects.persisted.User</class>
<class>com.company.business.objects.persisted.Company</class>
<class>com.company.business.objects.persisted.Location</class>

<properties>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql: //localhost:5432/test" />
<property name="javax.persistence.jdbc.user" value="user" />
<property name="javax.persistence.jdbc.password" value="password" />
<property name="eclipselink.cache.shared.default" value="false"/>
<property name="eclipselink.weaving" value="false"/>
</properties>
</persistence-unit>
</persistence>


and the structure of the war-file is (as generated by the war-export plugin for eclipse IDE:
Quote:

WEB-INF
WEB-INF\.eclipseproduct
WEB-INF\configuration
WEB-INF\launch.ini
WEB-INF\lib
WEB-INF\plugins
WEB-INF\web.xml
WEB-INF\configuration\config.ini
WEB-INF\lib\org.eclipse.equinox.servletbridge_1.2.100.v20120209-2014.jar
WEB-INF\plugins\myplugin_1.0.0.201205011529.jar
WEB-INF\plugins\com.ibm.icu.base.source_4.4.2.v20110831.jar
WEB-INF\plugins\com.ibm.icu.base_4.4.2.v20110831.jar
WEB-INF\plugins\org.eclipse.core.commands_3.6.0.v20111007-1312.jar
WEB-INF\plugins\org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar
WEB-INF\plugins\org.eclipse.core.databinding.beans_1.2.100.v20111007-1312.jar
WEB-INF\plugins\org.eclipse.core.databinding.observable_1.4.1.v20111007-1312.jar
WEB-INF\plugins\org.eclipse.core.databinding.property_1.4.0.v20111007-1312.jar
WEB-INF\plugins\org.eclipse.core.databinding_1.4.1.v20111007-1312.jar
WEB-INF\plugins\org.eclipse.core.expressions_3.4.300.v20110228.jar
WEB-INF\plugins\org.eclipse.core.jobs_3.5.200.v20120113-1913.jar
WEB-INF\plugins\org.eclipse.core.runtime_3.8.0.v20120308-2101.jar
WEB-INF\plugins\org.eclipse.equinox.app_1.3.100.v20111010-1614.jar
WEB-INF\plugins\org.eclipse.equinox.common_3.6.100.v20120209-1951.jar
WEB-INF\plugins\org.eclipse.equinox.http.registry_1.1.100.v20111010-1614.jar
WEB-INF\plugins\org.eclipse.equinox.http.servletbridge_1.0.200.v20111010-1614.jar
WEB-INF\plugins\org.eclipse.equinox.http.servlet_1.1.300.v20111202-1521.jar
WEB-INF\plugins\org.eclipse.equinox.preferences_3.5.0.v20120120-1210.jar
WEB-INF\plugins\org.eclipse.equinox.registry_3.5.200.v20111010-1614.jar
WEB-INF\plugins\org.eclipse.equinox.servletbridge.extensionbundle_1.2.0.v20111010-1614.jar
WEB-INF\plugins\org.eclipse.equinox.servletbridge_1.2.100.v20120209-2014.jar
WEB-INF\plugins\org.eclipse.help_3.6.0.v20111021.jar
WEB-INF\plugins\org.eclipse.osgi.services_3.3.0.v20120307-2102.jar
WEB-INF\plugins\org.eclipse.osgi_3.8.0.v20120312-2035.jar
WEB-INF\plugins\org.eclipse.rap.demo.databinding_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.demo_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.design.example_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.jface.databinding_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.jface_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.rwt.osgi_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.rwt_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.ui.cheatsheets_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.ui.forms_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.ui.views_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.ui.workbench_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.eclipse.rap.ui_1.5.0.20120320-1638.jar
WEB-INF\plugins\org.junit_3.8.2.v3_8_2_v20100427-1100.jar


the persistence.xml is located in the file "WEB-INF\plugins\myplugin_1.0.0.201205011529.jar".
I tried putting it directly into the WAR or in an META-INF subdir but that didnt help either...

(note: the blanks after the "jdbc:postgresql:" and "http:" substrings are intentional to avoid URL-Formatting and are not in the actual files)
Re: Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #871020 is a reply to message #870365] Thu, 10 May 2012 14:38 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Normal servlets only put lib on the classpath, so your issue has to do with your OSGi usage from org.eclipse.equinox.servletbridge_1.2.100.v20120209-2014.jar. All of the plugins are not on the normal applications classpath, so JPA cannot see them.

I'm no OSGi expert, but my guess is you need to at least set the class loader for EclipseLink to use, using the "eclipselink.classloader" persistence unit property.

Refer the EclipseLink's OSGi examples,
http://wiki.eclipse.org/EclipseLink/Examples/OSGi


James : Wiki : Book : Blog : Twitter

[Updated on: Thu, 10 May 2012 14:38]

Report message to a moderator

Re: Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #871343 is a reply to message #870083] Sat, 12 May 2012 08:14 Go to previous messageGo to next message
Jan Brinkmann is currently offline Jan BrinkmannFriend
Messages: 5
Registered: May 2012
Junior Member
Thank you, but setting the "eclipselink.classloader" property didnot help.

I will try and deploy the persistence packages as bundles.

Slitely unrelated question (as I am not that familiar with deploying servlets etc):
would this be a problem if I would use the Virgo application server?
Re: Problem with EclipseLink in Tomcat 7 (with RAP bridge) [message #873903 is a reply to message #871343] Sat, 19 May 2012 12:26 Go to previous message
Jan Brinkmann is currently offline Jan BrinkmannFriend
Messages: 5
Registered: May 2012
Junior Member
Ok, I tried and deploy the WAR on a Glassfish server: same result! Both 32bit Windows and 64bit CentOs...
What am I missing?
Previous Topic:Merge with Null being ignored
Next Topic:Restore from history
Goto Forum:
  


Current Time: Wed Dec 17 23:13:26 GMT 2014

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

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