users@glassfish.java.net

Probelm deploying Servlet with PersistenceUnit

From: <forums_at_java.net>
Date: Tue, 21 Aug 2012 08:50:33 -0500 (CDT)

Hi, I am quite new to glassfish and I have run into a problem I can't seem to
get past. I am trying to create a webpage, it was working quite fine until I
tried to integrate my database into code. I keep getting a runtime error and
I have spent a large chunk of time trying to fix this but I am getting
nowhere with this. I would appreciate some help if anyone can. Here is the
code package org.glassfish.samples; import java.io.IOException; import
java.io.PrintWriter; import javax.persistence.EntityManagerFactory; import
javax.persistence.PersistenceUnit; import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet; import
javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import model.Person; // //**/
/ * Servlet implementation class TestServlet/ / *//
/_at_WebServlet("/TestServlet")/ /public class TestServlet extends HttpServlet
{/ / private static final long serialVersionUID = 1L;/ / / /
@PersistenceUnit/ / EntityManagerFactory emf;/ // / /**/ / * @see
HttpServlet#HttpServlet()/ / *// / public TestServlet() {/ / super();/ / //
TODO Auto-generated constructor stub/ / }/ // / /**/ / * @see
HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)/
/ *// / protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {/ / // TODO Auto-generated
method stub/ / response.setContentType("text/html");/ / PrintWriter out =
response.getWriter();/ / out.println(" / "Transitional//EN\">\n" +/ / "\n" +/
/ "Hello WWW\n" +/ / "\n" +/ / "
======== HELLO WWW
===========================================================

\n");/ / / / int count;/ / if(request.getSession().getAttribute("count") ==
null)/ / count = 0;/ / else/ / count =
(Integer)request.getSession().getAttribute("count");/ /
request.getSession().setAttribute("count", ++count);/ /
out.println("Accessed: " + request.getSession().getAttribute("count"));/ / /
/ / / Person p = (Person)emf.createEntityManager().createQuery("select p from
Person p ").getResultList().get(0);/ / out.println(p.getName());/ /
out.println("");/ / / / }/ /}/ And I always get this error messsage
.... WARNING: StandardWrapperValve[org.glassfish.samples.TestServlet]:
      PWC1406: Servlet.service() for servlet org.glassfish.samples.TestServlet
      threw exception

.... java.lang.VerifyError: Expecting a stackmap frame at branch target 18 in
      method model.Person._persistence_isAttributeFetched(Ljava/lang/String;)Z
      at offset 4

.... at java.lang.Class.forName0(Native Method)

.... at java.lang.Class.forName(Class.java:264)

.... at

org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getClassForName(PrivilegedAccessHelper.java:93)

.... at

org.eclipse.persistence.descriptors.ClassDescriptor.convertClassNamesToClasses(ClassDescriptor.java:1258)

.... at

org.eclipse.persistence.sessions.Project.convertClassNamesToClasses(Project.java:367)

.... at

org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:338)

.... at

org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:185)

.... at

org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)

.... at

org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:230)

.... at

com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.createEntityManager(EntityManagerFactoryWrapper.java:110)

.... at org.glassfish.samples.TestServlet.doGet(TestServlet.java:57)

.... at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)

.... at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

.... at

org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)

.... at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)

.... at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)

.... at

org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)

.... at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)

.... at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)

.... at

com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)

.... at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)

.... at

org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)

.... at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)

.... at

com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170)

.... at
      com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)

.... at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)

.... at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)

.... at

com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)

.... at

com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)

.... at

com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)

.... at

com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)

.... at

com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)

.... at

com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)

.... at

com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)

.... at com.sun.grizzly.ContextTask.run(ContextTask.java:71)

.... at

com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)

.... at

com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)

.... at java.lang.Thread.run(Thread.java:722)

Please I would appreciate help with this, it is driving me crazy. Also,
anyone no how to use the debugger with JavaEE. I try running debugging mode
but it doesn't to make any difference./

--
[Message sent by forum member 'dodo_manni']
View Post: http://forums.java.net/node/889396