开发者

Errors starting up Tomcat - External parameter entity "%[dtd];""has characters after markup

I am having an error which I cannot figure out.

Basically, NOTHING开发者_如何学JAVA has changed on the web app that is running (apart from maybe an influx of data). And it has suddenly died.

When going to the site, I see a HTTP Status 500 error, with a NullPointerException. I think the reason for this, is the previous error in my localhost log;

SEVERE: Servlet threw load() exception javax.servlet.UnavailableException: org.xml.sax.SAXParseException: External parameter entity "%[dtd];" has characters after markup. at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4458) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:583) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

It made me think something is wrong with my struts-config.xml, but this hasnt changed at all in about 2 years and has been working fine.

Any ideas?


Your struts-config.xml file refers to a remote DTD located in the jakarta.apache.org site. While the location is valid, it might be the case that attempts to download and use the DTD by the parser have failed, presumably due to a proxy that filters outgoing traffic and returns invalid content for a DTD.

You could download the DTD and host it in your own environment, and have the struts-config.xml file use this new location, as demonstrated below:

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

where example-org.com refers to a local web server.

You can also use file URIs instead, to refer to the DTD hosted on a local directory:

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "file:///tmp/struts-config_1_2.dtd">

which would work when you place the struts-config_1_2.dtd file in the /tmp directory of the Tomcat host; you'll need to ensure that Tomcat can read this file.


In my case the [ERROR] External parameter entity "%(null);" has characters after markup was cased by a missing "!" at the beginning of the ATTLIST tag. It was a typo in the provided DTD schema. I had this:

 <ATTLIST btag id CDATA #REQUIRED>

and the solution was adding the "!" simply:

 <!ATTLIST btag id CDATA #REQUIRED>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜