English 中文(简体)
冷漠——java物体法
原标题:ColdFusion - java object method call

我试图从我的服务器获得数据来源清单(即我是服务器所有人......这不是一个黑板)。

我认为,我混淆了这一问题,举了两个例子:因此,我把这个职位编辑成一个例子,并 trace。

<><><>>>>

// Create Data Source Object
admin = new cfide.adminapi.Administrator();
admin.login("admin","[password]");

dbserv = createobject("java","coldfusion.server.ServiceFactory").getDatasourceService();
dblist = dbserv.getDatasources(); 
writedump(dblist);

www.un.org/spanish/ecosoc Error 信

The error occurred in C:wwwroot[path][file].cfm: line 6
4 : 
5 :     dbserv = createobject("java","coldfusion.server.ServiceFactory").getDatasourceService();
6 :     dblist = dbserv.getDatasources(); 
7 :     writedump(dblist);
8 : </cfscript>

www.un.org/spanish/ecosoc 标记:

Check the ColdFusion documentation to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.
Browser     Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
Remote Address      127.0.0.1
Referrer    
Date/Time       17-May-12 09:08 AM
Stack Trace
 at cf[file]2ecfm302094979.runPage(C:wwwroot[path][file].cfm:6)

coldfusion.security.SecurityManager$UnauthenticatedCredentialsException
at coldfusion.security.SecurityManager.authenticateAdmin(SecurityManager.java:1958)
at coldfusion.sql.Executive.getDatasources(Executive.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at coldfusion.runtime.StructBean.invoke(StructBean.java:508)
at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2393)
at cf[file]2ecfm302094979.runPage(C:wwwroot[path][file].cfm:6)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:381)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:94)
at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)
at coldfusion.CfmServlet.service(CfmServlet.java:200)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

Debugging Information
ColdFusion Server Developer     9,0,1,274733
Template    [path]/[file].cfm
Time Stamp  17-May-12 09:08 AM
Locale  English (US)
User Agent  Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20100101 Firefox/12.0
Remote IP   127.0.0.1
Host Name   127.0.0.1

Execution Time

top level (16ms) C:wwwroot[path][file].cfm
  · arrowtop level (0ms) CFC[ C:wwwrootCFIDEadminapiadministrator.cfc | login(admin, [password]) ] from C:wwwrootCFIDEadminapiadministrator.cfc @ line 3

(46 ms) STARTUP, PARSING, COMPILING, LOADING, & SHUTDOWN
(62 ms) TOTAL EXECUTION TIME
red = over 250 ms execution time

Exceptions

09:08:11.011 - coldfusion.security.SecurityManager$UnauthenticatedCredentialsException - in C:wwwroot[path][file].cfm : line 6
问题回答
dbserv = createobject("java","coldfusion.server.ServiceFactory").getDatasourceService();
dblist = dbserv.getDatasources(); 
writedump(dblist);

这在冷战时期。 如果你获得有保障的例外情况,那么你需要像行政那样做。

admin = new cfide.adminapi.Administrator();
admin.login("password","admin");

以下法典将不可行:

dbserv2 = createobject("java","coldfusion.server.DataSourceService");
dblist2 = dbserv2.getDatasources();

这种做法是没有找到的。 这主要是因为数据服务是一种 j的接口,而且没有采用这种方法。 由行政部门执行。

如果你丢掉了你的serv2 变数,你就会看到它不是一个目标,那就是一个 Java接口,无法立即进行。

请你要求服务厂提供数据来源服务。

<cfscript>
    dbserv2 = createobject("java","coldfusion.server.ServiceFactory").getDataSourceService();

    dblist2 = dbserv2.getDatasources();
</cfscript>

对可能担任这一职务的其他人来说,另一种方式是做想要做的事情,而无需与CF Admin密码认证,而是使用数据服务局的委托书,而不是获取数据。 该数据库接收了服务器上登记的所有数据来源名称。

<cfscript>
    dbserv3 = createobject("java","coldfusion.server.ServiceFactory").getDataSourceService();
    dblist3 = dbserv3.getNames();
</cfscript>

This works on CF11





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签