You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by William Blackburn <wj...@mac.com> on 2006/03/06 21:43:15 UTC

Web app and relative wdir property

I have been moving my test web app to the latest 3.0 snapshot (from  
2.0) and I've come across a problem. In my 2.0 webapp, I used the  
convention:

	rootDir="../wdir"

for this, as well as the install and deploy directories, in the  
container configuration, this resulted, as expected, in these  
directories created in the webapp's installation directory (i.e.: one  
dir up from WEB-INF). Unfortunately, after updating to 3.0, I get

Mar 6, 2006 12:05:53 PM org.springframework.web.context.ContextLoader  
initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error  
creating bean with name 'jbi' defined in ServletContext resource [/ 
WEB-INF/applicationContext.xml]: Initialization of bean failed;  
nested exception is javax.jbi.JBIException: Directory could not be  
created: /../wdir/defaultJBI
javax.jbi.JBIException: Directory could not be created: /../wdir/ 
defaultJBI
         at  
org.apache.servicemix.jbi.container.EnvironmentContext.buildDirectoryStr 
ucture(EnvironmentContext.java:546)
         at  
org.apache.servicemix.jbi.container.EnvironmentContext.init 
(EnvironmentContext.java:157)
         at org.apache.servicemix.jbi.container.JBIContainer.init 
(JBIContainer.java:488)


I noted a few diffs between EnvironmentContext from 2.0 to 3.0 but  
nothing that jumps out. Everything works if I fully specify the  
paths, the problem appears to be in resolving the relative  
references, the error message seems to indicate that the .. is not  
resolved, but I'm stumped as to why.

Anyone else run into this? Platform is OS X with Tomcat 5.5 and Java 1.5

Re: Web app and relative wdir property

Posted by Sandhu <ka...@gmail.com>.
Got similar problems on WinXp - temp solution was to give complete paths.
Need answer too.

William Blackburn wrote:
> I have been moving my test web app to the latest 3.0 snapshot (from  
> 2.0) and I've come across a problem. In my 2.0 webapp, I used the  
> convention:
> 
>     rootDir="../wdir"
> 
> for this, as well as the install and deploy directories, in the  
> container configuration, this resulted, as expected, in these  
> directories created in the webapp's installation directory (i.e.: one  
> dir up from WEB-INF). Unfortunately, after updating to 3.0, I get
> 
> Mar 6, 2006 12:05:53 PM org.springframework.web.context.ContextLoader  
> initWebApplicationContext
> SEVERE: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error  creating 
> bean with name 'jbi' defined in ServletContext resource [/ 
> WEB-INF/applicationContext.xml]: Initialization of bean failed;  nested 
> exception is javax.jbi.JBIException: Directory could not be  created: 
> /../wdir/defaultJBI
> javax.jbi.JBIException: Directory could not be created: /../wdir/ 
> defaultJBI
>         at  
> org.apache.servicemix.jbi.container.EnvironmentContext.buildDirectoryStr 
> ucture(EnvironmentContext.java:546)
>         at  org.apache.servicemix.jbi.container.EnvironmentContext.init 
> (EnvironmentContext.java:157)
>         at org.apache.servicemix.jbi.container.JBIContainer.init 
> (JBIContainer.java:488)
> 
> 
> I noted a few diffs between EnvironmentContext from 2.0 to 3.0 but  
> nothing that jumps out. Everything works if I fully specify the  paths, 
> the problem appears to be in resolving the relative  references, the 
> error message seems to indicate that the .. is not  resolved, but I'm 
> stumped as to why.
> 
> Anyone else run into this? Platform is OS X with Tomcat 5.5 and Java 1.5
> 


Re: Web app and relative wdir property

Posted by Guillaume Nodet <gn...@gmail.com>.
You can try something like that:

  <bean id="servletContext" class="
org.springframework.web.context.support.ServletContextFactoryBean" />
  <bean id="rootDir" class="org.springframework.web.util.WebUtils"
factory-method="getRealPath">
    <constructor-arg ref="servletContext" />
    <constructor-arg value="/wdir" />
  </bean>
  <bean id="installDir" class="org.springframework.web.util.WebUtils"
factory-method="getRealPath">
    <constructor-arg ref="servletContext" />
    <constructor-arg value="/install" />
  </bean>
  <bean id="deployDir" class="org.springframework.web.util.WebUtils"
factory-method="getRealPath">
    <constructor-arg ref="servletContext" />
    <constructor-arg value="/deploy" />
  </bean>

  <!-- the JBI container -->
  <sm:container spring:id="jbi"
      rootDir="#rootDir"
      useMBeanServer="true"
      createMBeanServer="true"
      installationDirPath="#installDir"
      deploymentDirPath="#deployDir"
      monitorInstallationDirectory="true"
      dumpStats="true"
      statsInterval="10"
      transactionManager="#transactionManager">

  </sm:container>


I'm sure there is a better solution, but at least, this one works
without any code modification.
You will need to do the same for the activemq broker, if any ...

Cheers,
Guillaume Nodet

On 3/6/06, William Blackburn <wj...@mac.com> wrote:
>
> I have been moving my test web app to the latest 3.0 snapshot (from
> 2.0) and I've come across a problem. In my 2.0 webapp, I used the
> convention:
>
>         rootDir="../wdir"
>
> for this, as well as the install and deploy directories, in the
> container configuration, this resulted, as expected, in these
> directories created in the webapp's installation directory (i.e.: one
> dir up from WEB-INF). Unfortunately, after updating to 3.0, I get
>
> Mar 6, 2006 12:05:53 PM org.springframework.web.context.ContextLoader
> initWebApplicationContext
> SEVERE: Context initialization failed
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'jbi' defined in ServletContext resource [/
> WEB-INF/applicationContext.xml]: Initialization of bean failed;
> nested exception is javax.jbi.JBIException: Directory could not be
> created: /../wdir/defaultJBI
> javax.jbi.JBIException: Directory could not be created: /../wdir/
> defaultJBI
>          at
> org.apache.servicemix.jbi.container.EnvironmentContext.buildDirectoryStr
> ucture(EnvironmentContext.java:546)
>          at
> org.apache.servicemix.jbi.container.EnvironmentContext.init
> (EnvironmentContext.java:157)
>          at org.apache.servicemix.jbi.container.JBIContainer.init
> (JBIContainer.java:488)
>
>
> I noted a few diffs between EnvironmentContext from 2.0 to 3.0 but
> nothing that jumps out. Everything works if I fully specify the
> paths, the problem appears to be in resolving the relative
> references, the error message seems to indicate that the .. is not
> resolved, but I'm stumped as to why.
>
> Anyone else run into this? Platform is OS X with Tomcat 5.5 and Java 1.5
>