• 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

Creating a webservice using RAD 7

Posted by | Posted in RAD | Posted on 27-07-2008

Tagged Under : , , ,

Creating a webservice using RAD 7

Few months back I had posted about webservice Hello World tutorial in Java. At that time I did not find any simple tutorial on how to create a Hello World webservice in Java. Today I will explain how to create a simple webservice in Java using Rational Application Developer version 7(The steps will be almost same for RAD 6 also).

First create a project for our webservice. I just named my project as WebService. Then we need a class for our webservice. We will be exposing this class as our webservice. I have created a class HelloWorld.java with one sayHello method in it. The complete code listing for our HelloWorld.java is given below.

package com.test;
 
public class HelloWorld {
	public String sayHello(String name){
		return "Hello "+name;
	}
}

The next step is to expose this HelloWorld.java as our web service. Right click on the Project and click on New. Click on Other if your ‘Web Services’ folder is not listed. Expand the ‘Web Services’ folder and select Web Service

Click on Next. The Web Service creation wizard opens up. From the next page opened, select HelloWorld.java as our service implementation and the server types.

Click on Next.

Click on Next.

Click on Next.

Click on Finish. You are done with your HelloWorld web service using RAD 7.

Share

Increase the console output size in RAD

Posted by | Posted in RAD | Posted on 01-04-2008

Tagged Under : ,

To increase the console output in RAD, WSAD, or eclipse, go to Window -> Preferences -> Run/Debug -> Console.

Select the Limit console output and enter the number of characters you want in the console buffer size. Save the setting.

 

 

Share

Generating a web service proxy client

Posted by | Posted in RAD, WebSphere | Posted on 29-01-2008

Tagged Under : , , , ,

Java web service client applications use a web service proxy client to interact with the Web services APIs. A proxy client allows the developer to invoke the web service APIs as if it was a local method. For generating a web service proxy client, we need the WSDL files that describe the web service interfaces. The WSDL files for business process API is BFMWS.wsdl and for human task API is HTMWS.wsdl. The steps in generating a web service are as follows. (Before following the steps, copy your WSDL files to your workspace or to some location where the WID/RAD can see your WSDL files.

Step 1.
Right click on the web project (from web perspective) and select New -> Other. The select wizard opens. Expand the web service folder and select ‘Web Service Client’.

Web service client selection

Click Next.

Step 2.
From the web service client dialog box, accept the default values (The client proxy type would be Java Proxy, and ‘Create Folders when necessary’ checkbox would be checked and all other check boxes would be unchecked) or select the options that matches your environment.

Web service options page

Click Next.

Step 3.
The web service selection page opens. Click on Browse button. From the opened resource browser window, select the WSDL file. Click OK.

Web service selection page

Click Next.

Step 4.
The client environment configuration window opens. From this page select ‘IBM WebSphere’ as the Web service runtime by clicking the Edit button, if it is not selected already. Select the client type and the client projects.

Client Environment Configuration

Click Next.

Step 5.
The web service proxy client page appears. Accept all the default values.

Web service proxy page

Click Finish.

The web service proxy client will be generated and we can use the generated proxy client and helper classes for invoking the web service from our client application.

Share

IWAB0639E Error when generating web service client

Posted by | Posted in RAD, WebSphere | Posted on 25-01-2008

Tagged Under : , , ,

Today when I tried to generate a web service client for Business Flow Manager API (WSDL files are BFMIF.wsdl, BFMWS.wsdl), WebSphere Integration Developer started giving me an error message and no web service client files are generated. :-( . The error message is as follows.

IWAB0639E Error in generating Java files and deployment descritpors from WSDL file
   java.io.IOException: WSWS3205E: Error: Type {http://www.w3.org/2001/XMLSchema}anySimpleType is referenced but not defined.
   at com.ibm.ws.webservices.wsdl.symbolTable.SymbolTable.checkForUndefined(SymbolTable.java:656)
   at com.ibm.ws.webservices.wsdl.symbolTable.SymbolTable.firstPass(SymbolTable.java:528)
   at com.ibm.ws.webservices.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:500)
   at com.ibm.ws.webservices.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:472)
   at com.ibm.ws.webservices.wsdl.Parser$WSDLRunnable.run(Parser.java:293)
   at java.lang.Thread.run(Thread.java:816)

I have generated these WSDLs from the admin console of WebSphere Application Server. I don’t know what the root cause of this problem is. I had done a search on this error message and I could see some people are telling this as a problem with SOAP version, RAD is using. However I found out the solution for this problem.

In the web service client generation wizard, in Client Environment Configuration select ‘IBM WebSphere’ as the Web service runtime. Now you will be able to generate the web service client without any problems.

Share