[jBPM Users] - Re: [jbpm 4.2] My first simple application doesn't work :(
by -Silver-
Thanks!
I tried with your code but I received this exception:
| java.lang.ExceptionInInitializerError
| Caused by: org.jbpm.api.JbpmException:
| error: couldn't parse xml document : org.jbpm.api.JbpmException: resource jbpm.cfg.xml does not exist
| error: parsing exception: null : java.lang.NullPointerException
| at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:175)
| at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:141)
| at org.jbpm.pvm.internal.xml.Parse.checkErrors(Parse.java:190)
| at org.jbpm.pvm.internal.cfg.ProcessEngineImpl.parse(ProcessEngineImpl.java:222)
| at org.jbpm.pvm.internal.cfg.ProcessEngineImpl.setResource(ProcessEngineImpl.java:194)
| at org.jbpm.api.Configuration.setResource(Configuration.java:109)
| at org.jbpm.api.Configuration.getProcessEngine(Configuration.java:161)
| at prova.Main.<clinit>(Main.java:17)
| Caused by: org.jbpm.api.JbpmException
| at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:171)
| ... 7 more
| Caused by: java.lang.NullPointerException
| at org.jbpm.pvm.internal.util.XmlUtil.attribute(XmlUtil.java:289)
| at org.jbpm.pvm.internal.env.JbpmConfigurationParser.parseDocument(JbpmConfigurationParser.java:68)
| at org.jbpm.pvm.internal.xml.Parser.execute(Parser.java:396)
| at org.jbpm.pvm.internal.xml.Parse.execute(Parse.java:158)
| ... 5 more
| Exception in thread "main"
What could be the problem? Those are the two files of my project:
Main.java
import org.jbpm.api.Configuration;
| import org.jbpm.api.ExecutionService;
| import org.jbpm.api.ProcessDefinition;
| import org.jbpm.api.ProcessEngine;
| import org.jbpm.api.ProcessInstance;
| import org.jbpm.api.RepositoryService;
|
| public class Main{
| private static ProcessEngine processEngine;
|
| private static RepositoryService repositoryService;
| private static ExecutionService executionService;
|
| static {
| processEngine = Configuration.getProcessEngine();
|
| repositoryService = processEngine.get(RepositoryService.class);
| executionService = processEngine.getExecutionService();
| }
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| //create new deployment object and ask it to deploy your flow
| String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("sampleprocess.jpdl.xml").deploy();
|
| //now we query the process definition
| ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).uniqueResult();
|
| //start the process instance with the Id of the process definition
| ProcessInstance processInstance = executionService.startProcessInstanceById(processDefinition.getId());
| }
| }
|
and sampleprocess.jpdl
<?xml version="1.0" encoding="UTF-8"?>
|
| <process name="sampleprocess" xmlns="http://jbpm.org/4.0/jpdl">
| <start name="start1" g="238,73,48,48">
| <transition name="to end1" to="end1" g="-45,-20"/>
| </start>
| <end name="end1" g="267,271,48,48"/>
| </process>
Regarding to files that I described in my precedent post, I copied them directly from the PVM documentation, (Page 5 - 6 chapter 2). Could you send me the link to the correct PVM documentation?
Thanks!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269137#4269137
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269137
16 years, 4 months
[JBoss Messaging Users] - Re: Destination COnfiguration issue with Jboss 5 and Messagi
by amira88
"PeterJ" wrote : Yashendra, it would help if you told us exactly what you did.
|
| Also, see if this helps: http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4224936#4224936
|
| The instructions that abdujaparov and I posted are for switching DefaultDS to use a MySQL database, but setting up JMS is a subset of that. The only additional step you need to take, if you are not replacing DefaultDS, is to change all references to DefaultDS in the mysql-persistence-service.xml file to the JNDI name you used in mysql-ds.xml.
Hi Mr Peter,
i'm developping an ejb3 application and i was having errors in the starting of the project but i fortunly fix it :
But when i run the client class i get this errors:
| 08:08:44,525 DEBUG TimedSocketFactory:87 - createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
| javax.naming.NameNotFoundException: HotelTestBean not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
| at sun.rmi.transport.Transport$1.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
| at java.lang.Thread.run(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
| at sun.rmi.server.UnicastRef.invoke(Unknown Source)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at de.laliluna.library.ClientA.main(ClientA.java:32)
| Exception in thread "main" java.lang.RuntimeException: javax.naming.NameNotFoundException: HotelTestBean not bound
| at de.laliluna.library.ClientA.main(ClientA.java:38)
| Caused by: javax.naming.NameNotFoundException: HotelTestBean not bound
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
| at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
| at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
| at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
| at sun.rmi.transport.Transport$1.run(Unknown Source)
| at java.security.AccessController.doPrivileged(Native Method)
| at sun.rmi.transport.Transport.serviceCall(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
| at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
| at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
| at java.lang.Thread.run(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
| at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
| at sun.rmi.server.UnicastRef.invoke(Unknown Source)
| at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
| at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
| at javax.naming.InitialContext.lookup(Unknown Source)
| at de.laliluna.library.ClientA.main(ClientA.java:32)
|
I don't know the cause i put all my classes in this forum link:
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269135#4269135
Thank you for help!!! it's very urgent i have to complete for this Monday
Regards
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269136#4269136
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269136
16 years, 4 months
[Installation, Configuration & Deployment] - Re: Error installing to Start: name=persistence.unit:unitNa
by amira88
Hi Mr knauf:
I fixed all the server starting problem but when i run the ClientA i get this error and i can't understand it:
[CODE]
08:08:44,525 DEBUG TimedSocketFactory:87 - createSocket, hostAddr: localhost/127.0.0.1, port: 1099, localAddr: null, localPort: 0, timeout: 0
javax.naming.NameNotFoundException: HotelTestBean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(Unknown Source)
at de.laliluna.library.ClientA.main(ClientA.java:32)
Exception in thread "main" java.lang.RuntimeException: javax.naming.NameNotFoundException: HotelTestBean not bound
at de.laliluna.library.ClientA.main(ClientA.java:38)
Caused by: javax.naming.NameNotFoundException: HotelTestBean not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:722)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
at javax.naming.InitialContext.lookup(Unknown Source)
at de.laliluna.library.ClientA.main(ClientA.java:32)
[/CODE]
What i have to do!!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269135#4269135
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269135
16 years, 4 months
[Installation, Configuration & Deployment] - Re: Error installing to Start: name=persistence.unit:unitNa
by amira88
I have this warn too:
1)
06:09:25,956 WARN [Ejb3AnnotationHandler] JBMETA-4: did not find any bean meta data for annotation bean HotelTestBean, will create some
2)
06:09:27,485 WARN [WebServiceDeployerEJB] Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData@8fd19516{HotelTestBean}
3)
06:09:25,518 WARN [ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
06:09:25,518 WARN [ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
4)
06:09:17,104 WARN [JBossASSecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
5)
06:09:17,131 WARN [AnnotationCreator] No ClassLoader provided, using TCCL: org.jboss.managed.api.annotation.ManagementComponent
Helllllp pleaaaaaessssssssseeeeee!!!!!!!!!!!!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269128#4269128
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269128
16 years, 4 months
[jBPM Users] - Re: Problem moving from 4.1 to 4.2 using Spring configuratio
by saraswati.santanu
Thanks for sharing the solution Suganda.
You have rightly pointed out that its always good to allow Spring to manage transaction when you use Spring-Hibernate combination. In fact you will not have an option other than this if you are using JMS or any non-db transactional service.
I, however, would disagree with you on the spring interceptor current= true option. This is normally OK to have not transaction in a thread to start with. Then somebody (for this case Spring) needs to start the transaction. Ans everybody else should use the existing transaction. If, say from web tier (from a servlet) first call goes to some Jbpm command service call then I would expect that to start the transaction and not to crib about not having a transaction. In such a case current=false makes more sense.
But again, with spring you can use OncePerRequestFilter kind of thing to get your transaction started. Such a case you have the option to use current=true.
I am sure everything remains same for JTA transaction, so there should be no more pain for you in this.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269126#4269126
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269126
16 years, 4 months
[jBPM Users] - Re: [jbpm 4.2] My first simple application doesn't work :(
by saraswati.santanu
Silver,
the code you have written is wrong. It will not work that way. You need to create a Jpdl file first. You can use the Eclipse GPD for that. And then use the Jbpm API to create ProcessDefinition etc. There is no class called ProcessFactory in Jbpm4.
Second point that you need to understand is that a ProcessDefinition can not be started, it is the ProecessInstance which should be started.
Now assuming you have created a flow jpdl xml file, then your main class should look like this:
| private static ProcessEngine processEngine;
|
| private static RepositoryService repositoryService;
| private static ExecutionService executionService;
|
| static {
| processEngine = Configuration.getProcessEngine();
|
| repositoryService = processEngine.get(RepositoryService.class);
| executionService = processEngine.getExecutionService();
| }
|
| /**
| * @param args
| */
| public static void main(String[] args) {
| //create new deployment object and ask it to deploy your flow
| String deploymentId = repositoryService.createDeployment().addResourceFromClasspath("sampleprocess.jpdl.xml").deploy();
|
| //now we query the process definition
| ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).uniqueResult();
|
| //start the process instance with the Id of the process definition
| ProcessInstance processInstance = executionService.startProcessInstanceById(processDefinition.getId());
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269124#4269124
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269124
16 years, 4 months
[Installation, Configuration & Deployment] - Re: Error installing to Start: name=persistence.unit:unitNa
by amira88
"Wolfgang Knauf" wrote : hi,
|
| see http://www.jboss.org/community/wiki/EJB3relationships and search for your error message "cannot simultaneously fetch multiple bags".
|
| Hope this helps
|
| wolflfgang
Hi Mr Knauf,
I still have this error when i start the server:
| 04:26:00,264 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| DEPLOYMENTS MISSING DEPENDENCIES:
| Deployment "jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3" is missing the following dependencies:
| Dependency "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#BaseHotele' **")
| Deployment "persistence.unit:unitName=#BaseHotele" is missing the following dependencies:
| Dependency "jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding' **")
|
| DEPLOYMENTS IN ERROR:
| Deployment "<UNKNOWN jboss.j2ee:jar=BaseHotele.jar,name=HotelTestBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#BaseHotele' **
| Deployment "jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=ejb3ProjectDS,service=DataSourceBinding' **
|
| 04:26:00,280 INFO [Http11Protocol] D�marrage de Coyote HTTP/1.1 sur http-127.0.0.1-8080
| 04:26:00,410 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
| 04:26:00,418 INFO [ServerImpl] JBoss (Microcontainer) [5.0.1.GA (build: SVNTag=JBoss_5_0_1_GA date=200902231221)] Started in 43s:888ms
|
i have only this error only this error .
My project name=BaseHotele
My persistence.xml i put it in the META-INF folder and it is:
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| <persistence-unit name="BaseHotele">
| <jta-data-source>java:ejb3ProjectDS</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
|
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
|
|
My hsqlbd-ds.xml ,i put it in my ejb project "BaseHotele"and i Copy it to the jboss/server/default folder
and it contain this :
| <datasources>
| <local-tx-datasource>
|
| <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
| <!-- Datasources are not available outside the virtual machine -->
| <jndi-name>ejb3ProjectDS</jndi-name>
|
| <!-- For server mode db, allowing other processes to use hsqldb over tcp.
| This requires the org.jboss.jdbc.HypersonicDatabase mbean.
| <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
| -->
| <!-- For totally in-memory db, not saved when jboss stops.
| The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
| <connection-url>jdbc:hsqldb:.</connection-url>
| -->
| <!-- For in-process persistent db, saved when jboss stops.
| The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
| -->
| <!-- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url-->
|
| <connection-url>jdbc:hsqldb:data/tutorial</connection-url>
|
|
| <!-- The driver class -->
| <driver-class>org.hsqldb.jdbcDriver</driver-class>
|
| <!-- The login and password -->
| <user-name>sa</user-name>
| <password></password>
|
| <!--example of how to specify class that determines if exception means connection should be destroyed-->
| <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
|
| <!-- this will be run before a managed connection is removed from the pool for use by a client-->
| <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
|
| <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
| <min-pool-size>5</min-pool-size>
|
| <!-- The maximum connections in a pool/sub-pool -->
| <max-pool-size>20</max-pool-size>
|
| <!-- The time before an unused connection is destroyed -->
| <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
| <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
| <idle-timeout-minutes>0</idle-timeout-minutes>
|
| <!-- sql to call when connection is created
| <new-connection-sql>some arbitrary sql</new-connection-sql>
| -->
|
| <!-- sql to call on an existing pooled connection when it is obtained from pool
| <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
| -->
|
| <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
| <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
| -->
|
| <!-- Whether to check all statements are closed when the connection is returned to the pool,
| this is a debugging feature that should be turned off in production -->
| <track-statements/>
|
| <!-- Use the getConnection(user, pw) for logins
| <application-managed-security/>
| -->
|
| <!-- Use the security domain defined in conf/login-config.xml -->
| <security-domain>HsqlDbRealm</security-domain>
|
| <!-- Use the security domain defined in conf/login-config.xml or the
| getConnection(user, pw) for logins. The security domain takes precedence.
| <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
| -->
|
| <!-- HSQL DB benefits from prepared statement caching -->
| <prepared-statement-cache-size>32</prepared-statement-cache-size>
|
| <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
| <metadata>
| <type-mapping>Hypersonic SQL</type-mapping>
| </metadata>
|
| <!-- When using in-process (standalone) mode -->
| <depends>jboss:service=Hypersonic,database=localDB</depends>
| <!-- Uncomment when using hsqldb in server mode
| <depends>jboss:service=Hypersonic</depends>
| -->
| </local-tx-datasource>
|
| <!-- Uncomment if you want hsqldb accessed over tcp (server mode)
| <mbean code="org.jboss.jdbc.HypersonicDatabase"
| name="jboss:service=Hypersonic">
| <attribute name="Port">1701</attribute>
| <attribute name="BindAddress">${jboss.bind.address}</attribute>
| <attribute name="Silent">true</attribute>
| <attribute name="Database">default</attribute>
| <attribute name="Trace">false</attribute>
| <attribute name="No_system_exit">true</attribute>
| </mbean>
| -->
|
| <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
| <mbean code="org.jboss.jdbc.HypersonicDatabase"
| name="jboss:service=Hypersonic,database=localDB">
| <attribute name="Database">localDB</attribute>
| <attribute name="InProcessMode">true</attribute>
| </mbean>
|
| </datasources>
|
|
|
|
This My HotelTestBean:
|
| package de.laliluna.library;
|
| import javax.ejb.Stateless;
| import java.util.Iterator;
| import java.util.List;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| @Stateless
| public class HotelTestBean implements HotelTestBeanRemote ,HotelTestBeanLocal
| { @PersistenceContext
| EntityManager em;
| public static final String RemoteJNDIName = HotelTestBean.class.getSimpleName() + "/remote";
| public static final String LocalJNDIName = HotelTestBean.class.getSimpleName() + "/local";
|
| public void test() {
|
|
| Hotel hotel1 = new Hotel("pyramide",25,30);
| em.persist(hotel1);
| Hotel hotel2 = new Hotel("paradis",50,23);
| em.persist(hotel2);
| Hotel hotel3 = new Hotel("intercontinentale",78,19 );
| em.persist(hotel3);
| System.out.println("list some Hotels");
| List someHotels = em.createQuery("from Hotel b where b.nomHotel=:name").setParameter("name", "paradis").getResultList();
| for (Iterator iter = someHotels.iterator(); iter.hasNext();)
| {Hotel element = (Hotel) iter.next();
| System.out.println(element);}
| System.out.println("List all Hotels");
| List allHotels = em.createQuery("from Hotel").getResultList();
| for (Iterator iter = allHotels.iterator(); iter.hasNext();)
| {Hotel element = (Hotel) iter.next();
| System.out.println(element);}
| System.out.println("delete a Hotel");
| em.remove(hotel2);
| System.out.println("List all Hotels");
| allHotels = em.createQuery("from Hotel").getResultList();
| for (Iterator iter = allHotels.iterator(); iter.hasNext();)
| {Hotel element = (Hotel) iter.next();
| System.out.println(element); } }}
|
Ihis my HotelTestBeanLocal:
| package de.laliluna.library;
| import javax.ejb.Local;
| @Local
| public interface HotelTestBeanLocal { public void test();}
|
This is my HotelTestBeanRemote:
| package de.laliluna.library;
|
| import javax.ejb.Remote;
| @Remote
| public interface HotelTestBeanRemote {
| public void test();
| }
|
|
and this is my ClientA:
| package ClientBeans;
| import java.util.Iterator;
| import java.util.List;
| import java.util.Properties;
| import javax.naming.Context;
| import javax.naming.InitialContext;
| import javax.naming.NamingException;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import de.laliluna.library.Hotel;
| import de.laliluna.library.HotelTestBean;
| import de.laliluna.library.HotelTestBeanRemote;
|
|
| public class ClientA {
|
| /**
| * @param args
| */
|
| public static void main(String[] args) {
|
| try
| {
|
| Properties props = new Properties();
| props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
| props.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
| props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
| // props.setProperty("j2ee.clientName", "ClientNameFromJBossClientXML");
|
| InitialContext initialContext = new InitialContext(props);
|
| HotelTestBeanRemote beanRemote = (HotelTestBeanRemote) initialContext.lookup("HotelTestBean.RemoteJNDIName");
|
| beanRemote.test();
|
|
|
| } catch (NamingException e)
| {
| e.printStackTrace();
|
| throw new RuntimeException(e);
| }
|
| }
|
|
This is jindi.xml
| java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
| java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
| java.naming.provider.url=localhost:1099
|
Is this enough or i have something wrong, or i must add another xml files !!!!
Thank you a lot you gone save my life
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269123#4269123
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269123
16 years, 4 months