You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Jan Stary <js...@artax.karlin.mff.cuni.cz> on 2002/01/14 12:24:10 UTC

[repost - sorry, urgent] File "null" not found

Hello druzja,

the following code in ContainerComponent
(copied from the white paper) ...

-- cut ----------------
public void initialize() throws Exception {
	DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
	Configuration sysConfig = builder.buildFromFile(
		"/home/hans/casopis/system.xml");
	Configuration roleConfig =
		builder.build(this.getClass().getClassLoader().
		getResourceAsStream("/home/hans/casopis/roles.xml"));
	//DefaultRoleManager roles = new DefaultRoleManager();
	//roles.enableLogging(Hierarchy.getDefaultHierarchy().getLoggerFor(
	//	"/home/hans/casopis/roles.xml"));
	//roles.configure(roleConfig);

	this.manager.setLogger(Hierarchy.getDefaultHierarchy().
		getLoggerFor("casopis"));
	this.manager.contextualize(new DefaultContext());
	//this.manager.setRoleManager(roles);
	this.manager.configure(sysConfig);
	this.manager.initialize();
}
-- cut ----------------

... compiles ok (the lines are commented out just
to locate the evil), but when visiting a page which calls
container.initialize(), I get


-- cut ---
javax.servlet.ServletException: File "null" not found.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:107)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
etc ....


root cause
org.xml.sax.SAXParseException: File "null" not found.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1202)
at org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:499)
at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:312)
etc ...
-- cut ---


Why does this happen? Which file can't be found? Or should I provide
a filename somewhere (and I don't)? All the files mentioned in code
exist and are readable.

In fact, I believe it's not related to Avalon...

Thanks for any ideas

Jan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [repost - sorry, urgent] File "null" not found

Posted by Jeff Turner <je...@socialchange.net.au>.
On Mon, Jan 14, 2002 at 12:24:10PM +0100, Jan Stary wrote:
> Hello druzja,
> 
> the following code in ContainerComponent
> (copied from the white paper) ...
> 
> -- cut ----------------
> public void initialize() throws Exception {
> 	DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
> 	Configuration sysConfig = builder.buildFromFile(
> 		"/home/hans/casopis/system.xml");
> 	Configuration roleConfig =
> 		builder.build(this.getClass().getClassLoader().
> 		getResourceAsStream("/home/hans/casopis/roles.xml"));

This might be the problem. A "resource" is a file or class accessible
from a JVM classloader. File resources are searched for relative to
paths listed in the classpath. So unless you have '/' in your classpath,
you won't be able to find '/home/hans//..'.

The code then becomes "builder.build(this.getClass().getClassLoader(),
null);", hence the 'File "null" not found' error.

--Jeff

 
> Why does this happen? Which file can't be found? Or should I provide
> a filename somewhere (and I don't)? All the files mentioned in code
> exist and are readable.
> 
> In fact, I believe it's not related to Avalon...
> 
> Thanks for any ideas
> 
> Jan
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [repost - sorry, urgent] File "null" not found

Posted by Jan Stary <js...@artax.karlin.mff.cuni.cz>.
As I mentioned, both files are world-readable, but anyway, it' SOLVED:
the probem was, as Jeff described, that these 'resources' where simply
not in my classpath :-)

jan

On Jan 14 15:16:50, Alex Vishnev wrote:
:Did you check the permissions on /home/hans/casopis/system.xml and
:"/home/hans/casopis/roles.xml". As you know apache normally set up with user
:nobody. Therefore, you should grant the right permission mask to your
:system.xml and roles.xml. BTW, I use the same block and it works for me. Can
:you also supply system.xml and roles.xml to see if there are any problems in
:those.
:
:Alex
:-----Original Message-----
:From: Jan Stary [mailto:jsta6559@artax.karlin.mff.cuni.cz]
:Sent: Monday, January 14, 2002 6:24 AM
:To: Avalon Developers List
:Subject: [repost - sorry, urgent] File "null" not found
:
:Hello druzja,
:
:the following code in ContainerComponent
:(copied from the white paper) ...
:
:-- cut ----------------
:public void initialize() throws Exception {
:        DefaultConfigurationBuilder builder = new
:DefaultConfigurationBuilder();
:        Configuration sysConfig = builder.buildFromFile(
:                "/home/hans/casopis/system.xml");
:        Configuration roleConfig =
:                builder.build(this.getClass().getClassLoader().
:                getResourceAsStream("/home/hans/casopis/roles.xml"));
:        //DefaultRoleManager roles = new DefaultRoleManager();
:        //roles.enableLogging(Hierarchy.getDefaultHierarchy().getLoggerFor(
:        //      "/home/hans/casopis/roles.xml"));
:        //roles.configure(roleConfig);
:
:        this.manager.setLogger(Hierarchy.getDefaultHierarchy().
:                getLoggerFor("casopis"));
:        this.manager.contextualize(new DefaultContext());
:        //this.manager.setRoleManager(roles);
:        this.manager.configure(sysConfig);
:        this.manager.initialize();
:}
:-- cut ----------------
:
:... compiles ok (the lines are commented out just
:to locate the evil), but when visiting a page which calls
:container.initialize(), I get
:
:
:-- cut ---
:javax.servlet.ServletException: File "null" not found.
:at
:org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
:l.java:457)
:at org.apache.jsp.index$jsp._jspService(index$jsp.java:107)
:at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
:etc ....
:
:
:root cause
:org.xml.sax.SAXParseException: File "null" not found.
:at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1202)
:at
:org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(Defa
:ultEntityHandler.java:499)
:at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:312)
:etc ...
:-- cut ---
:
:
:Why does this happen? Which file can't be found? Or should I provide
:a filename somewhere (and I don't)? All the files mentioned in code
:exist and are readable.
:
:In fact, I believe it's not related to Avalon...
:
:Thanks for any ideas
:
:Jan
:
:
:--
:To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
:For additional commands, e-mail: <ma...@jakarta.apache.org>
:
:--
:To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
:For additional commands, e-mail: <ma...@jakarta.apache.org>
:
:
:--
:To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
:For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [repost - sorry, urgent] File "null" not found

Posted by Alex Vishnev <av...@optonline.net>.
Did you check the permissions on /home/hans/casopis/system.xml and
"/home/hans/casopis/roles.xml". As you know apache normally set up with user
nobody. Therefore, you should grant the right permission mask to your
system.xml and roles.xml. BTW, I use the same block and it works for me. Can
you also supply system.xml and roles.xml to see if there are any problems in
those.

Alex
-----Original Message-----
From: Jan Stary [mailto:jsta6559@artax.karlin.mff.cuni.cz]
Sent: Monday, January 14, 2002 6:24 AM
To: Avalon Developers List
Subject: [repost - sorry, urgent] File "null" not found

Hello druzja,

the following code in ContainerComponent
(copied from the white paper) ...

-- cut ----------------
public void initialize() throws Exception {
        DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
        Configuration sysConfig = builder.buildFromFile(
                "/home/hans/casopis/system.xml");
        Configuration roleConfig =
                builder.build(this.getClass().getClassLoader().
                getResourceAsStream("/home/hans/casopis/roles.xml"));
        //DefaultRoleManager roles = new DefaultRoleManager();
        //roles.enableLogging(Hierarchy.getDefaultHierarchy().getLoggerFor(
        //      "/home/hans/casopis/roles.xml"));
        //roles.configure(roleConfig);

        this.manager.setLogger(Hierarchy.getDefaultHierarchy().
                getLoggerFor("casopis"));
        this.manager.contextualize(new DefaultContext());
        //this.manager.setRoleManager(roles);
        this.manager.configure(sysConfig);
        this.manager.initialize();
}
-- cut ----------------

... compiles ok (the lines are commented out just
to locate the evil), but when visiting a page which calls
container.initialize(), I get


-- cut ---
javax.servlet.ServletException: File "null" not found.
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:457)
at org.apache.jsp.index$jsp._jspService(index$jsp.java:107)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
etc ....


root cause
org.xml.sax.SAXParseException: File "null" not found.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1202)
at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(Defa
ultEntityHandler.java:499)
at org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:312)
etc ...
-- cut ---


Why does this happen? Which file can't be found? Or should I provide
a filename somewhere (and I don't)? All the files mentioned in code
exist and are readable.

In fact, I believe it's not related to Avalon...

Thanks for any ideas

Jan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>