JBoss 5.1 and Eclipselink
texiugo Jul 1, 2010 10:33 AMHello!
I'm trying to get a simple web project to work with JBoss 5.1, Eclipselink and JPA.
My error is pretty similar to the one in thread http://community.jboss.org/thread/146562,
although it doesn't have any solution...
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
{code:xml}
<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>
{code}
My datasource configuration in JBOSS_HOME/server/default/deploy/oracle-ds.xml
{code: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>
{code}
This is the code I use to try to get the EntityManager
{code}
EntityManagerFactory emf = Persistence.createEntityManagerFactory("example");
EntityManager em = emf.createEntityManager();
{code}
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.
Alway the same error...
Any help appreciated...
Thanks!