Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/_main.inc.php on line 123

Strict Standards: Declaration of UserSettings::get() should be compatible with AbstractSettings::get($col_key1, $col_key2 = NULL, $col_key3 = NULL) in /home/pwsconsu/public_html/blog/inc/MODEL/users/_usersettings.class.php on line 202

Strict Standards: Declaration of UserSettings::set() should be compatible with AbstractSettings::set() in /home/pwsconsu/public_html/blog/inc/MODEL/users/_usersettings.class.php on line 202

Warning: Creating default object from empty value in /home/pwsconsu/public_html/blog/inc/MODEL/settings/_abstractsettings.class.php on line 221

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/MODEL/generic/_genericelement.class.php on line 112

Strict Standards: Declaration of Blog::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/pwsconsu/public_html/blog/inc/MODEL/collections/_blog.class.php on line 1034

Strict Standards: Declaration of BlogCache::option_list() should be compatible with DataObjectCache::option_list($default = 0, $allow_none = false, $method = 'name') in /home/pwsconsu/public_html/blog/inc/MODEL/collections/_blogcache.class.php on line 272

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/MODEL/collections/_category.funcs.php on line 390

Strict Standards: Declaration of Group::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/pwsconsu/public_html/blog/inc/MODEL/users/_group.class.php on line 420

Strict Standards: Declaration of User::dbdelete() should be compatible with DataObject::dbdelete() in /home/pwsconsu/public_html/blog/inc/MODEL/users/_user.class.php on line 1145

Strict Standards: Declaration of User::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/pwsconsu/public_html/blog/inc/MODEL/users/_user.class.php on line 1145

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/_misc/_resultsel.class.php on line 549

Strict Standards: Declaration of ResultSel::display_list_start() should be compatible with Results::display_list_start($detect_no_results = true) in /home/pwsconsu/public_html/blog/inc/_misc/_resultsel.class.php on line 48

Strict Standards: Declaration of ResultSel::display_list_end() should be compatible with Results::display_list_end($detect_no_results = true) in /home/pwsconsu/public_html/blog/inc/_misc/_resultsel.class.php on line 48

Strict Standards: Declaration of Filetype::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/pwsconsu/public_html/blog/inc/MODEL/files/_filetype.class.php on line 197

Strict Standards: Declaration of UserCache::option_list() should be compatible with DataObjectCache::option_list($default = 0, $allow_none = false, $method = 'name') in /home/pwsconsu/public_html/blog/inc/MODEL/users/_usercache.class.php on line 288

Strict Standards: Declaration of Comment::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/pwsconsu/public_html/blog/inc/MODEL/comments/_comment.class.php on line 1164

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/MODEL/items/_itemlist.class.php on line 602

Notice: Array to string conversion in /home/pwsconsu/public_html/blog/inc/_misc/_misc.funcs.php on line 1253

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/inc/_blog_main.inc.php on line 306

Strict Standards: Declaration of ItemList2::query() should be compatible with Results::query($create_default_cols_if_needed = true, $append_limit = true, $append_order_by = true) in /home/pwsconsu/public_html/blog/inc/MODEL/items/_itemlist2.class.php on line 48

Notice: Array to string conversion in /home/pwsconsu/public_html/blog/inc/_misc/_misc.funcs.php on line 1253

Deprecated: Function ereg() is deprecated in /home/pwsconsu/public_html/blog/inc/_blog_main.inc.php on line 413

Warning: Cannot modify header information - headers already sent by (output started at /home/pwsconsu/public_html/blog/inc/MODEL/items/_itemlist.class.php:602) in /home/pwsconsu/public_html/blog/inc/MODEL/skins/_skin.funcs.php on line 71

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 528

Strict Standards: Declaration of code_highlight_plugin::AdminEndHtmlHead() should be compatible with Plugin::AdminEndHtmlHead(&$params) in /home/pwsconsu/public_html/blog/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 559

Strict Standards: Declaration of code_highlight_plugin::SkinBeginHtmlHead() should be compatible with Plugin::SkinBeginHtmlHead(&$params) in /home/pwsconsu/public_html/blog/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 559

Strict Standards: Declaration of code_highlight_plugin::PluginVersionChanged() should be compatible with Plugin::PluginVersionChanged(&$params) in /home/pwsconsu/public_html/blog/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 559
The South East Asia SOA Weblog - How to Call Geronimo 2.2 Local EJB using JNDI

How to Call Geronimo 2.2 Local EJB using JNDI

06/07/11

Permalink 09:31:30 pm, by david Email , 428 words, 60579 views   English (US)
Categories: SOA Solutions in South East Asia

How to Call Geronimo 2.2 Local EJB using JNDI

I had searched high and low for a solution to this. Seems like all the solution examples on Geronimo’s web site were using annotations and everything else I looked at seemed to draw a complete blank. Never being one to give up that easily I decided to hack my way through it. The first trick to be aware of is that like all the other services in Geronimo, the OpenEJB services are installed into the server by means of a resource adapter GBean. This doesn’t matter that much other than that you need to consider this when searching for a solution. So the first thing I did was set up an initial context in my EJB client code (the scenario is Session EJB calls another session EJB using local interface). The following code fragment shows how to set up the initial context call:

Code:

Properties props = new Properties();
      props.setProperty("java.naming.factory.initial",
      "org.openejb.client.LocalInitialContextFactory");
 
      Context ic = new InitialContext(props);

Note that I use “org.openejb.client.LocalInitialContextFactory” as the JNDI context factory class.

The second interesting fact has to do with the way in which OpenEJB exposes JNDI resources. When an EJB is deployed with both local and remote interfaces in most containers the java:comp/env namespace is used to provide access to local interface EJB resources. In Geronimo 2.2 with OpenEJB this definitely does not work at all. What actually happens is that an additional EJB interface is exposed as a “Local” interface. For example if I had deployed an EJB with the following components:

1) FooSessionEJBLocal - local interface
2) FooSessionEJBRemote - remote interface
3) FooSessionEJBBean - the actual session bean

… then OpenEJB will expose FooSessionEJBBean (the remote bean) and another curiously named EJB FooSessionEJBBeanLocal (the local bean). Only the latter can be cast to the FooSessionEJBLocal interface so for example when performing a lookup your code should look like this:

Code:

try {
  Properties props = new Properties();
  props.setProperty("java.naming.factory.initial", "org.openejb.client.LocalInitialContextFactory");
  Context ic = new InitialContext(props);
  FooSessionEJBLocal localFoo =  ic.lookup("FooSessionEJBBeanLocal");
  localFoo.bar();
} catch (Exception e){
  ... do whatever
}

Note that the lookup is for “FooSessionEJBBeanLocal” and not “FooSessionEJBLocal". Also note that if you try to bind the remote EJB (FooSessionEJBBean) you can do so but that transactional context of using local EJB will not be managed by JTA (this is important if your code is dependent on operations within the context of the current container transaction).

Truth be told I was amazed that nobody on any of the Geronimo mailing lists had figured this out or had posted a workable solution.


Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/skins/_feedback.php on line 102

Trackback address for this post:


Strict Standards: Declaration of captcha_img_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/pwsconsu/public_html/blog/plugins/captcha_img_plugin/_captcha_img.plugin.php on line 1464

Strict Standards: Declaration of captcha_img_plugin::AfterCommentFormInsert() should be compatible with Plugin::AfterCommentFormInsert(&$params) in /home/pwsconsu/public_html/blog/plugins/captcha_img_plugin/_captcha_img.plugin.php on line 1464

Strict Standards: Declaration of captcha_img_plugin::CaptchaValidatedCleanup() should be compatible with Plugin::CaptchaValidatedCleanup(&$params) in /home/pwsconsu/public_html/blog/plugins/captcha_img_plugin/_captcha_img.plugin.php on line 1464

Strict Standards: Only variables should be passed by reference in /home/pwsconsu/public_html/blog/inc/_misc/_plugins.class.php on line 1649

Strict Standards: Declaration of PluginSettings::get() should be compatible with AbstractSettings::get($col_key1, $col_key2 = NULL, $col_key3 = NULL) in /home/pwsconsu/public_html/blog/inc/MODEL/settings/_pluginsettings.class.php on line 98

Strict Standards: Declaration of PluginSettings::set() should be compatible with AbstractSettings::set() in /home/pwsconsu/public_html/blog/inc/MODEL/settings/_pluginsettings.class.php on line 98

Warning: Creating default object from empty value in /home/pwsconsu/public_html/blog/inc/MODEL/settings/_abstractsettings.class.php on line 234
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)

Comments, Trackbacks, Pingbacks:

Comment from: Toronto Local SEO Service [Visitor] · http://Digitalshiftseo.com/

Strict Standards: Declaration of smilies_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/pwsconsu/public_html/blog/plugins/_smilies.plugin.php on line 391

Strict Standards: Declaration of smilies_plugin::GetDefaultUserSettings() should be compatible with Plugin::GetDefaultUserSettings(&$params) in /home/pwsconsu/public_html/blog/plugins/_smilies.plugin.php on line 391

Strict Standards: Only variables should be passed by reference in /home/pwsconsu/public_html/blog/inc/_misc/_plugins.class.php on line 1649

Warning: Creating default object from empty value in /home/pwsconsu/public_html/blog/inc/MODEL/settings/_abstractsettings.class.php on line 333
Heya! I'm at work surfing around your blog from my new iphone 3gs!
Just wanted to say I love reading through your blog and look forward to all your posts!
Keep up the great work!
PermalinkPermalink 07/15/15 @ 20:16
Comment from: landscapting [Visitor] · http://triadweedfree.com/
I am regular visitor, how are you everybody? This article posted at this website is actually
good.
PermalinkPermalink 11/13/15 @ 10:53
Comment from: seo services [Visitor] · http://seoservicethai.blogspot.com/2015/10/seo.html
An outstanding share! I have just forwarded
this onto a coworker who has been doing a little homework on this.
And he actually bought me breakfast due to the fact that I found
it for him... lol. So allow me to reword
this.... Thanks for the meal!! But yeah, thanks for spending
some time to talk about this topic here on your blog.
PermalinkPermalink 11/21/15 @ 09:48
Hello there! This article could not be written any
better! Going through this article reminds me of
my previous roommate! He continually kept preaching
about this. I most certainly will forward this article to
him. Pretty sure he's going to have a great read. Thanks
for sharing!
PermalinkPermalink 11/22/15 @ 20:07
Comment from: seo service [Visitor] · http://www.thaiwebcenter.net/seo/
Hey there! I've been following your blog for
some time now and finally got the courage to go ahead and give you a shout out from Dallas Tx!
Just wanted to say keep up the good work!
PermalinkPermalink 11/24/15 @ 21:27
Comment from: seo service [Visitor] · http://www.seothesecret.com/
Thank you for the auspicious writeup. It in fact was a amusement account it.

Look advanced to more added agreeable from you! By the way, how could we
communicate?
PermalinkPermalink 11/24/15 @ 21:30
Comment from: seo service [Visitor] · http://www.seosolution1st.com/
Hi to every one, the contents present at this web site are
in fact awesome for people experience, well, keep up the nice work fellows.
PermalinkPermalink 11/24/15 @ 22:35
Comment from: รับทำ SEO [Visitor] · http://www.seo.co.th/
Heya i am for the primary time here. I came across this board and I
find It truly helpful & it helped me out a
lot. I'm hoping to offer something again and help others such as you helped me.
PermalinkPermalink 11/30/15 @ 06:35
Comment from: chemicals lab [Visitor] · http://apexchemicals.ucoz.com/
Hurrah, that's what I was searching for, what a stuff!
present here at this blog, thanks admin of this web page.
PermalinkPermalink 12/09/15 @ 22:37
Comment from: shoes [Visitor] · http://shoesall.tumblr.com/
Amazing blog! Is your theme custom made or did you download it from
somewhere? A theme like yours with a few simple tweeks would really make my blog jump out.
Please let me know where you got your design. Thanks
PermalinkPermalink 12/13/15 @ 00:45
Comment from: Alysa [Visitor] · http://cement-beton.com.ua/
Смотрите лучше здесь:
ландшафтный дизайн (Ollie)
http://cement-beton.com.ua/ http://cement-beton.com.ua/
PermalinkPermalink 05/20/17 @ 22:29
Comment from: Sylvia [Visitor] · http://intouch.com.ua/
Эрофорс купить в Украине
EroForce — капсулы для потенции,
которые оказываўт комплексное воздействие на мужской организм.
Это средство способно решить множество
проблем, начиная с ослабления либидо и заканчивая полной импотенцией.
Препарат снова вернёт радость от секса.


Капсулы Eroforce практически не имеўт аналогов по своему воздействиў
и обладаўт массой достоинств по сравнениў с похожими средствами:
быстрый длительный эффект;
натуральный состав;
усиление либидо;
капсулы не просто маскируўт, а излечиваўт и
устраняўт проблему полностьў;
продлеваўт половой акт;
делаўт ощущения более яркими;

не имеўт противопоказаний;
удобны в применении. http://intouch.com.ua/
PermalinkPermalink 06/01/17 @ 10:35

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)

Hosted by:
hosted by PWS Consulting

The South East Asia SOA Weblog

The intention of this blog is to collect thoughts on the issues, paradigms, process, vendors, solutions, project and any other item related service oriented architecture in South East Asia.


Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/plugins/_calendar.plugin.php on line 135
August 2017
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Search


Strict Standards: Declaration of ArchiveList::count_total_rows() should be compatible with Results::count_total_rows($sql_count = NULL) in /home/pwsconsu/public_html/blog/plugins/_archives.plugin.php on line 544

Deprecated: Assigning the return value of new by reference is deprecated in /home/pwsconsu/public_html/blog/skins/_linkblog.php on line 46

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 45

Deprecated: Non-static method Hitlist::dbprune() should not be called statically, assuming $this from incompatible context in /home/pwsconsu/public_html/blog/inc/MODEL/sessions/_hit.class.php on line 483