Sign up assistant got Null Pointer exception

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

UlterR
Posts: 20
Joined: 15 Jan 2017, 18:05

Sign up assistant got Null Pointer exception

Postby UlterR » 15 Jan 2017, 18:17

So i'm using Sign Up assistant for my registration, but when i register, the server got an error "Null Pointer Exception"
Here's the extension code

Code: Select all

 @Override
    public void init(){
        suac = new SignUpAssistantComponent();
        suac.getConfig().signUpTable = "user";
        suac.getConfig().idField = "iduser";
        suac.getConfig().usernameField = "username";
        suac.getConfig().passwordField = "password";
        suac.getConfig().emailField = "email";
        suac.getConfig().minUserNameLength = 3;
        suac.getConfig().minPasswordLength = 3;
       
        addRequestHandler(SignUpAssistantComponent.COMMAND_PREFIX, suac);
    }
   
    @Override
    public void destroy(){
        super.destroy();
    }


the table has iduser as primary key with username, password, email as other column
the insert was a success as new data was added to the database safely, but the extension got this error and never throw a response.

error image
Image

Help, thanks in advance
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Sign up assistant got Null Pointer exception

Postby Lapo » 16 Jan 2017, 08:58

Hi,
it looks like the ID field is missing. An ID key field is necessary, of type Int / Long and auto-increment. You can also define your own keys of course, but this one must be present.

By default the name of the field is "id" but you can change it to anything else via the configuration.

For more see here:
http://docs2x.smartfoxserver.com/Develo ... ant-basics

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
UlterR
Posts: 20
Joined: 15 Jan 2017, 18:05

Re: Sign up assistant got Null Pointer exception

Postby UlterR » 16 Jan 2017, 19:05

Hi thanks a lot for the response

I already assign the id field at this line

Code: Select all

suac.getConfig().idField = "iduser";


although my iduser column doesn't have auto-increment even though the type is in int

Does I assign it wrong so the register gives null on id

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Baidu [Spider] and 103 guests