You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by ihunter <ih...@hotmail.com> on 2014/03/13 15:26:14 UTC

Re: Problems loading context.xml with a LifecycleListener

I've followed the advice from Romain about trying to use place holders, and
set up a LifecycleListener (see 2 posts down).

However, whenever I try to load context.xml with my listener in, it is
either getting ClassNotFoundException (I assume because its in the wrong
place for the right ClassLoader), or it is apparently ignored.

So I am guessing that context.xml for my app is not being loaded.

I've attached a simple project which should print out stuff when
constructing or using my Listener. Currently the context.xml ends up in
WEB-INF/classes/META-INF whichI *think* is the correct place.

Can some one please take a look?

Many Thanks
Ian
OpenEjbDemoProject.zip
<http://openejb.979440.n4.nabble.com/file/n4668187/OpenEjbDemoProject.zip>  



--
View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668187.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problems loading context.xml with a LifecycleListener

Posted by Romain Manni-Bucau <rm...@gmail.com>.
well i expected more this workflow for people want to help you:

git clone http://github.com/xxx/yyyy
cd yyyy
mvn clean package tomee:run
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-03-14 12:04 GMT+01:00 ihunter <ih...@hotmail.com>:
> Sure its in this thread already. Current 'location' seems to indicate that
> context.xml is ignored. If I move it to /MET-INF then ASAIR it throws NPE -
> I assumed that its a class loader 'issue'.
>
> HTH
> Ian Hunter
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668206.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problems loading context.xml with a LifecycleListener

Posted by ihunter <ih...@hotmail.com>.
Sure its in this thread already. Current 'location' seems to indicate that
context.xml is ignored. If I move it to /MET-INF then ASAIR it throws NPE -
I assumed that its a class loader 'issue'.

HTH
Ian Hunter



--
View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668206.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problems loading context.xml with a LifecycleListener

Posted by Romain Manni-Bucau <rm...@gmail.com>.
classnotfound  doesn't make sense here, can you reproduce it in a
sample you share?
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-03-13 16:28 GMT+01:00 ihunter <ih...@hotmail.com>:
> Yes, if I place it there, for me I get 'ClassNotFound' for my Listener. So
> what I'm trying to achieve (as per Romains suggestion) is to load a Listener
> which can then inject DB properties acquired from a known file.
>
> He also suggested creating a custom DataSourceCreator. If I cant use
> context.xml, any pointers to examples of doing this would be really
> appreciated.
>
> Many Thx
> Ian Hunter
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668191.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problems loading context.xml with a LifecycleListener

Posted by ihunter <ih...@hotmail.com>.
Yes, if I place it there, for me I get 'ClassNotFound' for my Listener. So
what I'm trying to achieve (as per Romains suggestion) is to load a Listener
which can then inject DB properties acquired from a known file.

He also suggested creating a custom DataSourceCreator. If I cant use
context.xml, any pointers to examples of doing this would be really
appreciated.

Many Thx
Ian Hunter



--
View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668191.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Problems loading context.xml with a LifecycleListener

Posted by Trevor Stevens <ts...@me.com>.
Are you talking about a Tomcat context file? I believe it should be located at /META-INF/context.xml and not /WEB-INF/classes/META-INF/context.xml.

Trevor Stevens
tstevens@me.com


On Mar 13, 2014, at 10:26 AM, ihunter <ih...@hotmail.com> wrote:

> I've followed the advice from Romain about trying to use place holders, and
> set up a LifecycleListener (see 2 posts down).
> 
> However, whenever I try to load context.xml with my listener in, it is
> either getting ClassNotFoundException (I assume because its in the wrong
> place for the right ClassLoader), or it is apparently ignored.
> 
> So I am guessing that context.xml for my app is not being loaded.
> 
> I've attached a simple project which should print out stuff when
> constructing or using my Listener. Currently the context.xml ends up in
> WEB-INF/classes/META-INF whichI *think* is the correct place.
> 
> Can some one please take a look?
> 
> Many Thanks
> Ian
> OpenEjbDemoProject.zip
> <http://openejb.979440.n4.nabble.com/file/n4668187/OpenEjbDemoProject.zip>  
> 
> 
> 
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Question-on-DataSources-Encryption-tp4668111p4668187.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.