[JBoss jBPM] - JbpmContext: when to create new vs. get current
by brado
The general question: when should you create a new JbpmContext vs. get the current context?
The reason that this question hasn't been completely clear to me is because of a couple reasons:
1) It appears that any saving of data to the database (such as process instance state) doesn't commit until the JbpmContext is closed. This then seemed to suggest that a JbpmContext needed to be created and closed each time data needed to be saved to the database.
2) While I have seen documentation saying that JbpmConfiguration was re-entrant, I have seen no such indication that JbpmContext is. I wasn't sure that if I was working with a JbpmContext in a servlet (or several servlets) whether it would be safe for all of them to be operating simultaneously on the current jbpmContext, rather than all using their own jbpmContext instance for thread safety.
What is the recommended approach to using jbpmContexts? Can the "current" jbpmContext be used across multiple servlets and multiple threads without there being a problem, or does each one need to create its own jbpmContext, and how does this affect the committing of data to the database?
Thanks for your help,
Brad
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970410#3970410
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970410
19 years, 7 months
[Beginners Corner] - Jboss netbeans and web service
by Tadas
Hello everyone,
I am trying to make simple web service with netbeans. I did everything like documented here http://www.netbeans.org/kb/50/quickstart-webservice.html. Everything works fine if i am using rpcliteral, but if i set to documentliteral, during deployment process i get the following error
| 18:22:18,156 INFO [TomcatDeployer] deploy, ctxPath=/HiWS, warUrl=.../tmp/deploy/tmp53015HiWS-exp.war/
| 18:22:18,312 INFO [WSDLFilePublisher] WSDL published to: file:/C:/jboss-4.0.4.GA/server/default/data/wsdl/HiWS.war/HiWS.wsdl
| 18:22:18,359 WARN [ServiceMetaData] Cannot load class for type: {urn:HiWS/types}sayHiResponse,org.me.hi.HiWSSEI_sayHi_ResponseStruct
| 18:22:18,359 WARN [ServiceMetaData] Cannot load class for type: {urn:HiWS/types}sayHi,org.me.hi.HiWSSEI_sayHi_RequestStruct
| 18:22:18,359 ERROR [MainDeployer] Could not start deployment: file:/C:/jboss-4.0.4.GA/server/default/deploy/HiWS.war
| org.jboss.ws.WSException: Cannot load java type: org.me.hi.HiWSSEI_sayHi_RequestStruct
| at org.jboss.ws.metadata.ParameterMetaData.getJavaType(ParameterMetaData.java:141)
| at org.jboss.ws.metadata.ParameterMetaData.eagerInitialize(ParameterMetaData.java:291)
| at org.jboss.ws.metadata.OperationMetaData.eagerInitialize(OperationMetaData.java:474)
| at org.jboss.ws.metadata.EndpointMetaData.eagerInitialize(EndpointMetaData.java:353)
| at org.jboss.ws.metadata.ServiceMetaData.eagerInitialize(ServiceMetaData.java:397)
| at org.jboss.ws.metadata.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:143)
| at org.jboss.ws.server.ServiceEndpoint.start(ServiceEndpoint.java:131)
| at org.jboss.ws.server.ServiceEndpointManager$DefaultServiceLifecycle.startServiceEndpoint(ServiceEndpointManager.java:513)
| at org.jboss.ws.server.ServiceEndpointManager$ServiceLifecycleChain.startServiceEndpoint(ServiceEndpointManager.java:458)
| at org.jboss.ws.server.ServiceEndpointManager.startServiceEndpoint(ServiceEndpointManager.java:427)
| 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:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:287)
| at $Proxy32.startServiceEndpoint(Unknown Source)
| at org.jboss.ws.server.WebServiceDeployer.startServiceEndpoints(WebServiceDeployer.java:203)
| at org.jboss.ws.server.WebServiceDeployer.start(WebServiceDeployer.java:126)
| at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| 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:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy44.start(Unknown Source)
| at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1007)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:808)
| at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:771)
| at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
| 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:155)
| at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 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:659)
| at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| at $Proxy6.deploy(Unknown Source)
| at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
| at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
| Caused by: java.lang.ClassNotFoundException: org.me.hi.HiWSSEI_sayHi_RequestStruct
| at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
| at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
| at org.jboss.ws.utils.JavaUtils.loadJavaType(JavaUtils.java:81)
| at org.jboss.ws.metadata.ParameterMetaData.getJavaType(ParameterMetaData.java:137)
| ... 50 more
|
|
|
| I am using Netbeans 5.5 and JBoss 4.0.4.GA
|
| Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970408#3970408
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970408
19 years, 7 months
[EJB 3.0] - Generating hbm from Annotated Entity Beans
by sjmenden
I hope this is an acceptable place to post this question versus another forum.
My Goal: Generate hibernate mapping xml files from my Annotated Entity beans so I can use them in a non web application.
Here is what I've tried. I think I just need to be steered on the right track.
| <hibernatetool destdir="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/generated" >
| <ejb3configuration />
| <classpath>
| <!-- it is in this classpath you put your classes dir,
| and/or ejb3 persistence compliant jar -->
| <path location="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/classes" />
| </classpath>
| <!-- list exporters here -->
| <hbm2cfgxml ejb3="true" />
| <hbm2hbmxml destdir="/opt/jboss-seam-1.0.1.GA/examples/dvdstore/build/generated" />
| </hibernatetool>
| </target>
|
Whether I include the <hbm2hbmxml.... /> or not the mappings aren't generated in the hibernate.cfg.xml.
Ant output:
|
| generatehbm:
| [hibernatetool] Executing Hibernate Tool with a EJB3 Configuration
| [hibernatetool] 1. task: cfg2cfgxml (Generates hibernate.cfg.xml)
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.ejb.Version <clinit>
| [hibernatetool] INFO: Hibernate EntityManager 3.2.0.CR1
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.annotations.Version <clinit>
| [hibernatetool] INFO: Hibernate Annotations 3.2.0.CR1
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
| [hibernatetool] INFO: Hibernate 3.2 cr2
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
| [hibernatetool] INFO: hibernate.properties not found
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment buildBytecodeProvider
| [hibernatetool] INFO: Bytecode provider name : cglib
| [hibernatetool] Sep 8, 2006 11:15:31 AM org.hibernate.cfg.Environment <clinit>
| [hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
| [hibernatetool] Sep 8, 2006 11:15:32 AM org.hibernate.tool.hbm2x.Version <clinit>
| [hibernatetool] INFO: Hibernate Tools 3.1.0.beta5
| [hibernatetool] 2. task: hbm2hbmxml (Generates a set of hbm.xml files)
|
| BUILD SUCCESSFUL
| Total time: 3 seconds
|
|
generated hibernate.cfg.xml file:
| <?xml version="1.0" encoding="utf-8"?>
| <!DOCTYPE hibernate-configuration PUBLIC
| "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
| <hibernate-configuration>
| <session-factory>
| <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
| </session-factory>
| </hibernate-configuration>
|
But there are no actual mappings generated?
Guidance would be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970407#3970407
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970407
19 years, 7 months
[EJB 3.0] - Entity EJBs, @Service & Thread
by galo.navarro
Hi, I'm trying to get a service running on my JBoss server that would awake every now and then, get a list of entity beans and throw a message to a JMS queue for each of those items, and sleep for a while.
If I strip the bit loading Entity beans off, everything works, I send a test message to the queue, etc.
But if I do the same loading the beans, I get the exception below. I guess I'm doing something wrong but cannot figure out what.
| 17:02:32,650 ERROR [STDERR] Exception in thread "Thread-16"
| 17:02:32,650 ERROR [STDERR] java.lang.NullPointerException
| 17:02:32,650 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getNonTxEntityManager(ManagedEntityManagerFactory.java:58)
| 17:02:32,650 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.getTransactionScopedEntityManager(ManagedEntityManagerFactory.java:163)
| 17:02:32,650 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.createNamedQuery(TransactionScopedEntityManager.java:132)
| 17:02:32,650 ERROR [STDERR] at tal.noc.beans.NOCManagerService.loadNOCs(NOCManagerService.java:79)
| 17:02:32,650 ERROR [STDERR] at tal.noc.beans.NOCManagerService.run(NOCManagerService.java:86)
| 17:02:32,650 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
|
This is my service:
| @Service(objectName="jboss:custom=NOCManagerService")
| public class NOCManagerService implements Runnable, NOCManagementService {
|
| ....
|
| public void run() {
| this.running=true;
| while(this.running) {
| System.out.println("Awaken");
| Iterator nocs=this.loadNOCs().iterator();
| while(nocs.hasNext()) {
| NOC noc = (NOC)nocs.next();
| try {
| MessageSender ms=new MessageSender();
| ms.sendMessage("NOC: " + noc.toString(), "queue/msgQueue");
| } catch (Exception e) {
| e.printStackTrace(System.out);
| }
| }
| try {
| MessageSender ms=new MessageSender();
| ms.sendMessage("NOC", "queue/msgQueue");
| } catch (Exception e) {
| e.printStackTrace(System.out);
| }
| try {
| synchronized (this) {
| wait(60*1000);
| }
| } catch (Exception e) {
| e.printStackTrace(System.out);
| }
| }
| }
|
The service implements the following interface, just in case it makes any difference
| @Management
| public interface NOCManagementService {
|
Thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3970402#3970402
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3970402
19 years, 7 months