geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Standalone deployment <cross-context> doesn't work
Date Wed, 22 Jul 2009 16:23:10 GMT
There are two possibilities I can think of right now:

1. Something is calling Environment.setApplicationProperties(null)  
which produces a NullPointerException before the System.out can tell  
you about it.  This seems unlikely but is easy to check with another  
System.out. I guess there might be a clearApplicationProperties()  
method also...

2. you have 2 classloaders loading the Environment class.  I don't  
really see how this would be happening either but again is pretty easy  
to check.

Code suggestions inline...

thanks
david jencks

On Jul 22, 2009, at 4:58 AM, vojdan_ wrote:

>
> Init.java:
> public void init(ServletConfig arg0) throws ServletException {
> ...........
>      inputStream = ctx.getResourceAsStream("/file.properties");
>      Utf8Properties utf8Properties = new Utf8Properties();
>      utf8Properties.load(inputStream);
>      ApplicationProperties applicationProperties = new
> ApplicationProperties();
>      ApplicationProperties.set(utf8Properties);
>      // let the environment know about the new application properties
>      Environment.setApplicationProperties(applicationProperties );
> }
>
>
> public class Environment {
> private static ApplicationProperties applicationProperties;
>
> public static void setApplicationProperties (ApplicationProperties
> applicationProperties) {
> 		 Environment.applicationProperties = applicationProperties;
>                 //here I print ot confirm it is intialized

System.out.println("set application properties called with" +  
applicationProperties);
System.out.println("Environment classloader during set:" +  
getClass().getClassLoader());
> 		 System.out.println("set application properties: " +
> Environment.applicationProperties.getCtxDesign());
> }
>
> public static String getDesignContext(){
System.out.println("Environment classloader during access:" +  
getClass().getClassLoader());
> 	return applicationProperties.getCtxDesign(); //exception thrown here
> }
>
> }
>
>
>
> The code should be ok because like I said everything works when  
> started on
> GEP, but if deployed as a standalone it doesn't work. I also tried  
> to deploy
> the application on GEP and then start the same server manually but no
> difference.
>
>
>
>
>
> I don't think you have a classloading problem, since you can get to
> the code in Environment just fine.
>
> I think the problem is that Environment.applicationContext is null.
> What is supposed to initialize  it?
>
> thanks
> david jencks
> -- 
> View this message in context: http://www.nabble.com/Standalone-deployment-%3Ccross-context%3E-doesn%27t-work-tp24591184s134p24604920.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>

Mime
View raw message