[jBPM Development] - Service Task with no interfaces
by Marco Piraccini
Marco Piraccini [http://community.jboss.org/people/mpiraccini] created the discussion
"Service Task with no interfaces"
To view the discussion, visit: http://community.jboss.org/message/629594#629594
--------------------------------------------------------------
Hi guys,
With JBPM 5.1, if I define a Service Task with no interfaces (it's legal in BPMN2) -for instance using the new BPMN2 eclipse editor- this is not accepted.
Indeed, when I load the resource in the knowledge base, I see:
java.lang.IllegalArgumentException: No interfaces found
at org.jbpm.bpmn2.xml.ServiceTaskHandler.handleNode(ServiceTaskHandler.java:51)
at org.jbpm.bpmn2.xml.TaskHandler.end(TaskHandler.java:188)
at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:414)
That behaviour it's very simple to reproduce (and the ServiceTaskHandler code is very clear) so I suppose that it's not a bug.
Anyway, in my opinion this is not correct. In JBPM/Drools, I can set which WorkItemHandler I want to use for each Task "type".
So if I want to have serviceTasks that are based on other informations (and not the interface) I cannot do that using a Service Task.
Ok, I know that I can do that with the "generic" task, but I'd like to use a Service Task (It's the correct task from the modeling point-of-view).
Why this behaviour has been implemented?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/629594#629594]
Start a new discussion in jBPM Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 6 months
[JBoss AS7 Development] - javax.persistence.TransactionRequiredException
by Marcus Schmidke
Marcus Schmidke [http://community.jboss.org/people/MSchmidke] created the discussion
"javax.persistence.TransactionRequiredException"
To view the discussion, visit: http://community.jboss.org/message/631054#631054
--------------------------------------------------------------
Hello all,
after years of developing with Seam 2.x, I now try to jump start into a new world (AS7, builtin CDI etc.), but until now, I am not very succesful.
I've written a very simple sample application, a few entities and one servlet. After lots of work, everything deploys fine, Hibernate generates tables, well.
Then I call the servlet from Webbrowser. The servlet does nothing else than injecting and calling a SLSB, which itself tries to create and persist an entity.
With Seam 2.x, I never worried about transactions - everything was fully automatic. In fact, I have absolutely no knowledge about EJB3 CMT, because Seam did everything for me.
But now the only thing I get this this weird TransactionRequiredException. Google does not know anything about it (sureley because it is an absolute beginner's error).
My servlet:
@WebServlet(urlPatterns = "/*")
public class VaadinAppServlet extends HttpServlet {
@Inject
Beispieldaten bd;
@Override
protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
throws ServletException, IOException {
bd.run();
super.service(arg0, arg1);
}
}
The SLSB:
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class BeispieldatenImpl implements Beispieldaten {
@PersistenceContext
private EntityManager session;
public void run() {
TestEntity te=new TestEntity();
session.persist(te);
}
}
(as you can see, I added lots of useless annotations just to avoid any possible mistake)
And the interface:
@Local
public interface Beispieldaten {
void run();
}
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="KochbuchServer"
transaction-type="JTA">
<jta-data-source>java:jboss/datasources/KochbuchDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.default_batch_fetch_size" value="100" />
<property name="hibernate.hbm2ddl.auto" value="create" />
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/EntityManagerFactories/KochbuchServer" />
</properties>
</persistence-unit>
</persistence>
All packaged in an EAR - servlet in WAR, other classes in EJB-module.
I'm sure my mistake is quite obvious, but I need help ...
Thank you!
Marcus.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/631054#631054]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 6 months
[EJB3 Development] - Mini (Stateful) EJB 3 Example using JBoss and Eclipse
by Phi GF
Phi GF [http://community.jboss.org/people/phiboss] created the discussion
"Mini (Stateful) EJB 3 Example using JBoss and Eclipse"
To view the discussion, visit: http://community.jboss.org/message/630901#630901
--------------------------------------------------------------
Hello Community
(appologise I am new to JBoss 3.0)
I am looking for a simple EJB 3.0 Example using a Stateful Bean to demonstrate the components and concepts of an application server. I have searched several forums and googled a lot, but I have found mostly solutions to Problems I did not encounter. (I have an EJB 2 Example, which is not applicable, because my trainees will work on EJB 3.0 or 3.1 later.)
Here my configuration:
*JBoss Application Server 7.0.1 final*
*OS: Linux Ubuntu 64 Bit (10.10)*
*Eclipse 64 Bit J2EE (indigo)*
*Java 1.6.0_26*
I have 2 Projects in my Eclipse Workbench (a Server + a Client). The Server contains 2 classes:
MyTimerRemote.java:
package ch.my.timer.server;
import javax.ejb.Remote;
@Remote
public interface MyTimerRemote {
void setRemainingSecs(int seconds);
float getRemainingSecs();
}
and MyTimer.java (also on the server):
package ch.my.timer.server;
import javax.ejb.Stateful;
/**
* Session Bean implementation class MyTimer
*/
@Stateful
public class MyTimer implements MyTimerRemote {
public MyTimer() {
this.endTimePoint = System.currentTimeMillis();
}
private long endTimePoint; // timestamp in milliseconds
@Override
public void setRemainingSecs(int seconds) {
long millis = seconds * 1000;
long now = System.currentTimeMillis();
this.endTimePoint = now + millis;
}
@Override
public float getRemainingSecs() {
long now = System.currentTimeMillis();
long diff = this.endTimePoint - now;
float secs = (float) (diff / 1000.0);
return secs;
}
}
The Client Project contains a simple Test class (MyTimerTest.java):
package ch.my.timer.client;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import ch.my.timer.server.*;
public class MyTimerTest {
public static void main(String[] args) {
try {
new MyTimerTest().top();
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
void top() throws NamingException {
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
InitialContext ctx = new InitialContext(env);
MyTimerRemote str = (MyTimerRemote) ctx.lookup("java:module/SantisTimer");
str.setRemainingSecs(3);
float rem = str.getRemainingSecs();
System.out.println("Remaining: " + rem);
}
}
Starting the server (using "run on server -> JBoss 7.0 Runtime Server, i get the following output:
15:05:06,995 INFO [org.jboss.modules] JBoss Modules version 1.0.1.GA
15:05:07,394 INFO [org.jboss.msc] JBoss MSC version 1.0.0.GA
...
15:05:11,026 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "EJB_Servenull"
15:05:11,146 INFO [org.jboss.as.jpa] (MSC service thread 1-1) added javax.persistence.api dependency to EJB_Servenull
15:05:11,237 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named MyTimer in deployment unit deployment "EJB_Servenull" are as follows:
java:global/EJB_Servenull/MyTimer!ch.my.timer.server.MyTimerRemote
java:app/EJB_Servenull/MyTimer!ch.my.timer.server.MyTimerRemote
java:module/MyTimer!ch.my.timer.server.MyTimerRemote
java:global/EJB_Servenull/MyTimer
java:app/EJB_Servenull/MyTimer
java:module/MyTimer
15:05:11,434 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "EJB_Servenull"
Starting the client (run as Java Application) I get:
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1382)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ch.my.timer.client.MyTimerTest.top(MyTimerTest.java:28)
at ch.my.timer.client.MyTimerTest.main(MyTimerTest.java:14)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:145)
at java.net.DatagramSocket.receive(DatagramSocket.java:725)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1272)
... 6 more
Any Ideas? What am I missing?
Thanks in advance.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/630901#630901]
Start a new discussion in EJB3 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 6 months
[JBoss AS7 Development] - Re: JMX-based monitoring the jbossAS7 database connection pool
by duan xz
duan xz [http://community.jboss.org/people/duanxz] created the discussion
"Re: JMX-based monitoring the jbossAS7 database connection pool"
To view the discussion, visit: http://community.jboss.org/message/630851#630851
--------------------------------------------------------------
Hi Braun,
Thanks for Response.
but two things is not really clear to me.
1、In order to retrieve the datasource information,
To parse the standalone.xml located in jboss-as-web-7.0.2.Final\standalone\configuration file system to get data source information?
in standalone.xml Contains the following information:
================================================================================================
<datasource jndi-name="abc" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
</connection-url>
<driver>
h2
</driver>
<pool>
<prefill>
false
</prefill>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
sa
</user-name>
<password>
sa
</password>
</security>
</datasource>
================================================================================================
2、use “Detyped Description of the AS 7 Management Model" to retrieve the datasource information.
like this:
==================================
ModelNode op = new ModelNode();
op.get("operation").set("read-resource-description");
op.get("recursive").set(true);
op.get("operations").set(true);
ModelNode address = op.get("address");
address.add("subsystem", "web");
address.add("connector", "http");
==================================
if i want to get all like "<datasource jndi-name =" abc "pool-name =..." node data source name, how to modify the code?
Could you please help me ?
Thanks a lot,
duanxz
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/630851#630851]
Start a new discussion in JBoss AS7 Development at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
12 years, 6 months