[jetty-user] Re: How to bind a POJO to JNDI

Avinder Bahra <[email protected]>
Newsgroups gmane.comp.java.jetty.support
Message-ID <[email protected]>
Found the problem - I was setting EnvEntry in jetty.xml - when I put it in
jetty-env.xml it works.

Avinder

On 27 October 2010 11:48, Avinder Bahra <[email protected]>wrote:

> Hi,
>
> I am using the maven jetty plugin 6.1.11 and wish to bind a simple POJO to
> JNDI in jetty.xml using EnvEntry, however I get a config error on start up.
> The documentation says that you can use EnvEntry to bind arbitrary Pojos but
> does not provide an example. Any ideas?
>
> Regards,
>
> Avinder
>
>
> jetty.xml entry:
>
> <New class="org.mortbay.jetty.plus.naming.EnvEntry">
>   <Arg>Foo</Arg>
>   <Arg type="foo.Foo">
>      <New class="foo.Foo">
>      </New>
>   </Arg>
> </New>
>
> error:
> [INFO] Configuring Jetty from xml configuration file =
> C:\dev\java\projects\fooProject\jetty.xml
> 11:29:08 WARN   org.mortbay.log                     Config error at <New
> class="org.mortbay.jetty.plus.naming.EnvEntry"><Arg>Foo</Arg><Arg
> type="foo.Foo">
>      <New class="foo.Foo"/>
>   </Arg></New>
> [INFO] Jetty server exiting.
>
> class:
>
> package foo;
>
> public class Foo implements Serializable  {
>   private static final long serialVersionUID = 7051303218386995343L;
>   private String name = "Foo";
>
>   public Foo() {
>     super();
>     System.err.println("In Foo constructor.");
>   }
>
>   public Foo(String name) {
>     super();
>     this.name = name;
>     System.err.println("In Foo constructor.");
>   }
>
>   public void setName(String name) {
>     this.name = name;
>   }
>
>   public String getName() {
>     return name;
>   }
>
> }
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.