You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ph...@free.fr on 2014/11/21 15:38:57 UTC

Problem with base directory in Resource

Hello,

in my Apache 8 context.xml file, I have created the following resource:

<Resources>
		<PreResources 
			className="org.apache.catalina.webresources.DirResourceSet"
			base="/mnt/mynfsserver_img/" 
			webAppMount="/img" 
			internalPath="/img" />
</Resources>

where /mnt/mynfsserver_img is a mounted volume containing thousands of photos in sub-directories.

When I start Tomcat 8, I get the following error message:

-------------------------------------
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.DirResourceSet@6649bfd3]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:647)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 14 more
Caused by: java.lang.IllegalArgumentException: TODO-i18n: base/internalPath is not a directory
	at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:247)
	at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:134)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 16 more
--------------------------------------------

What am I doing wrong?

Many thanks.

Cheers,

Philippe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with base directory in Resource

Posted by Konstantin Kolinko <kn...@gmail.com>.
That IllegalStateException means that  (new
File("/mnt/mynfsserver_img", "/img")).isDirectory()  returned false.

In other words, the likely cause is that the path was not readable at
the time of the check.

Replacing PostResources by PreResources and vise versa will have no
effect on this.


2014-11-21 17:45 GMT+03:00  <ph...@free.fr>:
>
> I have solved the problem by replacing PostResources by PreResources (cf. http://mikusa.blogspot.fr/2014/07/tips-on-migrating-to-tomat-8-resources.html).
>
> Now I need to figure out how to use the webAppMount. Any suggestions?
>
> Philippe
>
>
>
> ----- Mail original -----
> De: phiroc@free.fr
> À: users@tomcat.apache.org
> Envoyé: Vendredi 21 Novembre 2014 15:38:57
> Objet: Problem with base directory in Resource
>
>
> Hello,
>
> in my Apache 8 context.xml file, I have created the following resource:
>
> <Resources>
>                 <PreResources
>                         className="org.apache.catalina.webresources.DirResourceSet"
>                         base="/mnt/mynfsserver_img/"
>                         webAppMount="/img"
>                         internalPath="/img" />
> </Resources>
>
> where /mnt/mynfsserver_img is a mounted volume containing thousands of photos in sub-directories.
>
> When I start Tomcat 8, I get the following error message:
>
> -------------------------------------
> Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.DirResourceSet@6649bfd3]
>         at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
>         at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:647)
>         at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
>         ... 14 more
> Caused by: java.lang.IllegalArgumentException: TODO-i18n: base/internalPath is not a directory
>         at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:247)
>         at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:134)
>         at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
>         ... 16 more
> --------------------------------------------
>
> What am I doing wrong?
>
> Many thanks.
>
> Cheers,
>
> Philippe
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with base directory in Resource

Posted by ph...@free.fr.
I figured it out.

Let say /mnt/mynfsserver_img/ contains an image called myimage.png.

If you create the below pre-resource in context.xml, you can access that image by typing http://localhost:8080/img/myimage.png.

Philippe

----- Mail original -----
De: phiroc@free.fr
À: "Tomcat Users List" <us...@tomcat.apache.org>
Envoyé: Vendredi 21 Novembre 2014 15:45:25
Objet: Re: Problem with base directory in Resource


I have solved the problem by replacing PostResources by PreResources (cf. http://mikusa.blogspot.fr/2014/07/tips-on-migrating-to-tomat-8-resources.html).

Now I need to figure out how to use the webAppMount. Any suggestions?

Philippe

 

----- Mail original -----
De: phiroc@free.fr
À: users@tomcat.apache.org
Envoyé: Vendredi 21 Novembre 2014 15:38:57
Objet: Problem with base directory in Resource


Hello,

in my Apache 8 context.xml file, I have created the following resource:

<Resources>
		<PreResources 
			className="org.apache.catalina.webresources.DirResourceSet"
			base="/mnt/mynfsserver_img/" 
			webAppMount="/img" 
			internalPath="/img" />
</Resources>

where /mnt/mynfsserver_img is a mounted volume containing thousands of photos in sub-directories.

When I start Tomcat 8, I get the following error message:

-------------------------------------
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.DirResourceSet@6649bfd3]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:647)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 14 more
Caused by: java.lang.IllegalArgumentException: TODO-i18n: base/internalPath is not a directory
	at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:247)
	at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:134)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 16 more
--------------------------------------------

What am I doing wrong?

Many thanks.

Cheers,

Philippe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problem with base directory in Resource

Posted by ph...@free.fr.
I have solved the problem by replacing PostResources by PreResources (cf. http://mikusa.blogspot.fr/2014/07/tips-on-migrating-to-tomat-8-resources.html).

Now I need to figure out how to use the webAppMount. Any suggestions?

Philippe

 

----- Mail original -----
De: phiroc@free.fr
À: users@tomcat.apache.org
Envoyé: Vendredi 21 Novembre 2014 15:38:57
Objet: Problem with base directory in Resource


Hello,

in my Apache 8 context.xml file, I have created the following resource:

<Resources>
		<PreResources 
			className="org.apache.catalina.webresources.DirResourceSet"
			base="/mnt/mynfsserver_img/" 
			webAppMount="/img" 
			internalPath="/img" />
</Resources>

where /mnt/mynfsserver_img is a mounted volume containing thousands of photos in sub-directories.

When I start Tomcat 8, I get the following error message:

-------------------------------------
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.DirResourceSet@6649bfd3]
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
	at org.apache.catalina.webresources.StandardRoot.initInternal(StandardRoot.java:647)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 14 more
Caused by: java.lang.IllegalArgumentException: TODO-i18n: base/internalPath is not a directory
	at org.apache.catalina.webresources.DirResourceSet.checkType(DirResourceSet.java:247)
	at org.apache.catalina.webresources.AbstractFileResourceSet.initInternal(AbstractFileResourceSet.java:134)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	... 16 more
--------------------------------------------

What am I doing wrong?

Many thanks.

Cheers,

Philippe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org