Working from the tomcat servlet example. It's throwing an exception that it can't find the zone but I don't understand why. The only change is the package & zone name.
Servlet exception
Re: Servlet exception
Hi,
the code looks fine. I would suggest to break down line 33 into single calls to better understand which is the object that is causing the NPE.
What version of SFS2X are you using?
Thanks
the code looks fine. I would suggest to break down line 33 into single calls to better understand which is the object that is causing the NPE.
What version of SFS2X are you using?
Thanks
Re: Servlet exception
2.17.0
I'll break the call down and see what happens. Back soon.
I'll break the call down and see what happens. Back soon.
Re: Servlet exception
Same issue no matter how I try to declare it. Even added the code to a room extension and tried to pull that.
Re: Servlet exception
That the issue wouldn't go away it was expected, however breaking down the code in single calls helps understanding which of the object is causing the NPE.
So which one is it? Is it the ZoneManager? The Zone? The Room?
Thanks
So which one is it? Is it the ZoneManager? The Zone? The Room?
Thanks
Re: Servlet exception
Lapo wrote:That the issue wouldn't go away it was expected, however breaking down the code in single calls helps understanding which of the object is causing the NPE.
So which one is it? Is it the ZoneManager? The Zone? The Room?
Thanks
My bad, it throws it on the zone object when trying to get the zone extension or any rooms using get by name & get by ID.
Re: Servlet exception
If this is reproducible 100% of the times I think it's a symptom of some other problem.
Zones are created before the http-server is started and there is no way a certain Zone X isn't ready by the time servlets are invoked (the startup process is also mono-threaded).
The question is: are you sure the Zone you are targeting with your servlet is created without errors? I'd recommend double checking the SFS2X logs at startup time.
I am not sure what else could cause an NPE like that, other than using the wrong Zone name.
Cheers
Zones are created before the http-server is started and there is no way a certain Zone X isn't ready by the time servlets are invoked (the startup process is also mono-threaded).
The question is: are you sure the Zone you are targeting with your servlet is created without errors? I'd recommend double checking the SFS2X logs at startup time.
I am not sure what else could cause an NPE like that, other than using the wrong Zone name.
Cheers
Re: Servlet exception
The zone loads fine on startup, no errors. Several apps (Unity developed) connect, join that zone, then join rooms and play their games. The zone and room extensions work very well.
It picks up the Zone from the Zone manager without returning any errors, but I can't get anything out of the Zone object after that. I've called the zone by name and zone ID and it is always the same outcome. I'll keep working on it when I have time. Is it possibly because I have an old zone configuration file that was made in ... probably 2.13?
It picks up the Zone from the Zone manager without returning any errors, but I can't get anything out of the Zone object after that. I've called the zone by name and zone ID and it is always the same outcome. I'll keep working on it when I have time. Is it possibly because I have an old zone configuration file that was made in ... probably 2.13?
Re: Servlet exception
Hi,
no, the zone file coming from an older version is not an issue. A Zone file contains XML that defines the properties of that Zone, if the server can load it without errors, there is no problem.
I can suggest a test to perform: in your init() servlet code try calling the ZoneManager.getZoneList() method. It has the following signature:
Then see what the returned list contains. Normally you should find all your custom defined Zones plus the Admin Zone.
Let us know what you find.
Thanks
no, the zone file coming from an older version is not an issue. A Zone file contains XML that defines the properties of that Zone, if the server can load it without errors, there is no problem.
I can suggest a test to perform: in your init() servlet code try calling the ZoneManager.getZoneList() method. It has the following signature:
Code: Select all
public List<Zone> getZoneList()
Then see what the returned list contains. Normally you should find all your custom defined Zones plus the Admin Zone.
Let us know what you find.
Thanks
Re: Servlet exception
sfs = SmartFoxServer.getInstance();
List<Zone> newList = sfs.getZoneManager().getZoneList();
msg = String.valueOf(newList.size());
with the getWriter.write(msg) in doGet's first line. Returns 0. No zones in the manager then.
List<Zone> newList = sfs.getZoneManager().getZoneList();
msg = String.valueOf(newList.size());
with the getWriter.write(msg) in doGet's first line. Returns 0. No zones in the manager then.
Re: Servlet exception
We have no idea how to reproduce this, sorry.
At this point I am inclined to think that there're "hidden variables" in this specific issues, e.g. something else is not being accounted for.
We can take release 2.17.0 version out of the box and add a basic servlets that lists the Zones using this code:
And it always returns the expected list of Zones.
If you want to send us your current compiled servlet we can take a further look and test it locally. At least we can see if the behavior is consistent. To do so, send us an email to our support@... email box with a reference to this thread.
Thanks
At this point I am inclined to think that there're "hidden variables" in this specific issues, e.g. something else is not being accounted for.
We can take release 2.17.0 version out of the box and add a basic servlets that lists the Zones using this code:
Code: Select all
@Override
public void init() throws ServletException
{
sfs = SmartFoxServer.getInstance();
List<Zone> zones = sfs.getZoneManager().getZoneList();
System.out.println("Zone(s) List: " + zones);
}
And it always returns the expected list of Zones.
Code: Select all
Zone(s) List: [{ Zone: --=={{{ AdminZone }}}==-- }, { Zone: BasicExamples }
If you want to send us your current compiled servlet we can take a further look and test it locally. At least we can see if the behavior is consistent. To do so, send us an email to our support@... email box with a reference to this thread.
Thanks
Re: Servlet exception
I can't get it to return any zone. Possible something with eapps and this docker image, I'm going to set it up on Overcast and see if the issue persists.
Re: Servlet exception
Yeah, that sounds like a broken installation.
Re: Servlet exception
I've tried your sample code on a fresh 2.17.3 install on linux on eapps and another on an amazon aws ec2 windows instance. returns the correct version, but the zone list is always []
Who is online
Users browsing this forum: Stevenor and 71 guests