RE: Malformed URL Exception: unknown protocol: c

2005-08-26 Thread Jay Burgess
Then I'm at loss as to what the issue is.  The fact that it works in some cases,
and not others, has me puzzled.  I'd suggest digging into the javax.xml source
and see if you can figure out the condition that throws the exception, etc.

And I'm still not fully clear on whether our C:\... strings are considered
valid URI's according to the spec, though they must be, as everything seems to 
work.

Good luck.

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/
 

-Original Message-
From: Franklin Phan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 5:09 PM
To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

Jay,

I did that just last night.  I got:

C:\Program Files\Apache Group\Tomcat 4.1\webapps\htmaint\WEB-INF\work_xml

Franklin Phan
Cygna Energy Services
www.cygna.net

Jay Burgess wrote:
 Why don't you do: 
 
   System.out.println(getServletContext().getRealPath(XML_WORK_PATH));
 
 And see what it tells you.  I'd be curious to see what you're passing to the
 StreamSource constructor, and how it differs from my string.
 
 Jay
  
 
 -Original Message-
 From: Franklin Phan [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 25, 2005 4:52 PM
 To: Tomcat Users List
 Subject: Re: Malformed URL Exception: unknown protocol: c
 
 To make things a bit more puzzling, I have a different app inside the same
 Tomcat 4.1.18 that uses the same XSL Transform class under its own web app
 context.  That app works without a hitch. 
   Why is that?
 
 
 Jay Burgess wrote:
 
First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not 
CLASSPATH
and /bin?

Second, your situation has me puzzled.  Mark's answer appears correct, as
unknown protocol: c is typically the C:\ of a Windows filesystem path.  
And
checking the documentation, StreamSource requires a URI, so a windows 
filesystem
path won't work.

However...my code does something very similar, and it works. The only 
difference
is that I'm doing it for a StreamResult, not a StreamSource:

String root = getServletContext().getRealPath();
String xmlFileName = root + File.separator + WEB-INF + 
File.separator + TestData.xml;
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(buffer),
new StreamResult(xmlFileName)); // DOM into XML

I just threw in a quick println(), and xmlFileName is equal to
C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.

Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
something obvious.

Jay

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:21 PM
To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).

Mark

Franklin Phan wrote:


I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:

javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:

String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
 tFactory.newTransformer(new 




javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)
 

+ \\ + xslParam)); //xslParam is an XSL file name


The Malformed URL Exception does not occur on another machine running 
Windows XP Server.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Mark Thomas
I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).


Mark

Franklin Phan wrote:
I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:


javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:


String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
  tFactory.newTransformer(new 
javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH) 
+ \\ + xslParam)); //xslParam is an XSL file name



The Malformed URL Exception does not occur on another machine running 
Windows XP Server.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Jay Burgess
First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not CLASSPATH
and /bin?

Second, your situation has me puzzled.  Mark's answer appears correct, as
unknown protocol: c is typically the C:\ of a Windows filesystem path.  And
checking the documentation, StreamSource requires a URI, so a windows filesystem
path won't work.

However...my code does something very similar, and it works. The only difference
is that I'm doing it for a StreamResult, not a StreamSource:

String root = getServletContext().getRealPath();
String xmlFileName = root + File.separator + WEB-INF + 
File.separator + TestData.xml;
TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(buffer),
new StreamResult(xmlFileName)); // DOM into XML

I just threw in a quick println(), and xmlFileName is equal to
C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.

Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
something obvious.

Jay

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:21 PM
To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).

Mark

Franklin Phan wrote:
 I use Windows XP Pro. My JAVA_HOME environment variable points to 
 c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
 %JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
 of the package javax.xml.transform.  Why do I get the following error:
 
 javax.servlet.ServletException:
 javax.xml.transform.TransformerConfigurationException:
 javax.xml.transform.TransformerException:
 java.net.MalformedURLException: unknown protocol: c
 
 The four lines above actually appear altogether in one line.  And the 
 error appears to be due to the following piece of code where I'm trying 
 to get the path to a folder on the local drive to access a file:
 
 String XML_WORK_PATH = /WEB-INF/work_xml;
 TransformerFactory tFactory = TransformerFactory.newInstance();
 Transformer transformer =
   tFactory.newTransformer(new 

javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)

 + \\ + xslParam)); //xslParam is an XSL file name
 
 
 The Malformed URL Exception does not occur on another machine running 
 Windows XP Server.
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Franklin Phan
To make things a bit more puzzling, I have a different app inside the same Tomcat 4.1.18 that uses the same XSL Transform class under its own web app context.  That app works without a hitch. 
 Why is that?



Jay Burgess wrote:

First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not CLASSPATH
and /bin?

Second, your situation has me puzzled.  Mark's answer appears correct, as
unknown protocol: c is typically the C:\ of a Windows filesystem path.  And
checking the documentation, StreamSource requires a URI, so a windows filesystem
path won't work.

However...my code does something very similar, and it works. The only difference
is that I'm doing it for a StreamResult, not a StreamSource:

String root = getServletContext().getRealPath();
String xmlFileName = root + File.separator + WEB-INF + 
File.separator + TestData.xml;

TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(buffer),
new StreamResult(xmlFileName)); // DOM into XML

I just threw in a quick println(), and xmlFileName is equal to
C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.

Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
something obvious.

Jay

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:21 PM

To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).


Mark

Franklin Phan wrote:

I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:


javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:


String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
 tFactory.newTransformer(new 



javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)



+ \\ + xslParam)); //xslParam is an XSL file name


The Malformed URL Exception does not occur on another machine running 
Windows XP Server.







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Jay Burgess
Why don't you do: 

  System.out.println(getServletContext().getRealPath(XML_WORK_PATH));

And see what it tells you.  I'd be curious to see what you're passing to the
StreamSource constructor, and how it differs from my string.

Jay
 

-Original Message-
From: Franklin Phan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:52 PM
To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

To make things a bit more puzzling, I have a different app inside the same
Tomcat 4.1.18 that uses the same XSL Transform class under its own web app
context.  That app works without a hitch. 
  Why is that?


Jay Burgess wrote:
 First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not 
 CLASSPATH
 and /bin?
 
 Second, your situation has me puzzled.  Mark's answer appears correct, as
 unknown protocol: c is typically the C:\ of a Windows filesystem path.  
 And
 checking the documentation, StreamSource requires a URI, so a windows 
 filesystem
 path won't work.
 
 However...my code does something very similar, and it works. The only 
 difference
 is that I'm doing it for a StreamResult, not a StreamSource:
 
 String root = getServletContext().getRealPath();
 String xmlFileName = root + File.separator + WEB-INF + 
 File.separator + TestData.xml;
 TransformerFactory.newInstance().newTransformer().transform(
 new DOMSource(buffer),
 new StreamResult(xmlFileName)); // DOM into XML
 
 I just threw in a quick println(), and xmlFileName is equal to
 C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.
 
 Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
 something obvious.
 
 Jay
 
 | Jay Burgess [Vertical Technology Group]
 | Essential Technology Links
 | http://www.vtgroup.com/
 
 
 -Original Message-
 From: Mark Thomas [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, August 25, 2005 4:21 PM
 To: Tomcat Users List
 Subject: Re: Malformed URL Exception: unknown protocol: c
 
 I assume becuase the url you pass it starts c:\ as that is the start 
 of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
 many slashes you need to get this to work in windows).
 
 Mark
 
 Franklin Phan wrote:
 
I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:

javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:

String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
  tFactory.newTransformer(new 

 

javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)
 
 
+ \\ + xslParam)); //xslParam is an XSL file name


The Malformed URL Exception does not occur on another machine running 
Windows XP Server.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Franklin Phan

Jay,

I just looked again at my Environment Variables under the Advanced tab of my System Properties window.  
You are correct; it is the Path var that says %JAVA_HOME%\bin;...more 
paths.

Franklin


Jay Burgess wrote:

First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not CLASSPATH
and /bin?

Second, your situation has me puzzled.  Mark's answer appears correct, as
unknown protocol: c is typically the C:\ of a Windows filesystem path.  And
checking the documentation, StreamSource requires a URI, so a windows filesystem
path won't work.

However...my code does something very similar, and it works. The only difference
is that I'm doing it for a StreamResult, not a StreamSource:

String root = getServletContext().getRealPath();
String xmlFileName = root + File.separator + WEB-INF + 
File.separator + TestData.xml;

TransformerFactory.newInstance().newTransformer().transform(
new DOMSource(buffer),
new StreamResult(xmlFileName)); // DOM into XML

I just threw in a quick println(), and xmlFileName is equal to
C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.

Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
something obvious.

Jay

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:21 PM

To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).


Mark

Franklin Phan wrote:

I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:


javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:


String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
 tFactory.newTransformer(new 



javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)



+ \\ + xslParam)); //xslParam is an XSL file name


The Malformed URL Exception does not occur on another machine running 
Windows XP Server.







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Malformed URL Exception: unknown protocol: c

2005-08-25 Thread Franklin Phan

Jay,

I did that just last night.  I got:

C:\Program Files\Apache Group\Tomcat 4.1\webapps\htmaint\WEB-INF\work_xml

Franklin Phan
Cygna Energy Services
www.cygna.net

Jay Burgess wrote:
Why don't you do: 


  System.out.println(getServletContext().getRealPath(XML_WORK_PATH));

And see what it tells you.  I'd be curious to see what you're passing to the
StreamSource constructor, and how it differs from my string.

Jay
 


-Original Message-
From: Franklin Phan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:52 PM

To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

To make things a bit more puzzling, I have a different app inside the same
Tomcat 4.1.18 that uses the same XSL Transform class under its own web app
context.  That app works without a hitch. 
  Why is that?



Jay Burgess wrote:


First, I assume you mean CLASSPATH and /lib, or PATH and /bin, but not CLASSPATH
and /bin?

Second, your situation has me puzzled.  Mark's answer appears correct, as
unknown protocol: c is typically the C:\ of a Windows filesystem path.  And
checking the documentation, StreamSource requires a URI, so a windows filesystem
path won't work.

However...my code does something very similar, and it works. The only difference
is that I'm doing it for a StreamResult, not a StreamSource:

String root = getServletContext().getRealPath();
String xmlFileName = root + File.separator + WEB-INF + 
   File.separator + TestData.xml;

TransformerFactory.newInstance().newTransformer().transform(
   new DOMSource(buffer),
   new StreamResult(xmlFileName)); // DOM into XML

I just threw in a quick println(), and xmlFileName is equal to
C:\tomcat-5.0.19\webapps\TestApp\WEB-INF\TestData.xml.

Can anyone explain why mine works and Franklin's fails?  Maybe I'm missing
something obvious.

Jay

| Jay Burgess [Vertical Technology Group]
| Essential Technology Links
| http://www.vtgroup.com/


-Original Message-
From: Mark Thomas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 25, 2005 4:21 PM

To: Tomcat Users List
Subject: Re: Malformed URL Exception: unknown protocol: c

I assume becuase the url you pass it starts c:\ as that is the start 
of the XML_WORK_PATH. You need to prefix it with file:/// (or however 
many slashes you need to get this to work in windows).


Mark

Franklin Phan wrote:


I use Windows XP Pro. My JAVA_HOME environment variable points to 
c:\j2sdk1.4.2_05.  The CLASSPATH is set to have as the first element 
%JAVA_HOME%\bin.  I've written an XSL Transform servlet that makes use 
of the package javax.xml.transform.  Why do I get the following error:


javax.servlet.ServletException:
javax.xml.transform.TransformerConfigurationException:
javax.xml.transform.TransformerException:
java.net.MalformedURLException: unknown protocol: c

The four lines above actually appear altogether in one line.  And the 
error appears to be due to the following piece of code where I'm trying 
to get the path to a folder on the local drive to access a file:


String XML_WORK_PATH = /WEB-INF/work_xml;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
tFactory.newTransformer(new 





javax.xml.transform.stream.StreamSource(getServletContext().getRealPath(XML_WORK_PATH)




+ \\ + xslParam)); //xslParam is an XSL file name


The Malformed URL Exception does not occur on another machine running 
Windows XP Server.







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]