cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timur Izhbulatov <...@yxo.ru>
Subject XMLDBSourceFactory
Date Tue, 22 Feb 2005 06:11:50 GMT
Hi All, 

I found a _very_ strange problem which appears only on Linux. The same 
application worked just fine under win2k. I use Cocoon 2.1.5. 

Here is an excerpt from the configure method of the XMLDBSourceFactory class 
with some additions for debugginug:
//...
       credentialMap = new HashMap();
       Configuration[] drivers = conf.getChildren("driver");
       for (int i = 0; i < drivers.length; i++) {
           String type = drivers[i].getAttribute("type");
           String driver = drivers[i].getAttribute("class"); 

           SourceCredential credential = new SourceCredential(null, null);
           credential.setPrincipal(drivers[i].getAttribute("user", null));
           credential.setPassword(drivers[i].getAttribute("password", 
null));
           credentialMap.put(type, credential);
           getLogger().info("got from map: " + credentialMap.get(type));
//... 

In core.log I have the following lines:
INFO    (2005-02-21) 06:51.24:396   [core.manager] (Unknown-URI) 
Unknown-thread/XMLDBSourceFactory: got from map: 
org.apache.cocoon.components.source.helpers.SourceCredential@15311bd
INFO    (2005-02-21) 06:51.24:866   [core.manager] (Unknown-URI) 
Unknown-thread/XMLDBSourceFactory: got from map: 
org.apache.cocoon.components.source.helpers.SourceCredential@1402d5a 

Fnd after that int the getSource method of the same class:
// ...
       String type = location.substring(start, end);
       this.getLogger().info("key: '" + type + "'");
       SourceCredential credential = 
(SourceCredential)credentialMap.get(type);
       this.getLogger().info("got by key: " + credentialMap.get(type));
       this.getLogger().info("map has key: " + 
credentialMap.containsKey(type));
       Collection values = credentialMap.values();
       for (Iterator i = values.iterator(); i.hasNext(); ) {
           SourceCredential value = (SourceCredential) i.next();
           getLogger().info("vlaue: " + value);
           getLogger().info("map has value: " + 
credentialMap.containsValue(value));
       }
//... 

In log:
INFO    (2005-02-21) 06:51.44:551   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: key: 'exist'
INFO    (2005-02-21) 06:51.44:552   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: got by key: null
INFO    (2005-02-21) 06:51.44:552   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: map has key: false
INFO    (2005-02-21) 06:51.44:552   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: vlaue: 
org.apache.cocoon.components.source.helpers.SourceCredential@15311bd
INFO    (2005-02-21) 06:51.44:553   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: map has value: true
INFO    (2005-02-21) 06:51.44:553   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: vlaue: 
org.apache.cocoon.components.source.helpers.SourceCredential@1402d5a
INFO    (2005-02-21) 06:51.44:553   [core.manager] (/caclient/browse(1)) 
PoolThread-4/XMLDBSourceFactory: map has value: true 

And as a result I have a NullPointerException when going to this URL:
java.lang.NullPointerException
	at 
org.apache.cocoon.components.source.impl.XMLDBSource.<init>(XMLDBSource.java 
:162)
	at 
org.apache.cocoon.components.source.impl.XMLDBSourceFactory.getSource(XMLDBS 
ourceFactory.java:149)
	at 
org.apache.excalibur.source.impl.SourceResolverImpl.resolveURI(SourceResolve 
rImpl.java:208)
	at 
org.apache.cocoon.components.CocoonComponentManager.resolveURI(CocoonCompone 
ntManager.java:500)
	at 
org.apache.cocoon.environment.AbstractEnvironment.resolveURI(AbstractEnviron 
ment.java:531)
	at 
org.apache.cocoon.environment.AbstractEnvironment.resolveURI(AbstractEnviron 
ment.java:518)
	at org.apache.cocoon.generation.FileGenerator.setup(FileGenerator.java:79) 

... And so on 

Any ideas? 

Thanks in advance, 

 --
Timur Izhbulatov

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message