runTimeError
runTimeError

Reputation: 41

IllegalArgumentException: Type cannot be null (in JAVA)

I'm facing the exact issue as described in this SO link which hasn't been answered. I've tried the suggestions given in the comment section, nothing works.

I've searched online for the answers and found no luck.

My Procedure looks like this.

DROP PROCEDURE IF EXISTS userdb.new_test;
CREATE PROCEDURE userdb.new_test (IN arg varchar(255))
BEGIN   
  select * FROM message 
END;

and from this link I got to know

This exception indicates that a method is called with incorrect input arguments. Then, the only thing you must do is correct the values of the input parameters. In order to achieve that, follow the call stack found in the stack trace and check which method produced the invalid argument.

does anyone know how to fix this?

Upvotes: 0

Views: 2311

Answers (1)

Rahul
Rahul

Reputation: 77876

That's most probably because of the non-default value parameter in your procedure IN arg varchar(255) and if not wrong you are probably calling the procedure without passing any parameter. You need to call like

call userdb.new_test 'some value'

MySQL doesn't support parameter default value likewise in SQL Server and so you can't say IN arg varchar(255) = null

Also, I don't see you are using that parameter in your query and so best is drop it;

DROP PROCEDURE IF EXISTS userdb.new_test;
CREATE PROCEDURE userdb.new_test 
BEGIN   
  select * FROM message 
END;

Upvotes: 1

Related Questions