Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [RESOLVED] EclipseLink on Tomcat7 (Dev. in Netbeans)
[RESOLVED] EclipseLink on Tomcat7 (Dev. in Netbeans) [message #1021646] Wed, 20 March 2013 13:06 Go to next message
Dante Basso is currently offline Dante BassoFriend
Messages: 5
Registered: March 2013
Junior Member
I make the EclipseLink works fine on the J2SE app, but on my J2EE app I'm got error!

Error:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named adecfdw

Follow all my configurations and code(s):

/WEB-INF/persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0">
  <persistence-unit name="adecfdw" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <properties>
      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/adecfdw"/>
      <property name="javax.persistence.jdbc.user" value="adecf"/>
      <property name="javax.persistence.jdbc.password" value="pass"/>
    </properties>
  </persistence-unit>
</persistence>


/WEB-INF/context.xml
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/ADECFServer">
  <Resource auth="Container" driverClassName="org.postgresql.Driver" maxActive="20" maxIdle="10" maxWait="-1" name="adecfdw" password="pass" type="javax.sql.DataSource" url="jdbc:postgresql://localhost:5432/adecfdw" username="adecf"/>
</Context>


Java code, the query:
public static Long newProcessID()
{
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("adecfdw");
    EntityManager em = emf.createEntityManager();
    Query query = em.createNativeQuery("SELECT nextval('processID')");
    return (Long) query.getSingleResult();
}

*this code works in J2SE.

How Can I solve my problem? Whats is Missing?
Thanks all for the help.

[Updated on: Wed, 20 March 2013 17:38]

Report message to a moderator

Re: EclipseLink on Tomcat7 (Dev. in Netbeans) [message #1021649 is a reply to message #1021646] Wed, 20 March 2013 13:08 Go to previous messageGo to next message
Dante Basso is currently offline Dante BassoFriend
Messages: 5
Registered: March 2013
Junior Member
I forgot to include this:

My Maven configuration:

...
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.1-901.jdbc4</version>
        </dependency> 
...




The Full Stack:

javax.persistence.PersistenceException: No Persistence provider for EntityManager named adecfdw
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
	at com.supridatta.adecfserver.ProcessIDGenerator.newProcessID(ProcessIDGenerator.java:22)
	at com.supridatta.adecfserver.UploadFileService.webUpload(UploadFileService.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
	at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
	at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
	at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)

[Updated on: Wed, 20 March 2013 13:44]

Report message to a moderator

Re: EclipseLink on Tomcat7 (Dev. in Netbeans) [message #1021795 is a reply to message #1021649] Wed, 20 March 2013 17:38 Go to previous message
Dante Basso is currently offline Dante BassoFriend
Messages: 5
Registered: March 2013
Junior Member
I resolved that using this configuration:

On Netbeans:
Other resources (src/main/resources) -> "META-INF/persistence.xml"

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0">
  <persistence-unit name="adecfdw" transaction-type="RESOURCE_LOCAL">
    <properties>
      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/adecfdw"/>
      <property name="javax.persistence.jdbc.user" value="adecf"/>
      <property name="javax.persistence.jdbc.password" value="pass"/>
      <!-- EclipseLink should create the database schema automatically -->
      <property name="eclipselink.ddl-generation" value="create-tables"/>
      <property name="eclipselink.ddl-generation.output-mode" value="database"/>
    </properties>
  </persistence-unit>
</persistence>


Now Its working as needed.
Previous Topic:MOXy point release?
Next Topic:BLOB Handling in DBWS generated webservice
Goto Forum:
  


Current Time: Mon Nov 24 01:15:13 GMT 2014

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

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