on 09-07-2012 10:27 AM
Hello there,
I want to start a timer during @AppStartup-method. This works fine, when netweaver runs with only one server process. When this applications runs at NetWeaver with 2 server processes, the following error occurs :
Caused by: com.sap.engine.lib.injection.InjectionException: Injection on field timerService of instance test25.TEST25StartupManagerBean@2feaab94 failed. Could not get a value to be injected from the factory.
at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:115)
at com.sap.engine.lib.injection.InjectionMatrix.inject(InjectionMatrix.java:45)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:23)
... 48 more
Caused by: com.sap.engine.services.jndi.persistent.exceptions720.NameNotFoundException: Path to object does not exist. First missing component is [test25.TEST25StartupManagerBean], the whole lookup name is [java:comp/env/test25.TEST25StartupManagerBean/timerService].
at
...
The code:
public class TEST25StartupManagerBean implements TEST25StartupManagerLocal,Serializable {
private static final long serialVersionUID = 4012066785128839109L;
@Resource
private TimerService timerService;
private Location loc;
public TEST25StartupManagerBean() {
loc= Location.getLocation(this.getClass());
}
@AppStartup
public void startupHook()
{
SimpleLogger.log(Severity.INFO, Category.APPLICATIONS, loc, "startupHook:01", "start timer ");
Long days = 1L;
if(days!=null && days>0 )
{
long DAYS_IN_MILLISECONDS = 1000 * 60 * 60 * 24 * days;
Timer t = timerService.createTimer(Calendar.getInstance().getTime(),DAYS_IN_MILLISECONDS, 1);
}
}
}
Obviously the timerservice isnt avaiable during AppStartup, but only when more than one server process exist. What is wrong ?
Thanks for help
Ines
Obviously the timer is used already when you try to access it? Sounds to me like a singularity problem: When starting more than one server node of course it tries to access all resources twice (or as often as you have nodes running) and for resources that can only be accessed once this produces an error.
unfortunately I'm not familiar with timers to go more into details...
Regards,
Benny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.