[Beginner's Corner] - Timers on stateful sessions. JBoss 6 M4
by Estanislao Musulin
Estanislao Musulin [http://community.jboss.org/people/elsote] created the discussion
"Timers on stateful sessions. JBoss 6 M4"
To view the discussion, visit: http://community.jboss.org/message/559624#559624
--------------------------------------------------------------
Hi!
I'm building a simple session to test timers on JBoss 6 M4,
//-----------------------------------------------
package org.jboss.ejb3.timerservice.example;
import java.util.Date;
import javax.annotation.Resource;
import javax.ejb.Stateful;
//import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.Timer;
import javax.ejb.TimerService;
import com.soteica.ots.scheduler.SchedulerRemote;
@Stateful(name = "Scheduler")
public class Scheduler implements SchedulerRemote
{
@Resource
private TimerService timerService;
@Override
public void scheduleTask()
{
Date now = new Date();
Timer timer = this.timerService.createTimer(now, 5000, "5SecondTimer");
}
@Timeout
private void onTimeout(Timer timer)
{
System.out.println("Timeout method invoked at " + new Date() + " for bean " + this.getClass().getSimpleName());
}
}
//-----------------------------------------------
It works properlly is defined as Stateles, but if defined as stateful the following errors appear:
16:30:53,546 ERROR [STDERR] java.lang.RuntimeException: Unable to inject jndi dependency: TimerService into property org.jboss.ejb3.timerservice.example.Scheduler.timerService: stateful bean doesn't s
upport TimerService (EJB3 18.2#2)
16:30:53,546 ERROR [STDERR] at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)
16:30:53,546 ERROR [STDERR] at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
16:30:53,546 ERROR [STDERR] at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)
16:30:53,546 ERROR [STDERR] at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:51)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:43)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.session.SessionInjectionInvocation.proceed(SessionInjectionInvocation.java:45)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:97)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:91)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82)
16:30:53,546 ERROR [STDERR] at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1220)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.create(StatefulContainer.java:148)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:402)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.createSession(StatefulContainer.java:408)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.session.SessionContainer.createSession(SessionContainer.java:692)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionProxyFactoryBase.getNewSessionId(StatefulSessionProxyFactoryBase.java:280)
16:30:53,546 ERROR [STDERR] at org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionProxyFactoryBase.createProxyBusiness(StatefulSessionProxyFactoryBase.java:143)
16:30:53,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:30:53,546 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:30:53,546 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:30:53,546 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
16:30:53,562 ERROR [STDERR] at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121)
16:30:53,562 ERROR [STDERR] at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
16:30:53,562 ERROR [STDERR] at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898)
16:30:53,562 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791)
16:30:53,562 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744)
16:30:53,562 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548)
16:30:53,562 ERROR [STDERR] at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234)
16:30:53,562 ERROR [STDERR] Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is java.
lang.UnsupportedOperationException: stateful bean doesn't support TimerService (EJB3 18.2#2)]]
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1356)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:819)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
16:30:53,562 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:30:53,562 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:30:53,562 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:30:53,562 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
16:30:53,562 ERROR [STDERR] at org.jboss.ejb3.EJBContainer$1.invoke(EJBContainer.java:853)
16:30:53,562 ERROR [STDERR] at $Proxy145.lookup(Unknown Source)
16:30:53,562 ERROR [STDERR] at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
16:30:53,562 ERROR [STDERR] at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
16:30:53,562 ERROR [STDERR] ... 30 more
16:30:53,562 ERROR [STDERR] Caused by: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.UnsupportedOperationException: stateful bean doesn't support TimerService
(EJB3 18.2#2)]
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
16:30:53,562 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1350)
16:30:53,562 ERROR [STDERR] ... 40 more
16:30:53,562 ERROR [STDERR] Caused by: java.lang.UnsupportedOperationException: stateful bean doesn't support TimerService (EJB3 18.2#2)
16:30:53,562 ERROR [STDERR] at org.jboss.ejb3.TimerServiceContainer.getTimerService(TimerServiceContainer.java:178)
16:30:53,562 ERROR [STDERR] at org.jboss.ejb3.timerservice.naming.TimerServiceObjectFactory.getObjectInstance(TimerServiceObjectFactory.java:65)
16:30:53,562 ERROR [STDERR] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483)
16:30:53,562 ERROR [STDERR] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500)
16:30:53,562 ERROR [STDERR] ... 44 more
16:30:53,562 ERROR [org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionProxyFactoryBase] Could not obtain new Session ID from SFSB Container: javax.ejb.EJBException: java.lang.RuntimeEx
ception: Unable to inject jndi dependency: TimerService into property org.jboss.ejb3.timerservice.example.Scheduler.timerService: stateful bean doesn't support TimerService (EJB3 18.2#2)
at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:423) [:1.5.0-alpha-4]
at org.jboss.ejb3.stateful.StatefulContainer.createSession(StatefulContainer.java:408) [:1.5.0-alpha-4]
at org.jboss.ejb3.session.SessionContainer.createSession(SessionContainer.java:692) [:1.5.0-alpha-4]
at org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionProxyFactoryBase.getNewSessionId(StatefulSessionProxyFactoryBase.java:280) [:1.0.10]
at org.jboss.ejb3.proxy.impl.factory.session.stateful.StatefulSessionProxyFactoryBase.createProxyBusiness(StatefulSessionProxyFactoryBase.java:143) [:1.0.10]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_18]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_18]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_18]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_18]
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:121) [jboss-aop.jar:2.2.1.Alpha3]
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) [:1.0.1.GA]
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:898) [:6.0.0.20100721-M4]
at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:791) [:6.0.0.20100721-M4]
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:744) [:6.0.0.20100721-M4]
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:548) [:6.0.0.20100721-M4]
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:234) [:6.0.0.20100721-M4]
Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: TimerService into property org.jboss.ejb3.timerservice.example.Scheduler.timerService: stateful bean doesn't support TimerServi
ce (EJB3 18.2#2)
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82) [:1.5.0-alpha-4]
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99) [:1.5.0-alpha-4]
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89) [:1.5.0-alpha-4]
at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61) [:1.5.0-alpha-4]
at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:51) [:1.5.0-alpha-4]
at org.jboss.ejb3.injection.InjectionHelper.inject(InjectionHelper.java:43) [:1.5.0-alpha-4]
at org.jboss.ejb3.session.SessionInjectionInvocation.proceed(SessionInjectionInvocation.java:45) [:1.5.0-alpha-4]
at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:97) [:1.5.0-alpha-4]
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:91) [:1.5.0-alpha-4]
at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.5.0-alpha-4]
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82) [:1.5.0-alpha-4]
at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1]
at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:82) [:1.5.0-alpha-4]
at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1220) [:1.5.0-alpha-4]
at org.jboss.ejb3.stateful.StatefulContainer.create(StatefulContainer.java:148) [:1.5.0-alpha-4]
at org.jboss.ejb3.cache.simple.SimpleStatefulCache.create(SimpleStatefulCache.java:402) [:1.5.0-alpha-4]
... 15 more
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is java.lang.UnsupportedOperationExc
eption: stateful bean doesn't support TimerService (EJB3 18.2#2)]]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1356) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:819) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_18]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_18]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_18]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_18]
at org.jboss.ejb3.EJBContainer$1.invoke(EJBContainer.java:853) [:1.5.0-alpha-4]
at $Proxy145.lookup(Unknown Source) at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44) [:1.5.0-alpha-4]
at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75) [:1.5.0-alpha-4]
... 30 more
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.UnsupportedOperationException: stateful bean doesn't support TimerService (EJB3 18.2#2)]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1508) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:824) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_18]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1350) [:5.0.5.Final]
... 40 more
Caused by: java.lang.UnsupportedOperationException: stateful bean doesn't support TimerService (EJB3 18.2#2)
at org.jboss.ejb3.TimerServiceContainer.getTimerService(TimerServiceContainer.java:178) [:1.5.0-alpha-4]
at org.jboss.ejb3.timerservice.naming.TimerServiceObjectFactory.getObjectInstance(TimerServiceObjectFactory.java:65) [:6.0.0.20100721-M4]
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) [:1.6.0_18]
at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1483) [:5.0.5.Final]
at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1500) [:5.0.5.Final]
... 44 more
Any help will be appreciated, Thanks!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559624#559624]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
[JBoss Web Services Metro] - Exception when signing request
by Jay L
Jay L [http://community.jboss.org/people/aklintu] created the discussion
"Exception when signing request"
To view the discussion, visit: http://community.jboss.org/message/559568#559568
--------------------------------------------------------------
Hi, folks.
I'm a forum and Metro newbie. I am trying to sign my client requests but seeing the exception:
*com.sun.xml.wss.XWSSecurityException: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'jboss-ws-security'.*
Does anyone know what might be causing this issue?
I was told that I needed to remove all the JBossWS JARs when using XWSS in Metro with JBoss. I tried this, and that did not work. What am I missing in getting this to work?
The client code contains --
InputStream securityStream = getClass().getResourceAsStream( configFile );
XWSSecurityConfiguration secCfg = SecurityConfigurationFactory.newXWSSecurityConfiguration( securityStream );
reqContext.put( XWSSecurityConfiguration.MESSAGE_SECURITY_CONFIGURATION, secCfg );
The client config file constains this --
<?xml version="1.0" encoding="UTF-8"?>
<xwss:JAXRPCSecurity xmlns:xwss=" http://java.sun.com/xml/ns/xwss/config http://java.sun.com/xml/ns/xwss/config">
<xwss:Service>
<xwss:SecurityConfiguration dumpMessages="true">
<xwss:Sign>
<xwss:X509Token certificateAlias="xws-security-client" />
</xwss:Sign>
</xwss:SecurityConfiguration>
</xwss:Service>
<xwss:SecurityEnvironmentHandler>
+<SecurityEnvironmentHandler class>+
</xwss:SecurityEnvironmentHandler>
</xwss:JAXRPCSecurity>
Any suggestions you can provide would be appreciated!
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559568#559568]
Start a new discussion in JBoss Web Services Metro at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months
Re: [jboss-user] [jBPM] - Custom BusinessCalendar
by Marco Baroetto
Marco Baroetto [http://community.jboss.org/people/H4rLoCk] replied to the discussion
"Custom BusinessCalendar"
To view the discussion, visit: http://community.jboss.org/message/559563#559563
--------------------------------------------------------------
I think the jBPM Develpers Guide is not correct in 2.1.2 Business Calendar:
For example:
public class CustomBusinessCalendar implements BusinessCalendar {
public Date add(Date date, String duration) {
if ("my next birthday".equals(duration)) {
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.set(Calendar.MONTH, Calendar.JULY);
gregorianCalendar.set(Calendar.DAY_OF_MONTH, 21);
return gregorianCalendar.getTime();
}
return null;
}
}
To configure the jBPM engine to use this custom business calendar, just add the following line to your jbpm.cfg.xml:
<process-engine-context>
<object class="org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendar"
/>
</process-engine-context>
Take a look at the
org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendarImplTest for more information.
1) org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendarImplTest doesn't exist
2) To add your EL expression in timers (at least for task's duedate) you have to:
- Write my.own.MyNextBirthday extends Date (or Calendar,GregorianCalendar...) and is equals to the date you want.
- Add to your cfg the following:
<object name="myNextBirthday" class="my.own.MyNextBirthday" />
3) Write your jpdl as follows:
<task name="TaskTransaction2_step1" duedate="#{myNextBirthday} +3 days" candidate-groups="user">
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/559563#559563]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 4 months