I have a problem using jpa under glassfish v1.
I have deployied META-INF/persistence.xml and entity bean a ejb-jar. During development i must deploy ejb-jar modules, because my application has got a lot of ejbs, and so using an ear structure force me to compile, package and deploy all the application to test a little new feaure.
[b]The persistence.xml is [/b]
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="
http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name ="I3668_ARPASICILIA">
<non-jta-data-source>I3668_ARPASICILIA</non-jta-data-source>
<!-- All persistence classes must be listed -->
<class>anthesi.isiportal.entity.Banner</class>
</persistence-unit>
</persistence>
where I3668_ARPASICILIA is the name of the connection pool that points to the postgresql 8.2 database
[b]the entity bean class is Banner.java[/b]
package anthesi.isiportal.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="ISI_BANNERS")
public class Banner implements java.io.Serializable{
@Id
@GeneratedValue
@Column(name="ID_BANNER")
private int id;
@Column(name="TITLE")
private String title;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
[b]the calling ejb class code is
SISIBanner4.java[/b]
package anthesi.isiportal.banner;
import java.util.List;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import anthesi.isiportal.entity.Banner;
@Stateless
public class SISIBanner4 implements IISIBanner4{
@SuppressWarnings("unchecked")
public void printBanner(String DatabaseName) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(DatabaseName);
EntityManager em = emf.createEntityManager();
String queryString = "package anthesi.isiportal.banner;
import java.util.List;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import anthesi.isiportal.entity.Banner;
@Stateless
public class SISIBanner4 implements IISIBanner4{
@SuppressWarnings("unchecked")
public void printBanner(String DatabaseName) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory(DatabaseName);
EntityManager em = emf.createEntityManager();
String queryString = "SELECT b FROM Banner b WHERE b.title = :title";
Query query = em.createQuery(queryString);
query.setParameter("title", "partecipa al blog");
List<Banner> result = query.getResultList();
for(Banner banner : result){
System.out.println("the banner id is "+banner.getId()+" title: "+banner.getTitle());
}
}
}
";
Query query = em.createQuery(queryString);
query.setParameter("title", "partecipa al blog");
List<Banner> result = query.getResultList();
for(Banner banner : result){
System.out.println("the banner id is "+banner.getId()+" title: "+banner.getTitle());
}
}
}
and the exception is
[#|2007-05-11T11:46:55.201+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Info]: 2007.05.11 11:46:55.201--ServerSession(343304587)--TopLink, version: Oracle TopLink Essentials - 2006.8 (Build 060830)
|#]
[#|2007-05-11T11:46:55.210+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Config]: 2007.05.11 11:46:55.210--ServerSession(343304587)--Connection(2058186346)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>I3668_ARPASICILIA
))
|#]
[#|2007-05-11T11:46:55.211+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Config]: 2007.05.11 11:46:55.211--ServerSession(343304587)--Connection(271331346)--Connected: jdbc:postgresql://localhost:5432/I3668_ARPASICILIA?loginTimeout=0&prepareThreshold=0
User: postgres
Database: PostgreSQL Version: 8.2.1
Driver: PostgreSQL Native Driver Version: PostgreSQL 8.2 JDBC4 with SSL (build 504)
|#]
[#|2007-05-11T11:46:55.221+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Config]: 2007.05.11 11:46:55.221--ServerSession(343304587)--Connection(248983635)--connecting(DatabaseLogin(
platform=>PostgreSQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>I3668_ARPASICILIA
))
|#]
[#|2007-05-11T11:46:55.222+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Config]: 2007.05.11 11:46:55.222--ServerSession(343304587)--Connection(1369809089)--Connected: jdbc:postgresql://localhost:5432/I3668_ARPASICILIA?loginTimeout=0&prepareThreshold=0
User: postgres
Database: PostgreSQL Version: 8.2.1
Driver: PostgreSQL Native Driver Version: PostgreSQL 8.2 JDBC4 with SSL (build 504)
|#]
[#|2007-05-11T11:46:55.227+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|[TopLink Info]: 2007.05.11 11:46:55.227--ServerSession(343304587)--file:/opt/appl/glassfish/glassfish-V1/domains/isiportalHEAD/applications/j2ee-modules/CISIBanner3-I3668_ARPASICILIA login successful
|#]
[#|2007-05-11T11:46:55.242+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;SISIBanner4;|EJB5018: An exception was thrown during an ejb invocation on [SISIBanner4]|#]
[#|2007-05-11T11:46:55.242+0200|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=12;_ThreadName=httpWorkerThread-8080-1;|
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:197)
at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:67)
at $Proxy325.printBanner(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:154)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:194)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:159)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:119)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:197)
at anthesi.isiportal.banner.__IISIBanner4_Remote_DynamicStub.printBanner(__IISIBanner4_Remote_DynamicStub.java)
at anthesi.isiportal.banner._IISIBanner4_Wrapper.printBanner(anthesi.isiportal.banner._IISIBanner4_Wrapper.java)
at org.cstura.mpx3.cache.MPX3Cache_anthesi_isiportal_banner_IISIBanner4.printBanner(MPX3Cache_anthesi_isiportal_banner_IISIBanner4.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at anthesi.isiportal.ISIPortalWebBean.invoke(ISIPortalWebBean.java:383)
at anthesi.isiportal.banner.CISIBanner4.printBanners(CISIBanner4.java:18)
at org.apache.jsp.test_jsp._jspService(test_jsp.java:156)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at anthesi.isiportal.servlets.VersionFilter.doFilter(VersionFilter.java:40)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at anthesi.isiportal.menu.filter.MenuPathFilter.doFilter(MenuPathFilter.java:104)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at anthesi.isiportal.servlets.GTemplateWebBeanFilter.doFilter(GTemplateWebBeanFilter.java:105)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Caused by: java.lang.IllegalArgumentException: An exception occured while creating a query in EntityManager
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:180)
at anthesi.isiportal.banner.SISIBanner4.printBanner(SISIBanner4.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
... 66 more
Caused by: Exception [TOPLINK-8006] (Oracle TopLink Essentials - 2006.8 (Build 060830)): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: A problem was encountered resolving the class name - The descriptor for [Banner] was not found.
at oracle.toplink.essentials.exceptions.EJBQLException.missingDescriptorException(EJBQLException.java:158)
at oracle.toplink.essentials.internal.parsing.ParseTreeContext.classForSchemaName(ParseTreeContext.java:135)
at oracle.toplink.essentials.internal.parsing.SelectNode.getClassOfFirstVariable(SelectNode.java:281)
at oracle.toplink.essentials.internal.parsing.SelectNode.getReferenceClass(SelectNode.java:269)
at oracle.toplink.essentials.internal.parsing.ParseTree.getReferenceClass(ParseTree.java:418)
at oracle.toplink.essentials.internal.parsing.ParseTree.adjustReferenceClassForQuery(ParseTree.java:79)
at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateReadQueryInternal(EJBQLParseTree.java:112)
at oracle.toplink.essentials.internal.parsing.EJBQLParseTree.populateQuery(EJBQLParseTree.java:93)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:174)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:138)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:84)
at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:71)
at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:175)
... 76 more
[Message sent by forum member 'alessandrop' (alessandrop)]
http://forums.java.net/jive/thread.jspa?messageID=216466