• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cocoon and WebSphere

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
...
 
Caroline Iux
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic