aspose file tools*
The moose likes XML and Related Technologies and the fly likes Cocoon and WebSphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Cocoon and WebSphere" Watch "Cocoon and WebSphere" New topic
Author

Cocoon and WebSphere

Caroline Iux
Ranch Hand

Joined: May 14, 2001
Posts: 103
I was trying to install Cocoon 1.8 in WebSphere. Everything started fine. But when I request a xml page, I get the following error:
Unable to open resource:
E:\WebSphere\cocoon-1.8\conf\cocoon.properties
java.lang.NullPointerException
at org.apache.cocoon.Cocoon.init(Cocoon.java:123)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:604)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:136)
at com.ibm.servlet.engine.webapp.PreInitializedServletState.init(StrictLifecycleServlet.java:244)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init(StrictLifecycleServlet.java:102)
at com.ibm.servlet.engine.webapp.ServletInstance.init(ServletManager.java:284)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.ServletManager.addServlet(ServletManager.java:76)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:91)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:806)
at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:93)
at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:121)
at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:82)
at com.ibm.servlet.engine.ServletHost.addWebGroup(ServletHost.java:117)
at com.ibm.servlet.engine.ServletEngineDynamicUpdateSupport.addWebGroup(ServletEngineDynamicUpdateSupport.java:126)
at com.ibm.ejs.sm.active.ActiveServletGroup.startAction(ActiveServletGroup.java:76)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:682)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:584)
at com.ibm.ejs.sm.active.ActiveServletEngine.startAction(ActiveServletEngine.java:60)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:682)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at com.ibm.ejs.sm.active.ActiveObject.operateOnContainedObjects(ActiveObject.java:584)
at com.ibm.ejs.sm.active.ActiveEJBServer.startAction(ActiveEJBServer.java:96)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:682)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:117)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:93)
at com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject(AdminAgentImpl.java:62)
at com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke(_AdminAgentImpl_Tie.java:80)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2282)
at com.ibm.CORBA.iiop.WorkerThread.run(WorkerThread.java:195)
at com.ibm.ejs.oa.pool.ThreadPool$PooledThread.run(ThreadPool.java:535)
I verified that the file path is correct. Any idea why I can't open it.
Thanks!
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 671
Do you have something like the following in web.xml file?
Bruce

<web-app>
<servlet>
<servlet-name>org.apache.cocoon.Cocoon</servlet-name>
<servlet-class>org.apache.cocoon.Cocoon</servlet-class>
<init-param>
<param-name>properties</param-name>
<param-value>WEB-INF/cocoon.properties</param-value>
</init-param>
</servlet>
...


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Caroline Iux
Ranch Hand

Joined: May 14, 2001
Posts: 103
I found what's wrong. In case other people encounter the same quesiton, I post the solution here:
In org.apache.cocoon.Cocoon.java
change the following code to
------------------------------------------------
if ((containerMajorVersion >= 2)&&(containerMinorVersion >= 2)) {
try {
URL resource = config.getServletContext().getResource(confsName);
InputStream confsStream = resource.openConnection().getInputStream();
confs = new Configurations(confsStream);
confsStream.close();
} catch (Exception ex) {
exception = ex;
message = "Unable to open resource: " + confsName;
return;
}
} else {
confs = new Configurations(confsName);
}
-----------------------------------------------
to:
----------------------------------------------
if ((containerMajorVersion >= 2)&&(containerMinorVersion >= 2)) {
try {
InputStream confsStream = getServletContext().getResourceAsStream(confsName);
if (confsStream==null) {
confsStream = new java.io.FileInputStream(getServletContext().getRealPath(confsName));
}
confs = new Configurations(confsStream);
confsStream.close();
} catch (Exception ex) {
exception = ex;
message = "Unable to open resource: " + confsName;
return;
}
} else {
confs = new Configurations(confsName);
}
------------------------------------------------------
In short, instead of getting the resources as URL, get it as a file. WebSphere seems to have problem with that. As soon as I changed the code and recompiled, everything works fine.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cocoon and WebSphere