context.xml not parseable and valid

T

Thufir Hawat

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
 
T

Thorsten Vitt

* 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)
 
T

Thufir Hawat

* 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
 
Joined
Jan 18, 2012
Messages
1
Reaction score
0
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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top