struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Wasserman - BCX - Mngd Services" <>
Subject Application Resources via EJB's - Need some help plz
Date Fri, 21 May 2004 09:24:16 GMT
I'm trying to make Struts to use EJB's AND files to get the Resource
For example, I'll have standard (static) App-resources files under (for
instance) WEB-INF/classes/acme/  and I'll have an
EJB under (for example [jndiName]) "acme/Application".  Struts will
first try and find the property in the bean, if unsuccessful, or the
bean could not be found, or any other EJB problem, it will read the
property from the file.  
This will allow for more dynamic properties that can be set during
runtime.  If I do some "dirty bean" checking now and again I can load
changed properties from the bean when required.
Now for my problem:
I cannot get an instance of the bean.
As you'll see from my code, I'm not all to good with dynamicaly
accessing classes.
I'm trying this:
Context ctx = new InitialContext(env);

Object obj = ctx.lookup( "acme/Application" );


Class bcHome = Class.forName("app.resources.ApplicationHome");


Object boHome;

boHome = PortableRemoteObject.narrow(obj, bcHome); //<-LINE 35



And get the following:
java.lang.InstantiationException: app.resources.Application

      at java.lang.Class.newInstance0(Unknown Source)

      at java.lang.Class.newInstance(Unknown Source)

      at CallResourcesEjb.main(

Please see the attached file for a full code listing.

View raw message