Copy link to clipboard
Copied
This code has worked fine in versions 7.x to 9.x.
<cfset factory = createobject("java", "coldfusion.server.ServiceFactory")>
<cfset service = factory.getDataSourceService()>
<cfset datasources = service.getDataSources()>
Now in 9.0.1 it errors on the last command with a generic "Error processing request" message. The exception.log shows:
"Error","jrpp-148","08/13/10","08:32:16",,"'' The specific sequence of files included or processed is: E:\Inetpub\wwwroot\....., line: 32 "
coldfusion.security.SecurityManager$UnauthenticatedCredentialsException
at coldfusion.security.SecurityManager.authenticateAdmin(SecurityManager.java:1958)
at coldfusion.sql.Executive.getDatasources(Executive.java:96)
It appears to be related to security, most likely checking for Administrator privilege. Any one have any ideas how to get around this? Thanks.
Michael
Copy link to clipboard
Copied
Try executing the login() method of cfide.adminapi.administrator first.
Copy link to clipboard
Copied
Good suggestion but I just tried it and it did not make a difference. The adminapi object is unrelated to the serviceFactory object so it does not see that the session is authenticated. I tried creating a coldfusion.server.ServiceFactory.getSecurityService() object and dumping it to see the methods. There is a method called authenticateAdmin( ) but that also generates the same exception.
Copy link to clipboard
Copied
Then I suggest you rewrite it to use the getDatasources() method of CFIDE.adminapi.datasource.
Copy link to clipboard
Copied
I was not aware of that API call and I just did a quick test and it looks like it will work. Thanks!
Michael
Copy link to clipboard
Copied
And the good thing about that API is that it is supported: if it breaks
from one version to the next you can file a bug. The internal stuff is
all "use at your own risk".