tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s0dz <garrett.mct...@gmail.com>
Subject Re: Custom ".properties" file
Date Thu, 12 Jul 2012 18:42:10 GMT
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
View raw message