Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persistence/(No Such Method - getCriteriaBuilder)
java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persistence/ [message #778596] Fri, 13 January 2012 13:24 Go to next message
Marvin Toll is currently offline Marvin TollFriend
Messages: 34
Registered: July 2009
Member
Any Ideas???

Using Tomcat and EclipseLink v. 2.3.2 and failing on the line of code "final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();" in the following method:

/**
* This method returns the number of records in the database.
*
* @param boClass
* @return boolean
*/
public <BO extends SjpBaseBO> Long countGM(final Class<BO> boClass) {

if (null == boClass) {

throw new SjpPersistenceSE("Unable to resolve the null value.");
}

final EntityManager entityManager = initializeEntityManager();

final CriteriaBuilder criteriaBuilder = entityManager
.getCriteriaBuilder();

final CriteriaQuery<Long> criteriaQuery = criteriaBuilder
.createQuery(Long.class);
criteriaQuery
.select(criteriaBuilder.count(criteriaQuery.from(boClass)));

// cq.where(//your stuff);

return entityManager.createQuery(criteriaQuery).getSingleResult();
}



java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persistence/criteria/CriteriaBuilder;
at info.soaj.sjp.facade.SjpBasicRF.countGM(SjpBasicRF.java:550)
at info.soaj.sjp.testing.SjpIncontainerTC.countGM(SjpIncontainerTC.java:287)
at info.soaj.sjr.domain.entity.booking.BookingBoMultiThreadTest.queryRecursive(BookingBoMultiThreadTest.java:221)
at info.soaj.sjr.domain.entity.booking.BookingBoMultiThreadTest.testBookingBO_find(BookingBoMultiThreadTest.java:129)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:225)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:102)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:225)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java:1)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:73)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:225)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java:1)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)


Marvin Toll
CTO, Pattern Enabled Development
http://pedCentral.com
Re: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persiste [message #778638 is a reply to message #778596] Fri, 13 January 2012 15:50 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
You are using a JPA 1.0 persistence jar on your classpath which does not have the EntityManager.getCriteriaBuilder() method. Try using the JPA 2.0 javax.persistence.jar instead.

Best Regards,
Chris
Re: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persiste [message #778639 is a reply to message #778596] Fri, 13 January 2012 15:50 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
You are using a JPA 1.0 persistence jar on your classpath which does not have the EntityManager.getCriteriaBuilder() method. Try using the JPA 2.0 javax.persistence.jar instead.

Best Regards,
Chris
Re: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persiste [message #778762 is a reply to message #778639] Fri, 13 January 2012 19:39 Go to previous message
Marvin Toll is currently offline Marvin TollFriend
Messages: 34
Registered: July 2009
Member
Thank you Chris! Embarrassed

Marvin Toll
CTO, Pattern Enabled Development
http://pedCentral.com
Re: java.lang.NoSuchMethodError: javax.persistence.EntityManager.getCriteriaBuilder()Ljavax/persiste [message #778764 is a reply to message #778638] Fri, 13 January 2012 19:39 Go to previous message
Marvin Toll is currently offline Marvin TollFriend
Messages: 34
Registered: July 2009
Member
Thank you Chris! :blush:

Marvin Toll
CTO, Pattern Enabled Development
http://pedCentral.com
Previous Topic:QueryHints.LEFT_FETCH not working
Next Topic:DBWS: java.sql.SQLSyntaxErrorException
Goto Forum:
  


Current Time: Mon Nov 11 02:06:23 GMT 2024

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

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

Back to the top