tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Custom ".properties" file
Date Thu, 12 Jul 2012 19:05:17 GMT
hmm,

can you print getParent() and getURLs() too please?

the appclassloader surprises me a bit, means you are in embedded mode and
the class is already loaded in appclassloader

- Romain


2012/7/12 s0dz <garrett.mctear@gmail.com>

> Depending on where the
> "System.out.println(Thread.currentThread().getContextClassLoader());" was
> affected the output.  Here is the code used:
>
> package com.communitect.ejb.business;
>
> import java.io.IOException;
> import java.io.InputStream;
> import java.util.Properties;
> import javax.ejb.MessageDriven;
> import javax.jms.Message;
> import javax.jms.MessageListener;
>
> @MessageDriven( mappedName = "business.DirectMessage" )
> public class DirectMessage implements MessageListener
> {
>         static
>         {
>                 System.out.println("TCCL: ");
>
> System.out.println("********************************************");
>
> System.out.println(Thread.currentThread().getContextClassLoader());
>
> System.out.println("********************************************");
>         }
>
>     @Override
>     public void onMessage( Message message )
>     {
>                         try
>                         {
>                                 System.out.println("TCCL: ");
>
> System.out.println("********************************************");
>
> System.out.println(Thread.currentThread().getContextClassLoader());
>
> System.out.println("********************************************");
>
>         Properties p = new Properties();
>         InputStream is =
> Thread.currentThread().getContextClassLoader().getResourceAsStream(
> "common.properties" );
>         p.load(is);
>         System.out.println(p.getProperty( "myPropertyKey" ));
>                         }
>                         catch( IOException e )
>                         {
>                                 System.out.println( e );
>                         }
>     }
> }
>
> From the static block:
>
> TCCL:
> ********************************************
> *sun.misc.Launcher$AppClassLoader@5acac268*
> ********************************************
>
> From the onMessage():
>
> TCCL:
> ********************************************
> *java.net.URLClassLoader@2ecc5436*
> ********************************************
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Custom-properties-file-tp4656190p4656258.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message