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.

Reply via email to