Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

nikola petanjak

+ Follow
since Apr 01, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nikola petanjak


today i passed with 76%. 70% was minimum, out of 87 questions.

1. ~5 questions are about security - HttpServletRequest + web.xml configuration
2. ~10 questions about composite components
3. 2 questions about custom components, without taglib descriptors
4. ~6 non-trivial facelets templating questions
5. ~4 questions about packaging JSF application, including taglib descriptors in WEB-INF
6. 10-15 questions about converters and validators - all you can think of
7. ~4 questions about GET requests (viewParams, h:link, hutputLink etc.)
8. ~5 questions about navigation, simple and bit harder ones
9. ~10 questions with Ajax and/or some simple JavaScript - not too complicated IMHO
10. One question about PhaseListener, one about <h:graphicImage>, one exclusively about @Inject (WTF?), one about ui:debug
11. Few about Locale, some combined inside questions about converters
12. 10,15,20 questions "What is best practice" or "What scope would you use" - not that easy!
13. ~5 questions about actionListeners
14. 0 (zero) questions about ManagedProperty and ViewScope
15. 3 questions about datatables
16. few questions about <h:selectOneMenu> and <h:selectManyMenu>
17. few questions about lifecycle - "in what phase would you do this", "what phases are skipped if you do this" etc.
18. There were no questions about JSF 2.2 stuff (flowscope, statless view, HTML5 passthrough etc.)

At least half questions were verbose. I tried to follow advise from some people here who said, read answers first - it didn't help me much, maybe with 1 or 2 questions.
With few questions, i didn't realy understand what they wanted to ask, to be honest.

I learned from Core JSF, Java EE6 tutorial, BalusC @ stackoverflow + blog, and JSF 2.0 specification.

I forgot to mention - i think you should stop task that you are about to create when application start because if applicition don't stop "normaly" task will "live on" so when you start application you will have 2 tasks actualy.

Me neither have a lot of experience but i'll do my best to explain.

Context listener is in Web part of application, so in my web.xml file i register it (controller is a name of package, ContextListener is name of a class):

Also, your class must implement javax.servlet.ServletContextListener interface. ServletContextListener has two methods, one when application start and other when applicaiton stops:


unfortunately i was forced to find another solution for automatic calling EJB method. I done it via WAS 7.0 Scheduler.

Short tutorial is on this link:

Calling EJB bean with WAS 7.0 Scheduler
Hello everyone,

considering the circumstances i was forced to find another solution for automatic calling EJB method. Unfortunately this was, for my opinion, less elegant and more limited solution.
I'll write short tutorial for how set WebSphere scheduler for all of you who got need to use it.

So here it is, using EJB 3.0 and WebSphere 7

1) Set scheduler in WebSphere console (you'll need database connection set as well, because scheduler automaticly creates few tables for managing tasks)

Go to resources -> schedulers -> new

Set JNDI name by which you'll call Scheduler from your application (in this example, it will be sched/testScheduler), and ofcourse choose database conneciton.

Poll interval - i'm not sure what is purpose of it because i set interval for tasks in application, but anyway i set it to 30min.

Table prefix - i guess choose whatever you prefer

Now after you created new Scheduler, select it in table (resources -> schedulers) and click 'Create tables'.

2) EJB part - i created stateless session bean and implemented with all it's methods. Then i removed @Override annotations from implemented methods, and removed "implements" part of code.



Ofcourse, now i had to tell in ejb-jar.xml that my bean will implement (as remote) and (as remote home):

Finally, here is code for setting and canceling tasks for particular scheduler (i call it in contextListener when application starts/stops)

So as you can see, taskInfo.setTaskHandler(home) is telling what bean will execute every time task is called.

Method to cancel all tasks with same name:


i can't access test environment that easy so i'll just have to wait couple of more days...But i can tell you that timer was set properly after application was deployed (here's the original log):

1st println is 1st line in contextInitialized method.
2nd println is after setting Calendar to next day in 3 A.M. in contextInitialized method.
3rd println is from EJB in method setNewTimer, when called from contextInitialized, after createTimer method.

I think i'll try to set interval to 5 minutes to see how it goes...And update to as soon as possible.

Also, i get this XA exception every now and then in logs (on test env.)...maybe that could be reason for timer not working, who knows.

Hi Jaikiran, and thanks for your reply.

Yes i printed cal.getTime(), the date and time are as it should be. The problem is very similar, it seems to me, to this one:

so i hoped newer fix pack will solve it, but then i realized that my version is, and they
recommend upgrading to
Hello everyone.

I am using contextListener to set EJB timer when application starts. Then, @Timeout method should be executed every 24 hours. On application stop timers are canceled.
I'm working with EJB3.0 and WebSphere Application server

On my developing environment everything works fine, but on test environment @Timeout method is not called altough timer IS set in contextListener. I have exactly nothing in my logs at the timeout (test environment is on

Any suggestions what could be reason for this behaviour besides different versions? I checked differences between these two versions but i haven't noticed anything related to EJB timers.

The overall code is rather simple:


EJB timer:

EJB timer interface:

Thank you all in advance.

Hi Tim, and thank you for your reply.

The problem is, our customer would like fancy solution. I would like to know is it possible to do that kind of refreshing/updating?
In my actual problem, i'd need to update few tables on page after new database update. Can i use ajax with jsf1.2?
6 years ago
Hello everyone,

can someone give me clue how to refresh JSF 1.2 page when database table gets updated? Alternative is also, that onMessage method in message bean trigger page refresh.

Thanks in advance.
6 years ago
I'm sorry but that's best advice i can give, as beginner.

Good luck.
6 years ago
I know my suggestion mind be trivial but,

have you tried value="#{simpleLogin.loginName}" (without capital S)?
6 years ago

Maybe you can get useful information from WebSphere trace.log?

Have you tried, in WebSphere console,

Troubleshooting -> Logs and trace -> /server_name/ -> Diagnostic Trace -> Change Log Detail Levels ?

There you can set, for instance,

openjpa.* -> (left click) -> Message and trace levels -> (fatal,severe,warning,info,...)

P.S. watch out for hard disk space
6 years ago
Thank you for your reply. The problem was more trivial then i tought; i needed to set value in my backing bean.
6 years ago