Kingsousse / myschedule

Automatically exported from code.google.com/p/myschedule
0 stars 0 forks source link

Is it possible in myschedule to manage remote quartz jobs #92

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I have a requirement where I have to manage remote quartz jobs so I have 
evaluated myschedule and was not able to find such functionality. Let me 
explain my requirement in detail: I have 2-3 quartz jobs which are running out 
side myschedule and now I want to view, suspend, delete these jobs (i.e. manage 
these jobs) from myschedule UI. is it possible at all ? if yes, can you give me 
some pointer/direction how it can be done?

Thanks in advance.

Amit Kumar

Original issue reported on code.google.com by amit.t...@gmail.com on 12 Jul 2012 at 7:44

GoogleCodeExporter commented 9 years ago
Hello Amit,

You can try making your remote Quartz to enable RMI listener feature of the 
Quartz, then in MySchedule you may create a scheduler confit that also enable 
RMI as client. With this, your remote scheduler will shows up in MySchedule 
that you may monitor and control, but the job executions will actually be on 
your remote quartz still.

You may read more on Quartz RMI feature on their documentation.

Zemian

Original comment by saltnlight5 on 12 Jul 2012 at 1:08

GoogleCodeExporter commented 9 years ago

Original comment by saltnlight5 on 12 Jul 2012 at 1:10

GoogleCodeExporter commented 9 years ago
Hi Zemian,

I'm having an issue using this RMI feature that you mention. I've created a 
simple RMIServer on my local tomcat instance (with a scheduler), and configured 
an rmi scheduler on myschedule (also on my local tomcat).

I'd like to be able to add a job that is in the same classpath as the rmiserver 
but I keep getting a class not found exception in myschedule when I try add it.

Any tips?

Thanks,
Brett

Original comment by 13.br...@gmail.com on 15 Aug 2012 at 1:37

GoogleCodeExporter commented 9 years ago
HI Brett,

The easiet to config is make both RMI client and server process to load same 
set or jar/classes. Have you verified you loaded them in both? How did you add 
your jars into myschedule app?

Original comment by saltnlight5 on 15 Aug 2012 at 8:46

GoogleCodeExporter commented 9 years ago
Hi Zemian,

I have managed to get it working by dropping the jar into the lib folder of the 
myschedule app.

I was hoping to be able to have the myschedule app running as it's own webapp, 
and pointing to some classes existing in my own webapp, to manage them that way.

I should be able to get it running by creating a jar of the jobs I want and 
making them available to the myschedule app (i.e. by putting it in the lib 
folder of the myschedule app or by putting it in the common lib folder).

Next question: is there functionality to have security/access control around 
the app?

Thanks again,
Brett

Thanks,
Brett

Original comment by 13.br...@gmail.com on 16 Aug 2012 at 8:07

GoogleCodeExporter commented 9 years ago
You may use any standard way of securing a Java Servlet web application in your 
app server. Again, an easier way might be to edit the WEB-INF/web.xml to use 
the security-constraint and related elements. Take a look at a very simple web 
app set here: 
https://bitbucket.org/saltnlight5/sandbox/src/4e80e4b4114e/webapp-login

Original comment by saltnlight5 on 16 Aug 2012 at 11:05

GoogleCodeExporter commented 9 years ago
Great, thanks will check that out.

Original comment by 13.br...@gmail.com on 21 Aug 2012 at 3:56

GoogleCodeExporter commented 9 years ago

Original comment by saltnlight5 on 21 Aug 2012 at 6:59

GoogleCodeExporter commented 9 years ago

I'm also trying without success to get RMI client/server to work. Can anyone 
shed some light on this subject? 

I have a webapp with a quartz 2.01 instance which I tried to configure as an 
RMI server, then I deployed myschedule 2.4.4 (quartz 2.1.6 -- not sure if the 
versions need to match)  as a separate webapp under the same glassfish domain 
and tried to configure it as an RMI client so I could manage my original quartz 
instance. When I create the RMI client from the myschedule UI I get this error:

myschedule.service.ErrorCodeException: SCHEDULER_PROBLEM: Failed to initialize 
Quartz scheduler using configProps.
    at myschedule.service.SchedulerService.initScheduler(SchedulerService.java:119)
    at myschedule.service.SchedulerService.initService(SchedulerService.java:104)
    at myschedule.service.AbstractService.init(AbstractService.java:26)
    at myschedule.service.SchedulerContainer.modifyScheduler(SchedulerContainer.java:90)
<stuff deleted> 

Due to 
Caused by: org.quartz.SchedulerException: Could not get handle to remote 
scheduler: Not bound: "RmiQuartzScheduler_$_NON_CLUSTERED" (only bound name is 
"jmxrmi") [See nested exception: java.rmi.NotBoundException: Not bound: 
"RmiQuartzScheduler_$_NON_CLUSTERED" (only bound name is "jmxrmi")]
    at org.quartz.impl.RemoteScheduler.getRemoteScheduler(RemoteScheduler.java:118)
    at org.quartz.impl.RemoteScheduler.getSchedulerName(RemoteScheduler.java:141)
    at org.quartz.impl.SchedulerRepository.bind(SchedulerRepository.java:79)
    at org.quartz.impl.StdSchedulerFactory.instantiate(StdSchedulerFactory.java:694)
    at org.quartz.impl.StdSchedulerFactory.getScheduler(StdSchedulerFactory.java:1484)
    at myschedule.quartz.extra.SchedulerTemplate.(SchedulerTemplate.java:74)
    at myschedule.service.SchedulerService.initScheduler(SchedulerService.java:113)
    ... 34 more
Caused by: java.rmi.NotBoundException: Not bound: 
"RmiQuartzScheduler_$_NON_CLUSTERED" (only bound name is "jmxrmi")
    at sun.management.jmxremote.SingleEntryRegistry.lookup(SingleEntryRegistry.java:56)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
"only bound name is "jmxrmi"". 

I have also tried adjusting the provided config properties to set the above 
scheduler name/instance ID to my original without success.

I don't know if I can use the approach of creating a jar with my jobs. Our 
quartz usage involves making an API call that then it calls a class (which I am 
not the author of) which implements org.quartz.StatefulJob.

Can anyone shed any light on this? Thanks!

CJ

Original comment by chert...@liveops.com on 5 Sep 2012 at 4:16

GoogleCodeExporter commented 9 years ago
CJ,
Your error seems to be clear, client can't find the name that suppose to be 
provided by the server. Check your server side config with name and port usage. 

If you like further help, you need to share both quartz.properties (or its 
content) for your RMI server and your client.

Original comment by saltnlight5 on 5 Sep 2012 at 1:16

GoogleCodeExporter commented 9 years ago
Thank you for the speedy response! I agree the error seems clear and to me it 
indicates I'm not binding the name into the RMI registry and it is using the 
default, but I can't figure out how to fix that.

Some additional info: I have now learned we have a clustered config with auto 
generated instanceIds  (these look like hostname<guid>). Can myschedule work in 
such an environment?

If the answer to the last question is "yes", then please check my config below. 

# Server
com.sun.management.jmxremote.ssl=false
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.port=1099
com.sun.management.jmxremote
org.quartz.scheduler.instanceName=RmiQuartzScheduler
org.quartz.scheduler.rmi.export=true
org.quartz.scheduler.rmi.serverPort=8692
org.quartz.scheduler.rmi.createRegistry=true
org.quartz.scheduler.rmi.registryHost=localhost
org.quartz.scheduler.rmi.registryPort=1099
# I have tried using this objectName, but still get the message that the only 
bound name is jmxrmi. It seems 
# this objectName is not what gets bound into the rmi registry? Furthermore, 
upon realizing I have a clustered 
# I have also tried specifying a generated instanceID on the client side. I 
know this is not a good long-term 
# plan since they are auto-generated but I wanted to see if I could get 
something working that way.
#org.quartz.scheduler.jmx.objectName=quartz:type=QuartzScheduler,name=RmiQuartzS
cheduler_,instanceId=NON_CLUSTERED

# client - should be the RMI client that shipped with myschedule 2.4.4
org.quartz.scheduler.skipUpdateCheck = true
org.quartz.scheduler.instanceName = RmiQuartzScheduler_
org.quartz.scheduler.instanceId = NON_CLUSTERED
org.quartz.scheduler.jobFactory.class = org.quartz.simpl.SimpleJobFactory
org.quartz.scheduler.rmi.proxy = true
org.quartz.scheduler.rmi.registryHost = localhost
org.quartz.scheduler.rmi.registryPort = 1099

# MySchedule scheduler service parameters (These are not used by quartz itself, 
but for the webapp only.)
myschedule.schedulerService.autoInit = true
myschedule.schedulerService.autoStart = true
myschedule.schedulerService.preventAutoStartRemoteScheduler = true
myschedule.schedulerService.waitForJobsToComplete = false

Thanks again,
CJ

Original comment by chert...@liveops.com on 6 Sep 2012 at 1:39

GoogleCodeExporter commented 9 years ago
CJ, yes, Quartz requires the name and Id must match. You can explicitly set 
your server id instead of auto generated (eg: use your host name etc). Then you 
can match your client. 

Original comment by saltnlight5 on 7 Sep 2012 at 10:21

GoogleCodeExporter commented 9 years ago
Okay, I'll have to figure out how that works given our other constraints. 
Thanks for the response.

CJ

Original comment by chert...@liveops.com on 7 Sep 2012 at 11:06

GoogleCodeExporter commented 9 years ago
Hi Brett/Zemian,

I am trying to provide the remote access of my jars to myschedule. What all 
methods are available for this? Brett mentions - 

I was hoping to be able to have the myschedule app running as it's own webapp, 
and pointing to some classes existing in my own webapp, to manage them that way.

I should be able to get it running by creating a jar of the jobs I want and 
making them available to the myschedule app (i.e. by putting it in the lib 
folder of the myschedule app or by putting it in the common lib folder).

I wanted to ask if there's any other way to do this rather than copy pasting 
libraries with each and every small change in both places.

Would really appreciate your time and help. 

Thanks

K5J9

Original comment by kritin.j...@gmail.com on 3 Jan 2014 at 11:28

GoogleCodeExporter commented 9 years ago
I have this same Problem:

> Caused by: java.rmi.NotBoundException: Not bound: 
"RmiQuartzScheduler_$_NON_CLUSTERED" (only bound name is "jmxrmi")

> Quartz requires the name and Id must match. You can explicitly set your 
server id instead of auto generated 

Whitch exacly Property is wrong in CJ case?
Can you give me example, how to fix this?
What is "server id"?

Thanks
Marcin

Original comment by mstachniuk on 23 Oct 2014 at 10:54