• Entries (RSS)
  • Comments (RSS)

java.net.MalformedURLException: SRVE0238E: Resource paths should have a leading slash

Posted by | Posted in RAD | Posted on 22-09-2008

Tagged Under : ,

Yesterday was my first day on Struts. We were adding some new features to an existing application. The application was running in WAS 5.1 using Struts 1.1. Since I like RAD more than WSAD, I thought of using RAD for my development. I asked my team to export the project from WSAD and I imported the project in my RAD workspace. There were no issues till this point. Everything looked perfectly fine and I started the server. The server also started without any issues. However my Struts 1.1 project did not start. It was trying to start and failed with an error message.

0000000a ActionServlet E org.apache.struts.action.ActionServlet handleConfigException Parsing error processing resource path 
                                 java.net.MalformedURLException: SRVE0238E: Resource paths should have a leading slash
	at com.ibm.ws.webcontainer.webapp.WebApp.getResource(WebApp.java:1956)
	at com.ibm.ws.webcontainer.facade.ServletContextFacade.getResource(ServletContextFacade.java:100)
	at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1002)
	at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
	at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
	at javax.servlet.GenericServlet.init(GenericServlet.java:256)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:274)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1398)
	at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServletWrapper(WebExtensionProcessor.java:86)
	at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:763)
	at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.java:506)
	at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:395)
	at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:115)
	at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:128)
	at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:905)
	at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:858)
	at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:167)
	at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:391)

That was my first error with Struts. Anyway I managed to resolve this issue with very little search. There are two ways to resolve this issue. By making a small change in the web.xml file. ie, Open your web.xml file and search for WEB-INF/struts-config.xml and change this entry to /WEB-INF/struts-config.xml. Yes just a slash in front of the WEB-INF.

The second is to tell the WebSphere server to add this slash for you. For that logon to you admin console and click on Servers > server1 > WebContainer > Custom Properties > New property. Enter prependSlashToResource as the name of the property and true as the value of the property.

Share

Read More

Post a Comment