[Persistence] - Simple JPA question
by muzero
I'm trying to create a simple INSERT and DELETE test of an entity using JPA:
|
| User user = new User();
|
| userEao = (GenericEAO<User, Long>) cxt.lookup("UserEAO/remote");
|
| User user2 = userEao.persist(user);
|
| userEao.flush();
|
|
The question is: when user is created should be in TRANSISTENT state, and when i persist it with
User user2 = userEao.persist(user);
i suppose that the user2 is a reference of a user in a MANAGED state.
Actually if i try to delete user with
userEao.delete(user);
jboss tell to me:
| [DefaultDeleteEventListener] handling transient entity in delete processing
|
and it's correct, but if i try to delete the user2 jboss tell to me
| javax.ejb.EJBException: java.lang.IllegalArgumentException: Removing a detached instance
|
and i dont' understand why the entity user2 is detached!
so i have BEFORE to merge it ( DETACHED -> MANAGED ) , and than to DELETE, and it works.
| @Override
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| public User persist(User entity) {
| getEntityManager().persist(entity);
| return entity;
| }
|
is it the problem? when the persist finish, it close the transaction and entity became detached?
i dont want to merge it, cause it causes another select that i want to avoid.
Or i should i cache the entity instead?
probably i didn't understand the JPA transactions, what you suggest me to read?
Thanks, Muzero
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255030#4255030
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255030
15 years, 4 months
[Installation, Configuration & Deployment] - EAR Deployment failure
by ravirachannavar
Hi Experts,
When I am trying te deploy the EAR in JBoss It is failing because of the below exception.The ear has jar and war. after deploying the jar,war deployment fails because of the below exception
But with the same web.xml and struts-config.xml we are able to deploy the ear in Weblogic and Websphere where we only get a exception but the server startsup
17:54:57,689 ERROR [[/V4BETA1]] Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.ClassCastException: org.apache.crimson.jaxp.SAXParserFactoryImpl
at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107)
at com.sun.faces.config.ConfigureListener$WebXmlProcessor.getConfiguredFactory(ConfigureListener.java:698)
at com.sun.faces.config.ConfigureListener$WebXmlProcessor.scanForFacesServlet(ConfigureListener.java:670)
at com.sun.faces.config.ConfigureListener$WebXmlProcessor.(ConfigureListener.java:644)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:156)
at org.jboss.web.jsf.integration.config.JBossJSFConfigureListener.contextInitialized(JBossJSFConfigureListener.java:60)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
leading to...............
17:55:00,314 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/V4BETA1 state=Create mode=Manual requiredState=Installed
org.jboss.deployers.spi.DeploymentException: URL file:/C:/jboss-5.1.0.GA/server/default/tmp/4sk6b8-xi87hr-fzgqmqsb-1-fzgrou4c-9u/MCAppWAR.war/ deployment failed
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:331)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
7:56:31,879 INFO [ProxyFactory] Unbind EJB Home 'PTR' from jndi 'PTR'
17:56:31,926 INFO [EjbModule] Undeployed PTR
17:58:06,210 ERROR [AbstractKernelController] Error installing to Real: name=vfszip:/C:/jboss-5.1.0.GA/server/default/deploy/MCApplication.ear/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: URL file:/C:/jboss-5.1.0.GA/server/default/tmp/4sk6b8-xi87hr-fzgqmqsb-1-fzgrou4c-9u/MCAppWAR.war/ deployment failed
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:331)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeploy
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255026#4255026
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255026
15 years, 4 months
[Installation, Configuration & Deployment] - Re: jsp pages won't compile, servlets run fine
by tjansto
version is 1.6 in a ubuntu 8.04 environment, here's the full version info:
root# /usr/lib/jvm/jdk1.6.0/bin/java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)
and the stack trace info is as shown below. the a.b.c.d class i referred to in the post (abbreviated it earlier for, well, for brevity), are the classes that are called out in the stack trace. as for the location of those classes, they are in an ear file that gets deployed (10base.ear), before the war that contains these jsp files (20app.war) gets deployed. they are not located somewhere specifically in the class path. i am trying to take advantage of the classes already having been loaded from the 10base.ear for availability to use in the 20app.war file, and they are, but again, only for the servlets, but not the jsp pages. i didn't mention it earlier, but jsp pages in the 20app.war that rely on classes contained within that war itself (WEB-INF/classes) also do work fine (as one would expect). and again, in the jboss 4.x environment these deployed and ran without these problems.
04:58:39,077 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 16 in the generated java file
Only a type can be imported. com.evolved.radweb.domain.User resolves to a package
An error occurred at line: 17 in the generated java file
Only a type can be imported. com.evolved.radweb.ui.DataTable resolves to a package
An error occurred at line: 35 in the jsp file: /application/jsp/DictationWorklist.jsp
DataTable cannot be resolved to a type
32: Long userId = null;
33: String userName = null;
34: String userMessage = null;
35: DataTable worklistDT = null;
36: Application radwebApplication = null;
37:
38: User user = null;
An error occurred at line: 38 in the jsp file: /application/jsp/DictationWorklist.jsp
User cannot be resolved to a type
35: DataTable worklistDT = null;
36: Application radwebApplication = null;
37:
38: User user = null;
39:
40: String orgId = request.getParameter("orgId");
41: String searchOption = request.getParameter("searchOption") != null ? request.getParameter("searchOption") : "FILMED";
An error occurred at line: 61 in the jsp file: /application/jsp/DictationWorklist.jsp
User cannot be resolved to a type
58: userId = (Long) sessionInfo.get(ClientSessionTracker.WEB_USER_ID);
59: userName = (String) sessionInfo.get(ClientSessionTracker.WEB_USER_NAME);
60: if (s.getAttribute(USER_SESSION) != null) {
61: user = (User) s.getAttribute(USER_SESSION);
62: }else {
63: user = User.getUserById(userId.intValue());
64: s.setAttribute(USER_SESSION, user);
An error occurred at line: 63 in the jsp file: /application/jsp/DictationWorklist.jsp
User cannot be resolved
60: if (s.getAttribute(USER_SESSION) != null) {
61: user = (User) s.getAttribute(USER_SESSION);
62: }else {
63: user = User.getUserById(userId.intValue());
64: s.setAttribute(USER_SESSION, user);
65: }
66: if (s.getAttribute(APPLICATION_SESSION) != null) {
An error occurred at line: 74 in the jsp file: /application/jsp/DictationWorklist.jsp
DataTable cannot be resolved to a type
71: radwebApplication = bureaucrat.getApplication();
72: s.setAttribute(APPLICATION_SESSION, radwebApplication);
73: }
74: worklistDT = (DataTable) s.getAttribute(WORKLIST_SESSION);
75: // worklistDT = null;
76: if (worklistDT == null) {
77: worklistDT = DataTable.getDataTable("DictationWorklist");
An error occurred at line: 77 in the jsp file: /application/jsp/DictationWorklist.jsp
DataTable cannot be resolved
74: worklistDT = (DataTable) s.getAttribute(WORKLIST_SESSION);
75: // worklistDT = null;
76: if (worklistDT == null) {
77: worklistDT = DataTable.getDataTable("DictationWorklist");
78: String[] columnNames = new String[] {
79: Exam.LINKED_EXAMS_ID, Exam.LOCK, Exam.PRIORITYDESC, Exam.PATIENTNAMEUS,
80: Exam.MRN, Exam.ACCESSIONNUMBER, Exam.ORDERSOURCEDESC,
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn.invoke(ClusteredSingleSignOn.java:672)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:436)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:384)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255023#4255023
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255023
15 years, 4 months
[jBPM Users] - JBPM 4.x using Sybase ASE 11/12 on Jboss 5.1.0GA
by HelloW
Hey Every1,
I've installed and configured JBPM 4.1 using Sybase (yes yes I know...why) on JBoss 5.1.0GA.
Everything seems ok but when I access the Reporting Screen (Process Reports) I get this error in the logs:
java.sql.SQLException:
Caused by: java.sql.SQLException: Login failed
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsLoginAckToken(TdsCore.java:2952)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2260)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:602)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:344)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnec
tion(LocalManagedConnectionFactory.java:207)
I am using JTDS to connect to Sybase and wanted to know if this error is pertaining to DTM (Distributed Transaction Management). On a related note I added the "jbpmtest" user and pass to the jbpm.hibernate.cfg.xml contained in this directory jboss.home\server\default\deploy\jbpm\jbpm-service.sar
| ....
| <property name="hibernate.dialect">org.hibernate.dialect.SybaseDialect</property>
| <property name="hibernate.connection.datasource">java:JbpmDS</property>
| <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
| <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
| <property name="hibernate.connection.username">jbpmtest</property>
| <property name="hibernate.connection.password">jbpmtest</property>
| ....
|
Yet I still get a Login Failed error which leads me to believe that the error is misleading??? Any ideas or feedback?
Thanks
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255021#4255021
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255021
15 years, 4 months
[jBPM Users] - extending taskquery
by sravyts
I'm trying to extend TaskQueryImpl so I can add my own domain model search criteria.
I first started out by creating a new query impl class extending AbstractQuery. But then I was thinking that it would be better to extend TaskQueryImpl and append my search criteria to the hql() generated by this class (this way, changes on the jbpm task tables won't cause my queries to error because I get the changes made to TaskQueryImpl for free.)
But ...
in the hql() method of TaskQueryImpl appendOrderByClause(hql) is called. So I can't append other search criteria after calling super.hql()... Couldn't it be possible to call the appendOrderByClause() from the AbstractQuery -> execute method after calling hql()? Ok, maybe the hql() method name is not really a good method name anymore in this case because the full hql is not generated here ...
But it would make the queries a lot more extendable!
What do you think?
Wk,
Sofie
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255016#4255016
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255016
15 years, 4 months
Returned mail: see transcript for details
by Bounced mail
The original message was received at Mon, 14 Sep 2009 15:16:18 +0700 from lists.jboss.org [82.8.156.23]
----- The following addresses had permanent fatal errors -----
jboss-user(a)lists.jboss.org
----- Transcript of session follows -----
... while talking to lists.jboss.org.:
554 5.0.0 Service unavailable; [36.173.98.113] blocked using bl.spamcop.net
Session aborted, reason: lost connection
15 years, 4 months