Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink and JBoss 5.1 java.net.MalformedURLException
Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #544091] Thu, 01 July 2010 14:50 Go to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
Hello!

I'm trying to get a simple web project to work with JBoss 5.1, Eclipselink and JPA.

When I deploy the project to JBoss it displays this info:


14:28:05,409 WARN  [SaxJBossXBParser] schema_reference.4: Failed to read schema document 'http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>. @ vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.teste.war/WEB-INF/classes/META-INF/persistence.xml[4,28]
14:28:06,361 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=#example
14:28:06,566 INFO  [STDOUT] [EL Warning]: 2010-07-01 14:28:06.548--Thread(Thread[HDScanner,5,jboss])--The temporary classLoader for PersistenceLoadProcessor [example] is not available.  Switching classLoader to [BaseClassLoader@38323f{vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.teste.war/}].  Weaving has been disabled for this session. EclipseLink may be unable to get a spec mandated temporary class loader from the server, you may be able to use static weaving as an optional workaround. 
14:28:06,574 INFO  [STDOUT] [EL Finest]: 2010-07-01 14:28:06.567--ServerSession(29759283)--Thread(Thread[HDScanner,5,jboss])--Begin predeploying Persistence Unit example; session vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.teste.war/WEB-INF/classes/_example; state Initial; factoryCount 0



Then, when I try to access the application on the browser it throws this Exception:


 
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: org.jboss.web.tomcat.service.WebCtxLoader$ENCLoader@9fbb7b
Internal Exception: Exception [EclipseLink-30009] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while trying to load persistence unit at url: vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.teste.war/WEB-INF/classes/
Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while processing persistence.xml from URL: vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.teste.war/WEB-INF/classes/
Internal Exception: java.net.MalformedURLException
	org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
	org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:133)
	org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
	javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
	pt.jboss.teste.manager.BossTesteManager.<init>(BossTesteManager.java:17)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:61)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)



This is my persistence.xml file



<persistence 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"
             version="2.0">
    <persistence-unit name="example" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>java:OracleDS</jta-data-source>        
        <class>pt.jboss.teste.BossTeste</class>

        <properties>
            <!-- Application managed datasource -->
            <property name="eclipselink.target-server" value="JBoss"/>
            <property name="eclipselink.target-database" value="Oracle"/>
            <!-- remove for production -->
            <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
            <property name="eclipselink.ddl-generation.output-mode" value="database"/>
            <property name="eclipselink.logging.level" value="FINEST"/>
        </properties>
    </persistence-unit>
</persistence>



My datasource configuration in JBOSS_HOME/server/default/deploy/oracle-ds.xml



<datasources>
 <no-tx-datasource>
 <jndi-name>OracleDS</jndi-name>
 <use-java-context>true</use-java-context>
 <connection-url>jdbc:oracle:thin:@XXXhost:1521:XXXsid</connection-url>
 <driver-class>oracle.jdbc.OracleDriver</driver-class>
 <user-name>USERNAME</user-name>
 <password>PASSWORD</password>
 
 <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
 <metadata>
 <type-mapping>Oracle9i</type-mapping>
 </metadata>
 </no-tx-datasource>
</datasources>



This is the code I use to try to get the EntityManager

EntityManagerFactory emf = Persistence.createEntityManagerFactory("example");
EntityManager em = emf.createEntityManager();



The eclipselink.jar is in JBOSS_HOME/common/lib,
but I also tried to put it in JBOSS_HOME/server/default/lib and in my project lib.
Always the same error...


Any help appreciated...

Thanks!
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #544402 is a reply to message #544091] Fri, 02 July 2010 14:52 Go to previous messageGo to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
While debugging in eclipselink files I was able to find out the reason of the java.net.MalformedURLException, but I don't know how to solve this....

When I deploy my project to Jboss the method init() in org.eclipse.persistence.internal.jpa.deployment.JarInputStre amURLArchive class is invoked.

The rootURL variable is with the value 'vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.te ste.war/WEB-INF/classes/'.

Everything goes ok, and the entries List gets the values of the files inside the classes directory.

The problem happens when I call
Persistence.createEntityManagerFactory("example");


init() method gets invoked again, but this time the rootURL.openStream() returns a different result...

This is what I do not understand, because rootURL variable has the same value...

This makes the entries List to get empty, and will turn into a java.net.MalformedURLException....

Here is the init() method that I've mentioned

    private void init() throws IOException {
        JarInputStream jis = new JarInputStream(
                new BufferedInputStream(rootURL.openStream()));
        try {
            do {
                ZipEntry ze = jis.getNextEntry();
                if (ze == null) {
                    break;
                }
                if (!ze.isDirectory()) {
                    entries.add(ze.getName());
                }
            } while (true);
        } finally {
            jis.close();
        }
    }



I just don't know what to do...

Any ideas?!?

Thanks!
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #544804 is a reply to message #544091] Mon, 05 July 2010 14:54 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Could you include the full exception, including the caused by.

What OS are you using?


James : Wiki : Book : Blog : Twitter
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #544845 is a reply to message #544804] Mon, 05 July 2010 17:11 Go to previous messageGo to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
Hello!

I'm running on Windows Vista Enterprise 64-bit.


Sorry, I've posted the exception displayed on the browser.

Here's the log on the server

18:02:23,635 INFO  [ServerImpl] JBoss (Microcontainer) [5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221053)] Started in 34s:206ms
18:02:47,430 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
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 org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceXML(PersistenceUnitProcessor.java:492)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processPersistenceArchive(PersistenceUnitProcessor.java:451)
	at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.getPersistenceUnits(PersistenceUnitProcessor.java:361)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchive(JPAInitializer.java:156)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfoInArchives(JPAInitializer.java:143)
	at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.findPersistenceUnitInfo(JPAInitializer.java:125)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:98)
	at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
	at pt.jboss.teste.manager.BossTesteManager.<init>(BossTesteManager.java:13)
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545621 is a reply to message #544091] Thu, 08 July 2010 13:14 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Seems like your persistence.xml is invalid, please include it.


James : Wiki : Book : Blog : Twitter
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545623 is a reply to message #545621] Thu, 08 July 2010 13:17 Go to previous messageGo to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
James wrote on Thu, 08 July 2010 09:14
Seems like your persistence.xml is invalid, please include it.




It's in my first post:)
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545624 is a reply to message #544091] Thu, 08 July 2010 13:17 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

oops sorry, did notice it above.

The issue seems to be the header,

try,
<persistence 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 persistence_2_0.xsd" version="2.0">




James : Wiki : Book : Blog : Twitter
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545635 is a reply to message #544091] Thu, 08 July 2010 13:31 Go to previous messageGo to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
No... same error...

Don't really think the problem is in the persistence.xml file because when I make the deploy everything goes ok.. Jboss and eclipselink can find and parse it...

Although, when I try to open the connection, eclipselink can't get to the file!!
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545641 is a reply to message #544091] Thu, 08 July 2010 13: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

Yes, you seem to be correct, the issue is with the URL to the file, not in the file.

>> 'vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/pt.jboss.te ste.war/WEB-INF/classes/'.

Note it is using "/" but you are on Windows, could be a "/" vs "\" issue. Does it work on Linux?

I remember we fixed some issue like this recently, can you try the latest build?


James : Wiki : Book : Blog : Twitter
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545649 is a reply to message #544091] Thu, 08 July 2010 13:55 Go to previous messageGo to next message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
I'm running with eclipselink-2.1.0.v20100614-r7608...isn't it the latest?

Haven't tried it in linux... but again... I don't think that's the problem either... Java deals with "/" pretty well in windows...and while deploying that init() method I've mentioned can get to all the files....
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #545738 is a reply to message #544091] Thu, 08 July 2010 20:08 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
Hello,

Could this be related to the bug described at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=287718

If so, there is a workaround you can try described in the bug.

Best Regards,
Chris
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #552236 is a reply to message #544091] Wed, 11 August 2010 11:45 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: August 2010
Junior Member
Hi, i have exactly the same problem here, running JBOSS 6 M3 on LINUX.
Did you solve it already?
Re: Eclipselink and JBoss 5.1 java.net.MalformedURLException [message #552254 is a reply to message #552236] Wed, 11 August 2010 12:58 Go to previous message
HC is currently offline HCFriend
Messages: 20
Registered: July 2009
Junior Member
Hello!

Unfortunately I couldn't waste more time with this issue, so I had to replace eclipselink with another technology Sad

Sorry...
Previous Topic:Sharing using information with an entity listener
Next Topic:How to use MOXy provider with Glassfish server
Goto Forum:
  


Current Time: Tue Mar 19 03:25:39 GMT 2024

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

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

Back to the top