Problems reading SQLTag values

Hi guys,
I’m trying to read values from some DB tags from my GatewayHook.

Here’s the code:

[code] // Test the SQLTag read
try {
List pathList = new ArrayList();

		List<TagReadResult> resultList;
		resultList = context.getTagManager().read(pathList, context.getAuthenticationManager().getProfile("default").authenticate("admin", "password"), true);
		System.out.println("tag value for [default]Mode: "+resultList.get(0).getValue().getValue());
	catch (Exception e) {
		System.out.println("Could not get tag value for [default]Mode:");

It’s giving me an error. The relevant part of the stacktrace below:

Could not get tag value for [default]Mode: java.lang.NullPointerException at at at com.inductiveautomation.webservices.gateway.WebServicesGatewayHook.startup

Any ideas on why this might be happening? The “[default]Mode” tag does exist. Thanks!

When reading tags from the default provider, this works:

If you’re using some other provider, then you would have to use:

It’s inconsistent with what you see in the designer’s tag browser, but makes sense on some level. Ideally, what you’re doing would work as well.

It would appear here that the problem is more with your authentication procedure.

That NPE is coming from trying to check the authenticated user. Bad form on our part, shouldn’t error out. But, it appears that AuthenticationProfile.authenticate() will return null if the authentication fails.

Your parsing of “[default]Mode” is correct - in the gateway, you’re not under a project, so you won’t have a “default provider”, so leaving it off will only return an Config Error quality. Note, for others reading this, if it’s not immediately clear: the default provider that is created by the system is actually called “default”, so that’s what he’s referring to here.

Hope this helps…

Actually, there’s another problem, if the tag’s permission set happens to be null… which unfortunately can happen fairly easily. This has been fixed for 7.2.9.