0

I am trying to write a web service that listens for SPML requests. I am using the spml version 2 toolkit.

I am using Jdeveloper to create this web serivce.

I create a method like this: public Response execute(Request req)

When I try and create a web service with jdeveloper...I get the following error:

ExecutionMode does not have a no-arg constructor.

Does anybody know how to fix this..?? An example of this would be greatly appreciated.

Thanks, Brian

Mark Storer
  • 15,672
  • 3
  • 42
  • 80
user1502854
  • 1
  • 1
  • 1

3 Answers3

2

Presumably you have a class called ExecutionMode? The compiler is looking for a no argument constructor, ie. a constructor that takes no arguments:

class ExecutionMode{
    ....
    public ExecutionMode(){...}
    ....
}
Romski
  • 1,912
  • 1
  • 12
  • 27
2

You need to add a default (no-arg) constructor to the ExecutionMode class.

public class ExecutionMode {
     public ExecutionMode() {
          // initialization code here
     }

     // other class code    

}
Kevin Mangold
  • 1,167
  • 8
  • 21
  • 1
    And if for some reason ExecutionMode is not a class of your creation, and you cannot alter it, create a subclass that extends ExecutionMode which has a no-argument constructor and sets its fields to whatever defaults (or not set its fields, as the case may be) please you. You don't need anything in that subclass other than the no-argument constructor, and you never need to refer to the subclass again; due to polymorphism the resulting object can be treated as an object of type ExecutionMode. – algorowara Jul 05 '12 at 03:41
  • You are exactly right. I did not create this class so I cannot alter it. Can you give an example of this subclass? Thanks! – user1502854 Jul 05 '12 at 11:26
  • Ahh, good point CosmicComputer -- it totally slipped my mind that ExecutionMode might not be a class the OP created or has access too. However, I do not think your suggestion will work? In order for the parent class to even KNOW about the child class, the child class needs to be instantiated. I.e., ExectionMode em = new ExecutionModeSubclass(); – Kevin Mangold Jul 05 '12 at 14:20
0

If you define a parameterized contructor then you should also define a default constructor if you use one because java wont provide default constructor if you define parameterized constructor.So you should define

public ExecutionMode()
{

   //defination

}
pavi
  • 654
  • 1
  • 9
  • 29