You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Gordon <ad...@readytalk.com> on 2008/04/16 17:33:45 UTC

Validation of Struts XML files

Last night, our company had a maintenance window whereby Internet access 
was shut off from our office to the outside world.  During that time I 
was doing development and attempted to start up our web app in a 
development environment.

I've not seen this error in almost 2 years but it's apparently back:

[org.apache.struts.action.ActionServlet] [handleConfigException] Parsing 
error processing resource path /WEB-INF/struts-optout.xml
java.net.UnknownHostException: jakarta.apache.org
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
    at java.net.Socket.connect(Socket.java:520)
    at java.net.Socket.connect(Socket.java:470)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
    ...*snip*...

I remember this well.  The problem is that struts-optout.xml has the 
DOCTYPE of:

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

But, the struts-config_1_3.dtd is not in the struts.jar file (we're 
using Struts 1.2.9) so, apparently in order to validate that the XML 
file is well-formed at webapp start up time, Tomcat feels the need to go 
out and retrieve this DTD - only it can't because Internet access was 
down.  The problem is greatly exacerbated by the fact that Tomcat stops 
processing the loading of struts modules when this one fails essentially 
rendering the web app useless.

I seem to recall playing with turning validation of XML files off, but 
that not being a sufficient solution so I tried adding the DTD into the 
struts JAR file in the same location as the other DTDs:  
org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but 
that didn't work.

We need to be able to find a solution to where we can host the DTDs 
locally and do not have to rely on a 3rd party server being up in order 
to deploy our web application.  I seem to recall this being an issue 
with the W3C (especally w.r.t. [X]HTML validation in that it results in 
a ton of unnecessary network calls to retrieve DTDs for validation 
rather than web servers hosting the DTDs locally.

I'm sure I'm not the only one to have seen this so any help to resolve 
this would be greatly appreciated.  Thanks.

-- adam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Validation of Struts XML files

Posted by Laurie Harper <la...@holoweb.net>.
Looks like a simple versioning error to me; you're doctype declaration:

 > <!DOCTYPE struts-config PUBLIC
 >          "-//Apache Software Foundation//DTD Struts Configuration 
1.3//EN"
 >          "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

But you said:

 > But, the struts-config_1_3.dtd is not in the struts.jar file (we're
 > using Struts 1.2.9)

I wouldn't expect 1.2.9 to contain a 1.3 DTD... Either upgrade to Struts 
  1.3.9 or use the DTD corresponding to the release you are on:

  <!DOCTYPE struts-config PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
        "http://struts.apache.org/dtds/struts-config_1_2.dtd">

L.

Adam Gordon wrote:
> Last night, our company had a maintenance window whereby Internet access 
> was shut off from our office to the outside world.  During that time I 
> was doing development and attempted to start up our web app in a 
> development environment.
> 
> I've not seen this error in almost 2 years but it's apparently back:
> 
> [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing 
> error processing resource path /WEB-INF/struts-optout.xml
> java.net.UnknownHostException: jakarta.apache.org
>    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
>    at java.net.Socket.connect(Socket.java:520)
>    at java.net.Socket.connect(Socket.java:470)
>    at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
>    ...*snip*...
> 
> I remember this well.  The problem is that struts-optout.xml has the 
> DOCTYPE of:
> 
> <!DOCTYPE struts-config PUBLIC
>          "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
>          "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
> 
> But, the struts-config_1_3.dtd is not in the struts.jar file (we're 
> using Struts 1.2.9) so, apparently in order to validate that the XML 
> file is well-formed at webapp start up time, Tomcat feels the need to go 
> out and retrieve this DTD - only it can't because Internet access was 
> down.  The problem is greatly exacerbated by the fact that Tomcat stops 
> processing the loading of struts modules when this one fails essentially 
> rendering the web app useless.
> 
> I seem to recall playing with turning validation of XML files off, but 
> that not being a sufficient solution so I tried adding the DTD into the 
> struts JAR file in the same location as the other DTDs:  
> org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but 
> that didn't work.
> 
> We need to be able to find a solution to where we can host the DTDs 
> locally and do not have to rely on a 3rd party server being up in order 
> to deploy our web application.  I seem to recall this being an issue 
> with the W3C (especally w.r.t. [X]HTML validation in that it results in 
> a ton of unnecessary network calls to retrieve DTDs for validation 
> rather than web servers hosting the DTDs locally.
> 
> I'm sure I'm not the only one to have seen this so any help to resolve 
> this would be greatly appreciated.  Thanks.
> 
> -- adam


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Text formatting

Posted by Dave Newton <ne...@yahoo.com>.
--- Dave Newton <ne...@yahoo.com> wrote:
> --- Adam Gordon <ad...@readytalk.com> wrote:
> > I'm sure this was totally unintentional and you did it to simply get the 
> > email address of the mailing list, but thread hijacking is generally 
> > frowned upon in support mailing lists.
> 
> He started the thread, and it's about formatting (via the <s:text...> tag).

Just realized I viewed this in a non-threaded view and I didn't check the
headers, so it might have been hijacked; sorry.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Text formatting

Posted by Dave Newton <ne...@yahoo.com>.
--- Adam Gordon <ad...@readytalk.com> wrote:
> I'm sure this was totally unintentional and you did it to simply get the 
> email address of the mailing list, but thread hijacking is generally 
> frowned upon in support mailing lists.

He started the thread, and it's about formatting (via the <s:text...> tag).

Dave

> Hartrich, James CTR USTRANSCOM J6 wrote:
> > Struts2.0.9
> > Has anyone successfully formatted a number 5557777 into 555-7777.
> >
> >
> > MyAction.properties:  format.telephone={0,number,###-####}
> > 		
> > My.jsp:	<s:action name="myaction"/>
> > 		<s:text name="format.telephone">
> > 			<s:param name="value" value="myTeleValue"/>
> > 		</s:text>
> >
> > The only output rendered to the jsp page after numerous attempts is the
> > string "format.telephone".
> >
> > Thanks
> > James
> >   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Text formatting

Posted by Adam Gordon <ad...@readytalk.com>.
James-

I'm sure this was totally unintentional and you did it to simply get the 
email address of the mailing list, but thread hijacking is generally 
frowned upon in support mailing lists.

--adam

Hartrich, James CTR USTRANSCOM J6 wrote:
> Struts2.0.9
> Has anyone successfully formatted a number 5557777 into 555-7777.
>
>
> MyAction.properties:  format.telephone={0,number,###-####}
> 		
> My.jsp:	<s:action name="myaction"/>
> 		<s:text name="format.telephone">
> 			<s:param name="value" value="myTeleValue"/>
> 		</s:text>
>
> The only output rendered to the jsp page after numerous attempts is the
> string "format.telephone".
>
> Thanks
> James
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Text formatting

Posted by Dave Newton <ne...@yahoo.com>.
--- "Hartrich, James CTR USTRANSCOM J6" wrote:
> Has anyone successfully formatted a number 5557777 into 555-7777.
> 
> MyAction.properties:  format.telephone={0,number,###-####}
> 		
> My.jsp:	<s:action name="myaction"/>
> 		<s:text name="format.telephone">
> 			<s:param name="value" value="myTeleValue"/>
> 		</s:text>
> 
> The only output rendered to the jsp page after numerous attempts is the
> string "format.telephone".

I'm not aware that you can format numbers like that. AFAIK the number
formatting follows the decimal formatting Java rules [1] where things like
the "-" character refer to the default negative number prefix.

Phone numbers aren't numbers (add two together?!), they're strings. Or should
be; if they're not you may want to reconsider.

Dave

[1] http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Text formatting

Posted by "Hartrich, James CTR USTRANSCOM J6" <Ja...@ustranscom.mil>.
Struts2.0.9
Has anyone successfully formatted a number 5557777 into 555-7777.


MyAction.properties:  format.telephone={0,number,###-####}
		
My.jsp:	<s:action name="myaction"/>
		<s:text name="format.telephone">
			<s:param name="value" value="myTeleValue"/>
		</s:text>

The only output rendered to the jsp page after numerous attempts is the
string "format.telephone".

Thanks
James

Re: Validation of Struts XML files

Posted by Adam Gordon <ad...@readytalk.com>.
Well, the DTD files are identical, only the URLs are different so I 
don't expect the outcome to be any different....

And it turns out it's not.  Changing the URL does not prevent Tomcat 
from going out and trying to retrieve the DTD even though I've added it 
to the JAR file.

Any other ideas?

--adam

Dave Newton wrote:
> Does it work if you use the DTD it says to use?
>
> <!DOCTYPE struts-config PUBLIC
>        "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
>        "http://struts.apache.org/dtds/struts-config_1_3.dtd">
>
> Dave
>
> --- Adam Gordon <ad...@readytalk.com> wrote:
>
>   
>> Last night, our company had a maintenance window whereby Internet access 
>> was shut off from our office to the outside world.  During that time I 
>> was doing development and attempted to start up our web app in a 
>> development environment.
>>
>> I've not seen this error in almost 2 years but it's apparently back:
>>
>> [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing 
>> error processing resource path /WEB-INF/struts-optout.xml
>> java.net.UnknownHostException: jakarta.apache.org
>>     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
>>     at java.net.Socket.connect(Socket.java:520)
>>     at java.net.Socket.connect(Socket.java:470)
>>     at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
>>     ...*snip*...
>>
>> I remember this well.  The problem is that struts-optout.xml has the 
>> DOCTYPE of:
>>
>> <!DOCTYPE struts-config PUBLIC
>>           "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
>>           "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
>>
>> But, the struts-config_1_3.dtd is not in the struts.jar file (we're 
>> using Struts 1.2.9) so, apparently in order to validate that the XML 
>> file is well-formed at webapp start up time, Tomcat feels the need to go 
>> out and retrieve this DTD - only it can't because Internet access was 
>> down.  The problem is greatly exacerbated by the fact that Tomcat stops 
>> processing the loading of struts modules when this one fails essentially 
>> rendering the web app useless.
>>
>> I seem to recall playing with turning validation of XML files off, but 
>> that not being a sufficient solution so I tried adding the DTD into the 
>> struts JAR file in the same location as the other DTDs:  
>> org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but 
>> that didn't work.
>>
>> We need to be able to find a solution to where we can host the DTDs 
>> locally and do not have to rely on a 3rd party server being up in order 
>> to deploy our web application.  I seem to recall this being an issue 
>> with the W3C (especally w.r.t. [X]HTML validation in that it results in 
>> a ton of unnecessary network calls to retrieve DTDs for validation 
>> rather than web servers hosting the DTDs locally.
>>
>> I'm sure I'm not the only one to have seen this so any help to resolve 
>> this would be greatly appreciated.  Thanks.
>>
>> -- adam
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Validation of Struts XML files

Posted by Dave Newton <ne...@yahoo.com>.
Does it work if you use the DTD it says to use?

<!DOCTYPE struts-config PUBLIC
       "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
       "http://struts.apache.org/dtds/struts-config_1_3.dtd">

Dave

--- Adam Gordon <ad...@readytalk.com> wrote:

> Last night, our company had a maintenance window whereby Internet access 
> was shut off from our office to the outside world.  During that time I 
> was doing development and attempted to start up our web app in a 
> development environment.
> 
> I've not seen this error in almost 2 years but it's apparently back:
> 
> [org.apache.struts.action.ActionServlet] [handleConfigException] Parsing 
> error processing resource path /WEB-INF/struts-optout.xml
> java.net.UnknownHostException: jakarta.apache.org
>     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
>     at java.net.Socket.connect(Socket.java:520)
>     at java.net.Socket.connect(Socket.java:470)
>     at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
>     ...*snip*...
> 
> I remember this well.  The problem is that struts-optout.xml has the 
> DOCTYPE of:
> 
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">
> 
> But, the struts-config_1_3.dtd is not in the struts.jar file (we're 
> using Struts 1.2.9) so, apparently in order to validate that the XML 
> file is well-formed at webapp start up time, Tomcat feels the need to go 
> out and retrieve this DTD - only it can't because Internet access was 
> down.  The problem is greatly exacerbated by the fact that Tomcat stops 
> processing the loading of struts modules when this one fails essentially 
> rendering the web app useless.
> 
> I seem to recall playing with turning validation of XML files off, but 
> that not being a sufficient solution so I tried adding the DTD into the 
> struts JAR file in the same location as the other DTDs:  
> org/apache/struts/resources/struts-config_1_x.dtd (where x=0,1,2) but 
> that didn't work.
> 
> We need to be able to find a solution to where we can host the DTDs 
> locally and do not have to rely on a 3rd party server being up in order 
> to deploy our web application.  I seem to recall this being an issue 
> with the W3C (especally w.r.t. [X]HTML validation in that it results in 
> a ton of unnecessary network calls to retrieve DTDs for validation 
> rather than web servers hosting the DTDs locally.
> 
> I'm sure I'm not the only one to have seen this so any help to resolve 
> this would be greatly appreciated.  Thanks.
> 
> -- adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org