on 02-25-2008 10:43 AM
Hi all,
I think this migth be a question of beginners: What is the common way / best practise to provide properties to a session bean?
Thanks for each hint,
Christoph
That depends very much. For example whether it's a stateful or a stateless session bean. In the first case you could use getters ans setters as with a normal JavaBean. In latter case this is not a good idea, so you would use paramaeters in the call of the Bean.
Maybe you should go more into the details of what you want to do?
Regards,
Benny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Benny,
thanks for this hint. It's a statless session bean. I'm not quite convinced about your suggestion to deliver config-params to the methods of a session bean. E.g. I implement a method to send some data to a subsystem. To do this I have to know the hostname of subsystem's server. I do not think that this hostname is anything the UI should be concerned with. It's part of business logic. So I would like to configure this hostname for ma bean.
Regards,
Christoph
Hi Christoph,
oops, you asked for properties and I thought about fields.
Your example shows quite clearly the direction to go: In that case you should use the JNDI (Java Naming and Directory Interface) environment. That allows to be independent of name changes afterwards and also allows to reconfigure your landscape afterwards without changing the code. JNDI is part of the EE standard and the right buzzword to search for.
Regards,
Benny
Hi Vladimir,
yes, I already heard about and did some tests. I generated the file "sap.application.global.properties" in META-INF of my EAR-DC. After deployment of the EAR I can see the defined properties in NW-Administrator.
My problem is that I don't know how to access the props. I tried following source-code:
InitialContext ctx = new InitialContext();
ApplicationConfigHandlerFactory cfgHandler = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");
java.util.Properties appProps = cfgHandler.getApplicationProperties();
if (appProps==null) {
// some reaction if no application properties are available.
} else {
//extract properties
}
I get an error at compile time that class ApplicationConfigHandlerFactory cannot be found. I already tried to use several public parts but no one seems to be appropriate.
On the other hand side I found a jar-file named "sap.comtcjeconfigurationimpl.jar" in directory "/usr/sap/JAD/J00/j2ee/cluster/bin/services/configuration" in the server's filesystem. This jar-file contains the missing class. I just can't find the public part that delivers access to the jar-file. Do you know anything more?
I'm developping under CE SP03 with NWDI.
Regards,
Christoph
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.