Eclipse Content is not allowed in prolog

前端 未结 14 1751
抹茶落季
抹茶落季 2021-01-07 22:32

I\'m having trouble opening my main in my eclipse project. It keeps coming up with:

\"content is not allowed in prolog\"

I haven\'t altered my code or anythi

相关标签:
14条回答
  • 2021-01-07 23:02

    This error is generated during parsing of an XML document. Here is one writeup:

    http://www.mkyong.com/java/sax-error-content-is-not-allowed-in-prolog/

    You didn't provide sufficient information in your question to know which file might be corrupted, but search for xml files in your project and see if they look ok.

    0 讨论(0)
  • 2021-01-07 23:02

    In my case I was seeing those error in java classes i.e. NOT XML and, the problem was related to a hidden file called .springBeans in the main project directory. I had a section "configs" and "autoconfigs" like:

    java:org.DDDDDDDDDD.config.PersistenceConfig

    java:org.DDDDDDDDDD.core.Application

    When i moved everything to autoconfigs it all worked for me

    0 讨论(0)
  • 2021-01-07 23:03

    I had a similar issue and wanted to make a note, in case other had the same root cause that I did.

    My issue was related to the xsi:schemaLocation. The url stated was no longer being served. Via googling, I got a copy of the actual xsd file, which I included locally then updated the reference. This solved my issue.

    e.g. http://dozer.sourceforge.net/schema/beanmapping.xsd became beanmapping.xsd in the snippet below, after adding the .xsd file to the same folder.

    <?xml version="1.0" encoding="UTF-8"?>
    <mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://dozer.sourceforge.net beanmapping.xsd">
    
    0 讨论(0)
  • 2021-01-07 23:04

    Check: that you have no any additional wrong text before in the beginning of file.

    0 讨论(0)
  • 2021-01-07 23:05

    In my case, server.xml got corrupted.

    Go to pivotal/tomcat server location.

    Path : base-instance\conf File Name: server.xml

    So i tried replacing below content in that file and it worked fine.

    Sample content:-

    <?xml version="1.0" encoding="UTF-8"?>
    <Server port="${base.shutdown.port}" shutdown="SHUTDOWN">
        <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
        <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
        <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
        <Listener className="com.springsource.tcserver.serviceability.deploy.TcContainerDeployer"/>
        <Listener accessFile="${catalina.base}/conf/jmxremote.access" address="127.0.0.1" authenticate="true" className="com.springsource.tcserver.serviceability.rmi.JmxSocketListener" passwordFile="${catalina.base}/conf/jmxremote.password" port="${base.jmx.port}" useSSL="false"/>
        <GlobalNamingResources>
            <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
        </GlobalNamingResources>
        <Service name="Catalina">
            <Executor maxThreads="300" minSpareThreads="50" name="tomcatThreadPool" namePrefix="tomcat-http--"/>
            <Engine defaultHost="localhost" name="Catalina">
                <Realm className="org.apache.catalina.realm.LockOutRealm">
                    <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
                </Realm>
                <Host appBase="webapps" autoDeploy="true" deployOnStartup="true" deployXML="true" name="localhost" unpackWARs="true">
                    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/>
                </Host>
            </Engine>
            <Connector acceptCount="100" connectionTimeout="20000" executor="tomcatThreadPool" maxKeepAliveRequests="15" port="${nio.http.port}" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="${nio.https.port}"/>
        </Service>
    </Server>
    
    0 讨论(0)
  • 2021-01-07 23:05

    I had the same problem, It may be because of XML parser issue, I restarted the eclipse it started working fine.

    0 讨论(0)
提交回复
热议问题