[jBPM] - Unit Testing/Checking Variables
by Timothy Charman
Timothy Charman [https://community.jboss.org/people/tcharman] created the discussion
"Unit Testing/Checking Variables"
To view the discussion, visit: https://community.jboss.org/message/731239#731239
--------------------------------------------------------------
Hello All
Sorry to ask this, but I've looked around and haven't seen how to do this.
I have a simple unit test using JbpmJUnitTestCase. I want to validate my custom work handlers, so I have created a BPMN2 workflow with a work handler in it. The work handler takes in some parameters and has results that are mapped to a variable. I know that it is generally working correctly as I can put a script task after the custom task to output the variables to the console. My unit test creates a parameter map and launches the flow:
|
|
| ProcessInstance processInstance = knowledgeSession.createProcessInstance("testprocess", parameterMap); |
|
|
| knowledgeSession.startProcessInstance(processInstance.getId()); |
I know I can do this in one step using the startProcess method. This method above works, as does the startProcess method.
I am also able to successfully assert, e.g.:
assertProcessInstanceCompleted
assertNodeTriggered
However by this time the processInstance is completed (per the assertation). So the variable context has been destroyed and I cannot use standard JUnit asserts to validate the output, retreived using getVariableValue.
So does anyone have an idea how I am meant to get variables from the context after the flow is complete? Or am I meant to watch the variables while the flow is happening, maybe through an event listener?
Thanks for any help.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731239#731239]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months
[JBoss Messaging] - EJBException: Failed to acquire the pool semaphore
by Samuel Tannous
Samuel Tannous [https://community.jboss.org/people/stannous] created the discussion
"EJBException: Failed to acquire the pool semaphore"
To view the discussion, visit: https://community.jboss.org/message/731246#731246
--------------------------------------------------------------
Hi Guys,
I see that this problem's come up a few times in the past but our scenario is different so I'll raise it again. We're using ActiveMQ in JBoss 6 and are seeing intermittent errors dispatching messages which causes them to be lost (the JMX consolde shows that they've been dequeued but the listener never gets them).
There's a good explanation of the "Failed to acquire the pool semaphore" error here: http://stackoverflow.com/questions/7015583/ejbexception-failed-to-acquire... http://stackoverflow.com/questions/7015583/ejbexception-failed-to-acquire...
And it sounds simple enough except we're not using prefetch... so my question is, how can this error occur when messages are being polled instead of batched?
Our embedded broker url is:
vm://myBroker?create=false&*jms.prefetchPolicy.all=0*&jms.alwaysSyncSend=true
The ejb3-interceptors-aop.xml MDB config is default (@org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=15, timeout=10000))
The message listener is annotated with:
@MessageDriven(name = "MyListener", messageListenerInterface = javax.jms.MessageListener.class, activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "20"),
@ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/com.myorg.MyQueue") })
The stack's attached:
Any help will be greatly appreciated.
Cheers
Sam
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731246#731246]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months
[Beginner's Corner] - Exception: CallbackHandler does not support
by fre3man
fre3man [https://community.jboss.org/people/fre3man] created the discussion
"Exception: CallbackHandler does not support"
To view the discussion, visit: https://community.jboss.org/message/731555#731555
--------------------------------------------------------------
Hi all,
I am very very very new to JBoss. Or in fact to j2ee as well. I really could use all the help i can get in here.
Right now, i am facing [CallbackHandler does not support] Exception, which it will keep prompting me the error whenever i click on a file, in the Web Management System.
Following is the log file i have during the run: (attached more detailed log)
2012-04-23 12:02:39,699 ERROR [com.openkm.module.direct.DirectPropertyGroupModule] CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c: CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c
javax.jcr.LoginException: CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c: CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c: CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c
at org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1407)
at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:41)
at com.openkm.jcr.JCRUtils$1.run(JCRUtils.java:390)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Unknown Source)
at com.openkm.jcr.JCRUtils.getSession(JCRUtils.java:385)
at com.openkm.module.direct.DirectPropertyGroupModule.getGroups(DirectPropertyGroupModule.java:176)
at com.openkm.api.OKMPropertyGroup.getGroups(OKMPropertyGroup.java:82)
at com.openkm.servlet.frontend.PropertyGroupServlet.getGroups(PropertyGroupServlet.java:180)
at com.openkm.servlet.frontend.PropertyGroupServlet.getAllGroups(PropertyGroupServlet.java:97)
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 com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:207)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
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:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.security.auth.login.LoginException: CallbackHandler does not support: javax.security.auth.callback.NameCallback@9c9a8c
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.getUsernameAndPassword(UsernamePasswordLoginModule.java:299)
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:181)
at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.access$000(Unknown Source)
at javax.security.auth.login.LoginContext$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
at javax.security.auth.login.LoginContext.login(Unknown Source)
at org.apache.jackrabbit.core.security.authentication.JAASAuthContext.login(JAASAuthContext.java:60)
at org.apache.jackrabbit.core.RepositoryImpl.login(RepositoryImpl.java:1392)
... 38 more
Caused by: javax.security.auth.callback.UnsupportedCallbackException
at org.apache.jackrabbit.core.security.authentication.CallbackHandlerImpl.handle(CallbackHandlerImpl.java:119)
at javax.security.auth.login.LoginContext$SecureCallbackHandler$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext$SecureCallbackHandler.handle(Unknown Source)
at org.jboss.security.auth.spi.UsernamePasswordLoginModule.getUsernameAndPassword(UsernamePasswordLoginModule.java:280)
... 50 more
https://community.jboss.org/servlet/JiveServlet/showImage/2-731555-18440/... https://community.jboss.org/servlet/JiveServlet/downloadImage/2-731555-18...
Basically, I was able to logon to the web management system, but when i intends to click on any file that was available, it would return me this error.
How am i able to resolve this? is this due to some sort of JAAS which session token is lost that resulting to this?
Please advise.
Thanks in advance!!! :(
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731555#731555]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months
[EJB3] - javax.naming.NoInitialContextException...
by Joseph Hwang
Joseph Hwang [https://community.jboss.org/people/aupres] created the discussion
"javax.naming.NoInitialContextException..."
To view the discussion, visit: https://community.jboss.org/message/731547#731547
--------------------------------------------------------------
I use ejb3.1 on JBoss 7.0.2. I develop bean with @Schedule annotation. The codes are :
==== IScheduleTestPort.java
package com.aaa.ejb3;
import javax.ejb.Remote;
@Remote
public interface IScheduleTestPort {
public String getSignal();
}
===== ScheduleBean.java
package com.aaa.ejb3;
import java.util.Date;
import javax.annotation.PostConstruct;
import javax.ejb.Schedules;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
@Stateless
public class ScheduleBean implements IScheduleTestPort {
private String str;
@PostConstruct
public void doPostConstruct() {
str = "Time is : ";
}
@Schedules({
@Schedule(dayOfMonth = "5", hour = "09-18", minute = "*", second="10/5", timezone = "America/Los_Angeles"),
@Schedule(dayOfMonth = "Mon", hour = "10-17", minute = "*", second="*/5" , timezone = "Asia/Seoul") })
@Override
public String getSignal() {
// TODO Auto-generated method stub
return str + new Date();
}
}
===== ScheduleBeanClient.java
package com.aaa.ejb3;
import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.Context;
public class ScheduleBeanClient {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Properties props = new Properties();
props.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.put("java.naming.provider.url", "jnp://localhost:1099");
Context ctx = new InitialContext(props);
ScheduleBean schedule = (ScheduleBean)ctx.lookup("java:module/ScheduleBean");
while (true) {
System.out.println(schedule.getSignal());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
But client throws exception like below :
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at com.aaa.ejb3.ScheduleBeanClient.main(ScheduleBeanClient.java:47)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
So i remove the parameter of InitialContext,
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Context ctx = new InitialContext(props);
ScheduleBean schedule = (ScheduleBean)ctx.lookup("java:module/ScheduleBean");
while (true) {
System.out.println(schedule.getSignal());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
...
This the codes throws the following exception ,
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.aaa.ejb3.ScheduleBeanClient.main(ScheduleBeanClient.java:49)
I have no idea of what is wrong with my codes. I need your help!
Thanks in advanced.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731547#731547]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months
[Datasource Configuration] - Urgent problem: jboss as 5.1 offten happened time out exception
by jiang hongyu
jiang hongyu [https://community.jboss.org/people/aquila_bj] created the discussion
"Urgent problem: jboss as 5.1 offten happened time out exception"
To view the discussion, visit: https://community.jboss.org/message/731223#731223
--------------------------------------------------------------
helllo every one, I have some urgent problem about JBOSS db pool with mysql database(5.1.41). I offen found my sql exception from jboss as server. Does anybody find the same error problem before, how to fix this problem.
Can anybody help to find what's root cause about this?
2012-04-20 11:29:17,189 WARN [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Unable to fill pool
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 6,128 milliseconds ago. The last packet sent successfully to the server was 6,127 milliseconds ago.)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:465)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:409)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.fillToMin(InternalManagedConnectionPool.java:541)
at org.jboss.resource.connectionmanager.PoolFiller.run(PoolFiller.java:74)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 6,128 milliseconds ago. The last packet sent successfully to the server was 6,127 milliseconds ago.
at sun.reflect.GeneratedConstructorAccessor219.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3591)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3480)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4021)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:951)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4602)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1328)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2389)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2422)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2207)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:797)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor125.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:440)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:138)
at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource.java:108)
at com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.getXAConnection(MysqlXADataSource.java:48)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:449)
... 5 more
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3041)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3491)
... 26 more
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731223#731223]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months
[Beginner's Corner] - RestEasy - UnsupportedClassVersionError
by Steve Jagels
Steve Jagels [https://community.jboss.org/people/sej] created the discussion
"RestEasy - UnsupportedClassVersionError"
To view the discussion, visit: https://community.jboss.org/message/731400#731400
--------------------------------------------------------------
I am trying to set up an example RestEasy application. In web.xml I have restEasy scan turned off and am using the javax.ws.rs.Application:
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.mbh.esln.restdemo.action.HelloWorldApplication</param-value>
</init-param>
</servlet>
Then I have the class to deal with the singletons:
package com.mbh.esln.restdemo.action;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.core.Application;
import com.mbh.esln.restdemo.action.CustomersResource;
public class HelloWorldApplication extends Application{
private Set<Object> singletons = new HashSet();
private Set<Class<?>> empty = new HashSet();
public HelloWorldApplication() {
// ADD YOUR RESTFUL RESOURCES HERE
this.singletons.add(new CustomersResource());
this.singletons.add(new Customer());
this.singletons.add(new GeoNames());
// this.singletons.add(new GeoNamesService());
this.singletons.add(new GeoCode());
this.singletons.add(new RESTFulWSClientNoParam());
}
public Set<Class<?>> getClasses(){
return this.empty;
}
public Set<Object> getSingletons(){
return this.singletons;
}
}
But I still get this error when starting up jboss:
10:59:03,771 INFO [TomcatDeployer] deploy, ctxPath=/testRestEasyWS, warUrl=.../deploy/testRestEasyWS.war/
10:59:04,099 ERROR [MainDeployer] Could not create deployment: file:/C:/Java/jboss-4.3.0.GA_CP03/jboss-as/server/default/deploy/testrestdemo.war/
java.lang.UnsupportedClassVersionError: Bad version number in .class file
I am using:
jboss: 4.3.0.GA_CP03
jdk: 1.5.0_17
eclipse: 3.4
Any idea how to prevent this startup error?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/731400#731400]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 11 months