users@glassfish.java.net

Glassfish v2 - JNDI - String or Properties or Bean

From: <glassfish_at_javadesktop.org>
Date: Fri, 22 May 2009 02:39:51 PDT

Hi All,

I am trying to do something that I thought would be quite straightforward but after a lot of googling and trying things I am getting nowhere. Maybe I am doing something stupid. I have about 20+ tabs open now with forum posts and articles showing different ideas.

Basically we need to store Strings in JNDI for a number of application variables. I donĀ“t mind doing this via a separate JNDI entry for each String or a JNDI properties entry or a Bean with getters/setters for each property.

I thought I might be able to use org.apache.naming.factory.BeanFactory out of the box but I keep getting the error "java.lang.IllegalArgumentException: [com.example.TestBean] is not an allowed property value type at com.sun.enterprise.deployment.ResourceReferenceDescriptor.checkType(ResourceReferenceDescriptor.java:492)
".

TestBean is a simple no brainer class:

public class TestBean implements Serializable {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
}

Surely someone must have used this factory class.

My other option is to resort to hacking my own factory class as I have seen in other example but I am reluctant to do this because there *must* be an easier way no? And this would complicate the project source, build process and deployment process.

This would also possibly help me get around my other gripe in that setting up a JavaMail session I cannot provide the password.

Any advice/help greatly appreciated.

Cheers, Carl.
[Message sent by forum member 'cballantyne' (cballantyne)]

http://forums.java.net/jive/thread.jspa?messageID=347279