[JBoss Seam] - em is always null in my quartz scheduler, plz help.
by Stateless Bean
Hello,
I implemented my opensymphony quartz in Seam 1.6.1 GA app using JBoss 4.0.5. For some reasons I don't want to use Seam asynchronous.
My problem is I always get em injected as null, why?
here is my copomenents.xml
| <core:managed-persistence-context name="em"
| auto-create="true" persistence-unit-jndi-name="java:/sguEntityManagerFactory" />
|
Scheduler listener
| public class StartupListener implements ServletContextListener {
|
| public void contextInitialized(ServletContextEvent contextEvent) {
| SchedulerSystem obiektKlasyW = new SchedulerSystem();
|
| Thread watekPrzeliczniaCennika = new Thread(obiektKlasyW);
|
| watekPrzeliczniaCennika.start();
|
| }
|
| public void contextDestroyed(ServletContextEvent arg0) {}
| }
|
| public class SchedulerSystem implements Runnable {
|
| public void run() {
| SchedulerFactory schedFact = new rg.quartz.impl.StdSchedulerFactory();
|
| Scheduler sched = null;
| try {
| sched = schedFact.getScheduler();
| } catch (SchedulerException e) {
| e.printStackTrace();
| }
|
| try {
| sched.start();
| } catch (SchedulerException e) {
| e.printStackTrace();
| }
|
| //JobDetail jobDetail = new JobDetail("CennikJob", "groupCeniki", JobPrzeliczanieCennika.class);
| JobDetail jobDetail = new JobDetail("CennikJob", "groupCeniki", SchedulerJobs.class);
|
| Trigger trigger = TriggerUtils.makeSecondlyTrigger(2);
| trigger.setName("CennikiTrigger");
| trigger.setGroup("groupCeniki");
| trigger.setStartTime(new Date());
|
|
| try {
| sched.scheduleJob(jobDetail, trigger);
| } catch (SchedulerException e) {
| e.printStackTrace();
| }
|
| }//run()
|
| }
|
and my job
| public class SchedulerJobs implements Job {
| public SchedulerJobs() {}
|
| @In(create=true)
| protected EntityManager em;
|
| public void execute(JobExecutionContext kontekst) {
| Date date = new Date();
| //HERE i GET NULL my EM
|
| }
| }
|
Can anyone help me, hot to create/inject well my em?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071468#4071468
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071468
18Â years, 11Â months
[The Lizzard's corner] - Re: On the quality of user posts.
by jwenting
Often the problem isn't that the user doesn't know he's posting incomplete questions or posting them in the wrong place but that the user doesn't care.
This may be less prevalent here than in other forums (like the Sun forums for example).
Combine that with an attitude of expecting instant gratification without having to put in any effort of their own, and you have a recipe for disaster.
This has in part to do with education (or the lack thereof that nowadays is called education), in part with cultures that raise children in an atmosphere where their every wish is your command, noone dares say no to them or punish them for transgressions for fear of being termed a bad parent or worse a child molester.
Together they create a user (or more generally a person) who doesn't know how to use the tools he has at his disposal, and doesn't care to figure out how to use them, instead expects others to instantly drop what they're doing and provide service free of charge without even being told what the problem is.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071463#4071463
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071463
18Â years, 11Â months
[JBoss Seam] - Re: File upload to application folder
by gemel
Hello,
I hope you have already found a solution with the FileNotFoundException. Anyway I'm going to tell you how I solved this.
I had the same problem: Upload an image through s:fileupload and save it in anoter location.
Like you I got the FileNotFoundException.
1- You can't use only the fileName property of s:fileupload because this fileName doesn't have the directory structure. It just have something like this: bild.jpg
2- You have to locate the directory inside your application (where you want to save your file) with such a code for example:
| Properties props = System.getProperties();
| String jbossServerHomeUrl = props.getProperty( "jboss.server.home.url");
|
Psst: with your debugger, you can browse the properties inside props, and see what you have inside...
3- When you have your URL Please create an URI with it. And then create a file based on you URI
| URI bckGUri = new URI( jbossServerHomeUrl );
| File ilogBackgroundsFile = new File( bckGUri );
| ilogBackgroundsFile.mkdirs();
|
Psst: If you forget the mkdirs(), you will have the FileNotFoudException again!!
4- Then write in your file
| String imageFileDir = props.getProperty("jboss.server.home.dir") + File.separator + "bild.jpg";
| FileOutputStream fos = new FileOutputStream( imageFileDir );
| fos.write( byteArray );
|
Please be aware that I told of URL in part 3 but of Directories in part 4
Hope this will help!
Hope
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071462#4071462
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071462
18Â years, 11Â months
[JBoss jBPM] - some minor issues with eclipse jpdl 3.1.0 beta 1
by rossputin
Hi guys,
just thought I would report a couple of issues I have found while using the eclipse designer a little more often recently. It is possible that these issues are fixed in the beta 2 version, which I will download once I have finished my demo to the boss next week. Also I am not sure if this is the correct place to list problems I have encountered.
So I am using eclipse 3.3.0, build : I20070621-1340 on a macbook pro.
The issues I have found are :
1) some random duedate attributes seem to appear with an empty value, this causes exceptions within the console app
2) when there are two transitions from a node, both need to be labelled, if not, exceptions are generated within the console app, is there a validation option within the jpdl plug in that would trap this for me ?
3) form files generated within the plugin can only have one hyphen in the name for example, 'fbm-rejects.xhtml', if I try a name with two hyphens, like 'fbm-rejects-psr.xhtml' it is not stored in the database properly, and therefore the form does not display in the console app.
Thanks for your help,
Ross
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071459#4071459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071459
18Â years, 11Â months