You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Derek Scherger <de...@transcanada.com> on 2003/06/18 21:23:56 UTC
entity references in struts config xml
Does anyone know how to get entity references to work with struts 1.0.2
under tomcat 4.1.24?
The first few lines of my struts-config.xml look like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
[<!ENTITY barfoo SYSTEM "barfoo.xml">]
>
<struts-config>
&barfoo;
</struts-config>
When it comes to processing the &barfoo; entity reference it fails with
a file not found exception. Running tomcat with strace under linux I can
see it trying to find barfoo.xml in the tomcat/bin directory rather than
under the appropriate context's WEB-INF directory. Note that the same
entity reference in web.xml works fine (i.e. it looks for barfoo.xml
under the appropriate context's WEB-INF directory which is where I would
expect a relative reference to be relative to).
Using an absolute reference for the file isn't really a solution because
the environment this app has to run in is a mix of linux, windows and
solaris. (i.e.
"C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml"
won't work on all platforms that is has to work on.).
Thanks for any info!
Cheers,
Derek
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: entity references in struts config xml
Posted by Derek Scherger <de...@transcanada.com>.
James Mitchell wrote:
>On Wednesday 18 June 2003 17:14, Derek Scherger wrote:
>
>
>>James Mitchell wrote:
>>
>>
>>>On Wednesday 18 June 2003 15:23, Derek Scherger wrote:
>>>
>>>
>>>>Does anyone know how to get entity references to work with struts 1.0.2
>>>>under tomcat 4.1.24?
>>>>
>>>>The first few lines of my struts-config.xml look like this:
>>>>
>>>><?xml version="1.0" encoding="ISO-8859-1" ?>
>>>><!DOCTYPE struts-config PUBLIC
>>>> "-//Apache Software Foundation//DTD Struts Configuration
>>>>1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
>>>>[<!ENTITY barfoo SYSTEM "barfoo.xml">]
>>>>
>>>>
>>>><struts-config>
>>>> &barfoo;
>>>></struts-config>
>>>>
>>>>When it comes to processing the &barfoo; entity reference it fails with
>>>>a file not found exception. Running tomcat with strace under linux I can
>>>>see it trying to find barfoo.xml in the tomcat/bin directory rather than
>>>>under the appropriate context's WEB-INF directory. Note that the same
>>>>entity reference in web.xml works fine (i.e. it looks for barfoo.xml
>>>>under the appropriate context's WEB-INF directory which is where I would
>>>>expect a relative reference to be relative to).
>>>>
>>>>Using an absolute reference for the file isn't really a solution because
>>>>the environment this app has to run in is a mix of linux, windows and
>>>>solaris. (i.e.
>>>>"C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml"
>>>>won't work on all platforms that is has to work on.).
>>>>
>>>>
>>>While not an exact solution to your dilema, why don't you just use
>>>multiple config files?
>>>
>>>
>>I'm not entirely sure what you mean by this, it might only be available
>>in struts 1.1.
>>The problem we have at the moment is that we have multiple web apps that
>>share
>>a bunch of common struts (and tiles) configuration. Rather than having
>>multiple copies
>>of this shared configuration in various config files I'd like to have on
>>copy of the shared
>>stuff referenced by the various config files.
>>
>>
>
>Yes, I undertand your requirements. There are patches available to enable
>backward compatibility to Struts 1.0. See http://jamesholmes.com/struts/ for
>complete details.
>
>Should you choose to use the Struts Console (also available from that same
>url), it doesn't work with entity refs. That's one of the items standing in
>the way of supporting OJB configuration in the near future.
>
>Good luck with whatever you choose.
>
I've just had a look at the url you mention above and it does seem to
indicate that
entity refs in the struts config files should work. Before I go patching
to get multiple
config files to work with 1.0.2 I'd like to get to the bottom of the
problem I have
using entity refs. We're not using the struts console so I'm not too
worried about
breaking that.
The problem that I have is that entity refs are relative to tomcat bin
rather than the
context's WEB-INF.
BTW, thanks for the quick responses!
Cheers,
Derek
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: entity references in struts config xml
Posted by James Mitchell <jm...@apache.org>.
On Wednesday 18 June 2003 17:14, Derek Scherger wrote:
> James Mitchell wrote:
> >On Wednesday 18 June 2003 15:23, Derek Scherger wrote:
> >>Does anyone know how to get entity references to work with struts 1.0.2
> >>under tomcat 4.1.24?
> >>
> >>The first few lines of my struts-config.xml look like this:
> >>
> >><?xml version="1.0" encoding="ISO-8859-1" ?>
> >><!DOCTYPE struts-config PUBLIC
> >> "-//Apache Software Foundation//DTD Struts Configuration
> >> 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
> >> [<!ENTITY barfoo SYSTEM "barfoo.xml">]
> >>
> >>
> >><struts-config>
> >> &barfoo;
> >></struts-config>
> >>
> >>When it comes to processing the &barfoo; entity reference it fails with
> >>a file not found exception. Running tomcat with strace under linux I can
> >>see it trying to find barfoo.xml in the tomcat/bin directory rather than
> >>under the appropriate context's WEB-INF directory. Note that the same
> >>entity reference in web.xml works fine (i.e. it looks for barfoo.xml
> >>under the appropriate context's WEB-INF directory which is where I would
> >>expect a relative reference to be relative to).
> >>
> >>Using an absolute reference for the file isn't really a solution because
> >>the environment this app has to run in is a mix of linux, windows and
> >>solaris. (i.e.
> >>"C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml"
> >>won't work on all platforms that is has to work on.).
> >
> >While not an exact solution to your dilema, why don't you just use
> > multiple config files?
>
> I'm not entirely sure what you mean by this, it might only be available
> in struts 1.1.
> The problem we have at the moment is that we have multiple web apps that
> share
> a bunch of common struts (and tiles) configuration. Rather than having
> multiple copies
> of this shared configuration in various config files I'd like to have on
> copy of the shared
> stuff referenced by the various config files.
Yes, I undertand your requirements. There are patches available to enable
backward compatibility to Struts 1.0. See http://jamesholmes.com/struts/ for
complete details.
Should you choose to use the Struts Console (also available from that same
url), it doesn't work with entity refs. That's one of the items standing in
the way of supporting OJB configuration in the near future.
Good luck with whatever you choose.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: entity references in struts config xml
Posted by Derek Scherger <de...@transcanada.com>.
James Mitchell wrote:
>On Wednesday 18 June 2003 15:23, Derek Scherger wrote:
>
>
>>Does anyone know how to get entity references to work with struts 1.0.2
>>under tomcat 4.1.24?
>>
>>The first few lines of my struts-config.xml look like this:
>>
>><?xml version="1.0" encoding="ISO-8859-1" ?>
>><!DOCTYPE struts-config PUBLIC
>> "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
>> "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
>>[<!ENTITY barfoo SYSTEM "barfoo.xml">]
>>
>>
>><struts-config>
>> &barfoo;
>></struts-config>
>>
>>When it comes to processing the &barfoo; entity reference it fails with
>>a file not found exception. Running tomcat with strace under linux I can
>>see it trying to find barfoo.xml in the tomcat/bin directory rather than
>>under the appropriate context's WEB-INF directory. Note that the same
>>entity reference in web.xml works fine (i.e. it looks for barfoo.xml
>>under the appropriate context's WEB-INF directory which is where I would
>>expect a relative reference to be relative to).
>>
>>Using an absolute reference for the file isn't really a solution because
>>the environment this app has to run in is a mix of linux, windows and
>>solaris. (i.e.
>>"C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml"
>>won't work on all platforms that is has to work on.).
>>
>>
>
>While not an exact solution to your dilema, why don't you just use multiple
>config files?
>
>
I'm not entirely sure what you mean by this, it might only be available
in struts 1.1.
The problem we have at the moment is that we have multiple web apps that
share
a bunch of common struts (and tiles) configuration. Rather than having
multiple copies
of this shared configuration in various config files I'd like to have on
copy of the shared
stuff referenced by the various config files.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: entity references in struts config xml
Posted by James Mitchell <jm...@apache.org>.
On Wednesday 18 June 2003 15:23, Derek Scherger wrote:
> Does anyone know how to get entity references to work with struts 1.0.2
> under tomcat 4.1.24?
>
> The first few lines of my struts-config.xml look like this:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <!DOCTYPE struts-config PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
> "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd"
> [<!ENTITY barfoo SYSTEM "barfoo.xml">]
>
>
> <struts-config>
> &barfoo;
> </struts-config>
>
> When it comes to processing the &barfoo; entity reference it fails with
> a file not found exception. Running tomcat with strace under linux I can
> see it trying to find barfoo.xml in the tomcat/bin directory rather than
> under the appropriate context's WEB-INF directory. Note that the same
> entity reference in web.xml works fine (i.e. it looks for barfoo.xml
> under the appropriate context's WEB-INF directory which is where I would
> expect a relative reference to be relative to).
>
> Using an absolute reference for the file isn't really a solution because
> the environment this app has to run in is a mix of linux, windows and
> solaris. (i.e.
> "C:\\foo\\bar\\tomcat\\webapps\\foobarcontext\\WEB-INF\\barfoo.xml"
> won't work on all platforms that is has to work on.).
While not an exact solution to your dilema, why don't you just use multiple
config files?
>
> Thanks for any info!
>
> Cheers,
> Derek
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
770-822-3359
AIM:jmitchtx
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org