Access EJB in ViewModel

asked 2013-03-06 12:59:56 +0800

zulq gravatar image zulq

How can I access and EJB in a VM. I am trying to use pure Java EE 6 as backend as I found spring hard to understand compare to Java EE 6. My setup is as follows:

Eclipse Enterprise Application Project with modules { EJB Module and ZK Web Module}. I've created Users Entiy and UsersEJB to fetch all users and return a list. I am not getting any ejb exceptions but when I tried to get usersList in zul page I am getting NullPointerException.

Any help or documentation how to use EJB as backend for ViewModels.


delete flag offensive retag edit


I don't use EJBs any more, but ZK will work just fine with them. Look up some tutorials on using an EJB in a servlet and make sure your project has a simple HelloWorld servlet and see if accessing your EJB in there works. Sounds like you might be new to using EJBs in general.

rickcr ( 2013-03-09 04:02:19 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-11 03:21:20 +0800

dennis gravatar image dennis
3669 1 6

It is just like you use EJB in any servlet. ViewModel are running in servlet-thread. if you are using spring to help you access EJB, please read http://books.zkoss.org/wiki/ZK%20Developer's%20Reference/Integration/Middleware%20Layer/Spring

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2013-03-06 12:59:56 +0800

Seen: 28 times

Last updated: Mar 11 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More