context.xml not parseable and valid

Discussion in 'XML' started by Thufir Hawat, Feb 26, 2009.

  1. Thufir Hawat

    Thufir Hawat Guest

    Followups to ?


    Previously, the context.xml file was:



    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/Assignment"/>



    However, a tutorial suggests modifying it, along the lines of:
    http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-
    howto.html



    Which gives run-time errors.



    Apparently there's a problem with:


    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/Assignment">
    <Resource name="jdbc/BEATLES" auth="Container"
    type="javax.sql.DataSource"
    maxActive="20" maxIdle="30" maxWait="10000"
    username="username" password="password"
    driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
    url="jdbc:sqlserver://
    j2ee.ca:1433;databaseName=jspweb;selectMethod=cursor;"/>
    </Context>




    Netbeans says:

    XML validation started.

    Checking file:/home/thufir/NetBeansProjects/Assignment/web/META-INF/
    context.xml...
    The processing instruction target matching "[xX][mM][lL]" is not allowed.
    [2]
    XML validation finished.



    However, apparently it's not possible to create a DTD (or schema, I
    imagine) for context.xml:

    http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q10



    The runtime error:



    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    library-inclusion-in-archive:
    library-inclusion-in-manifest:
    compile:
    compile-jsps:
    [Fatal Error] :2:6: The processing instruction target matching "[xX][mM]
    [lL]" is not allowed.
    Deployment error:
    Tomcat configuration file /home/thufir/NetBeansProjects/Assignment/web/
    META-INF/context.xml seems to be broken. Please make sure it is parseable
    and valid.
    See the server log for details.
    at
    org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy
    (Deployment.java:166)
    at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
    at org.apache.tools.ant.UnknownElement.execute
    (UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor131.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke
    (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute
    (DispatchUtils.java:105)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:357)
    at org.apache.tools.ant.Target.performTasks(Target.java:385)
    at org.apache.tools.ant.Project.executeSortedTargets
    (Project.java:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets
    (DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run
    (BridgeImpl.java:277)
    at org.apache.tools.ant.module.run.TargetExecutor.run
    (TargetExecutor.java:460)
    at org.netbeans.core.execution.RunClassThread.run(Unknown Source)
    Caused by:
    org.netbeans.modules.j2ee.deployment.common.api.ConfigurationException:
    Tomcat configuration file /home/thufir/NetBeansProjects/Assignment/web/
    META-INF/context.xml seems to be broken. Please make sure it is parseable
    and valid.
    at
    org.netbeans.modules.tomcat5.config.TomcatModuleConfiguration.getContext
    (TomcatModuleConfiguration.java:173)
    at
    org.netbeans.modules.tomcat5.config.TomcatModuleConfiguration.getDatasources
    (TomcatModuleConfiguration.java:198)
    at
    org.netbeans.modules.j2ee.deployment.config.ConfigSupportImpl.getDatasources
    (ConfigSupportImpl.java:332)
    at
    org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.getModuleDatasources
    (J2eeModuleProvider.java:183)
    at
    org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy
    (Deployment.java:122)
    ... 16 more
    Caused by: java.lang.RuntimeException: DOM graph creation failed:
    org.netbeans.modules.schema2beans.Schema2BeansRuntimeException: Failed to
    create the XML-DOM Document. Check your XML to make sure it is correct.
    The processing instruction target matching "[xX][mM][lL]" is not allowed.
    at org.netbeans.modules.tomcat5.config.gen.Context.createGraph
    (Context.java:3162)
    at org.netbeans.modules.tomcat5.config.gen.Context.createGraph
    (Context.java:3146)
    at
    org.netbeans.modules.tomcat5.config.TomcatModuleConfiguration.getContext
    (TomcatModuleConfiguration.java:166)
    ... 20 more
    BUILD FAILED (total time: 2 seconds)








    thanks,

    Thufir
    Thufir Hawat, Feb 26, 2009
    #1
    1. Advertising

  2. * Thufir Hawat:

    > XML validation started.
    >
    > Checking file:/home/thufir/NetBeansProjects/Assignment/web/META-INF/
    > context.xml...
    > The processing instruction target matching "[xX][mM][lL]" is not
    > allowed. [2]


    Appearently the XML declaration is misinterpreted as a processing
    instruction.

    The XML declaration (<?xml version="1.0"?>) must be immediately at
    the beginning of the file -- it may not be preceded by empty lines
    or other kinds of whitespace, cf. the XML spec.

    HTH

    Thorsten (f'up2 comp.text.xml)
    Thorsten Vitt, Feb 26, 2009
    #2
    1. Advertising

  3. Thufir Hawat

    Thufir Hawat Guest

    On Thu, 26 Feb 2009 10:05:28 +0000, Thorsten Vitt wrote:

    > * Thufir Hawat:
    >
    >> XML validation started.
    >>
    >> Checking file:/home/thufir/NetBeansProjects/Assignment/web/META-INF/
    >> context.xml...
    >> The processing instruction target matching "[xX][mM][lL]" is not
    >> allowed. [2]

    >
    > Appearently the XML declaration is misinterpreted as a processing
    > instruction.
    >
    > The XML declaration (<?xml version="1.0"?>) must be immediately at the
    > beginning of the file -- it may not be preceded by empty lines or other
    > kinds of whitespace, cf. the XML spec.
    >
    > HTH
    >
    > Thorsten (f'up2 comp.text.xml)


    Yup, that was it. thanks.

    -Thufir
    Thufir Hawat, Feb 28, 2009
    #3
  4. Thufir Hawat

    stevedonato

    Joined:
    Jan 18, 2012
    Messages:
    1
    The processing instruction target matching "[xX][mM][lL]" is not allowed.

    no space or anything before <?xml statement
    still did not fix my same error as of 1-17/12
    this same xml stmt in a different xml file gets no errors. (copy paste put gets the error)

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:eek:rientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="Status" android:id=
    "@+id/StatusTextView"/>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Start Recording" android:id="@+id/StartRecordingButton"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Stop Recording" android:id="@+id/StopRecordingButton"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Start Playback" android:id="@+id/StartPlaybackButton"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Stop Playback" android:id="@+id/StopPlaybakButton" ></Button>
    </LinearLayout>
    The processing instruction target matching "[xX][mM][lL]" is not allowed.

    android compiler and xml parser written very poorly when it comes to decting actual error. We need some better compiler developers for android (ie like IBM had)
    stevedonato, Jan 18, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    denotes a class which is not valid in the current context

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Feb 21, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    1,185
    William F. Robertson, Jr.
    Feb 21, 2005
  2. Lethal Possum
    Replies:
    6
    Views:
    409
    Lethal Possum
    Jul 6, 2006
  3. Harry Haller
    Replies:
    4
    Views:
    5,931
    Laurent Bugnion [MVP]
    Feb 23, 2007
  4. Steve Kelem
    Replies:
    2
    Views:
    233
    John M. Gamble
    Aug 18, 2004
  5. Replies:
    1
    Views:
    93
    Martin Honnen
    Sep 24, 2005
Loading...

Share This Page