|
From: Lars H. <ho...@ar...> - 2004-02-19 16:29:26
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I forgot to mention that this problum occured on WebSphere ;-) Am 19.02.2004 um 17:06 schrieb Lars Hoss: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Daniel! > > Today we ran into the problem that a Quartz job had no java:comp/env > context. Referencing EJBs (or resources) by > using the full JNDI path was no problem but java:comp/env was a no-go. > > Yours, > Lars > > Am 19.02.2004 um 16:16 schrieb Daniel Potter: > >> Juergen, >> I have a question regarding these classes and/or your general >> experience >> using Quartz with Spring in an J2EE container. We've run into JNDI >> lookup issues with jobs that attempt to use Spring beans that contain >> references to JNDI resources (thru a JndiObjectFactoryBean). It >> appears >> the Quartz job doesn't know it's running within the container (even >> though the scheduler is started in the init() method of a servlet), = so >> it's >> dependencies fail to locate the default JNDI context (and therefore >> fail >> to locate their JNDI dependencies). I assume this is because the >> scheduler is running in its own thread, so it doesn't have any =20 >> implicit >> knowledge of the container. To get around this, we've been >> forced to use a separate Spring config file for the Quartz jobs that >> overrides the default JNDI settings used by the JndiObjectFactoryBean >> like this (as if the job had to connect to JNDI remotely): >> >> <!-- JNDI connection information --> >> <bean id=3D"myJndiTemplate" >> class=3D"org.springframework.jndi.JndiTemplate"> >> <property name=3D"environment"> >> <props> >> <prop >> = key=3D"java.naming.factory.initial">com.ibm.websphere.naming.WsnInitialC=20= >> o >> ntextFactory</prop> >> <prop >> key=3D"java.naming.provider.url">iiop://localhost:9091</prop> >> <prop key=3D"java.naming.security.credentials">user</prop> >> <prop key=3D"java.naming.security.principal">pw</prop> >> </props> >> </property> >> </bean> >> >> <!-- QUEUE CONNECTION FACTORY --> >> <bean id=3D"jmsQueueConnectionFactory" >> class=3D"org.springframework.jndi.JndiObjectFactoryBean" >> lazy-init=3D"true"> >> <property name=3D"inContainer"> >> <value>false</value> >> </property> >> <property name=3D"jndiTemplate"> >> <ref local=3D"myJndiTemplate"/> >> </property> >> <property name=3D"jndiName"> >> <value>Example/QueueConnectionFactory</value> >> </property> >> </bean> >> >> This also requires us to load a separate application context for the >> Quartz jobs that uses these settings, rather than being able to share >> the application context used by the rest of the application. >> >> Have you ever run into this issue? Do your support classes get = around >> this somehow? >> >> Regards, >> Daniel >> >> On Wed, Feb 18, 2004 at 11:43:14PM +0100, j?rgen h?ller [werk3AT] >> wrote: >>> Everybody, >>> >>> I've revived my Quartz support classes for Spring today. They = emerged >>> from a job scheduling consulting project I did in autumn 2003. We >>> have concrete needs for this now at werk3AT, thus the revival: It's >>> about quite simple cron-style scheduling of application jobs. >>> >>> The basic idea is to set up a Quartz Scheduler via a >>> SchedulerFactoryBean, also allowing to register scheduled jobs there >>> via a <list> of <refs> to ScheduledJobDefinition beans. A >>> ScheduledJobDefinition is just a simple combination of a Quartz >>> JobDetail and a Quartz Trigger. >>> >>> ScheduledJobDefinition bean implementations include: >>> - DefaultScheduledJobDefinition, allowing to use any implementation >>> of Quartz' Job interface with a declaratively configured job data = map >>> and cron trigger >>> - MethodInvokingJobDefinition, allowing to specify a method of a >>> Spring-managed bean to execute as job (completely declarative, >>> without the need for implementing a custom Job object), with a cron >>> trigger. >>> >>> Both job definition beans can link in a separate Quartz Trigger >>> instance instead of a cron expression; DefaultScheduledJobDefinition >>> can also link in a separate Quartz JobDetail instance instead of a >>> job class. >>> >>> That's all there is: A simple declarative way of using Quartz within >>> Spring. Typically no rescheduling or the like: All schedules are set >>> up on context startup, defined as bean definitions. Of course, you >>> can also fetch the Scheduler instance and perform any custom >>> scheduling, instead of using preconfigured ScheduledJobDefinition >>> beans. >>> >>> The typical usage scenario are low-level jobs within an application, >>> like data synchronization or storage cleanup - all predefined jobs >>> that are just customized by an administrator. Fits nicely into >>> Spring's application context model; most jobs will simply delegate = to >>> Spring-managed business objects. >>> >>> I expect to have this polished by the end of the week, as we need it >>> at werk3AT quite urgently. I'd like to include this already in = Spring >>> 1.0 final, as it's just 6 pretty simple classes (yes, I know - >>> feature freeze - never mind ;-). The main question is where to put >>> it: I suggest "org.springframework.scheduling.quartz". >>> >>> If there are no general objections, I'll commit it by the end of = this >>> week, for review within the next week - still plenty of time before >>> 1.0 final ;-) Looking forward to your feedback! >>> >>> Juergen >>> >>> >>> >>> ------------------------------------------------------- >>> SF.Net is sponsored by: Speed Start Your Linux Apps Now. >>> Build and deploy apps & Web services for Linux with >>> a free DVD software kit from IBM. Click Now! >>> http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dclick >>> _______________________________________________ >>> Springframework-developer mailing list >>> Spr...@li... >>> https://lists.sourceforge.net/lists/listinfo/springframework-=20 >>> developer >> >> >> ------------------------------------------------------- >> SF.Net is sponsored by: Speed Start Your Linux Apps Now. >> Build and deploy apps & Web services for Linux with >> a free DVD software kit from IBM. Click Now! >> http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dclick >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> = https://lists.sourceforge.net/lists/listinfo/springframework-developer >> > > -----BEGIN PGP SIGNATURE----- > Version: PGP 8.0.3 > > iQA/AwUBQDTfDrcyzbDWnRDCEQLftgCaA2Fahb3SxkDaVukOgQCQwqbNwhkAoO/u > f4iliYO7q6nORpL/n709U/nS > =3Dppnq > -----END PGP SIGNATURE----- > > > > ------------------------------------------------------- > SF.Net is sponsored by: Speed Start Your Linux Apps Now. > Build and deploy apps & Web services for Linux with > a free DVD software kit from IBM. Click Now! > http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dclick > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > -----BEGIN PGP SIGNATURE----- Version: PGP 8.0.3 iQA/AwUBQDTjKLcyzbDWnRDCEQI/dgCgzh+oxO2wfy19PfvUHkPCruCsK8UAn34F BEFyVURmwJ5Xw0TWkOveCagO =3Dn1uu -----END PGP SIGNATURE----- |