3

Adobe ColdFusion 9 Multi-Server 在 CF Admin 中没有“JVM 和 Java 设置”页面,因此要向 CF 类路径添加一些内容,对于给定实例,该实例必须使用备用 jvm.config 启动。

从备用 jvm.config 开始我没有问题。但是,我确实无法准确地知道如何以正确的方式编辑该文件。

我的库存 jvm.config 看起来像这样(忽略换行符——它们不在实际文件中):

java.args=-server -Xmx512m -Dcoldfusion.sessioncookie.httponly=true -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Djava.awt.headless=true
-Dcoldfusion.rootDir={application.home}/
-Djava.security.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/coldfusion.policy
-Djava.security.auth.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/neo_jaas.policy

我尝试将类文件夹添加到类路径中的一次比较成功的尝试如下所示。(这里只是一对。)

java.args=-server -Xmx512m -Dcoldfusion.sessioncookie.httponly=true -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Xbatch -Djava.awt.headless=true
-Dcoldfusion.rootDir={application.home}/
-Djava.security.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/coldfusion.policy
-Djava.security.auth.policy={application.home}/servers/cfusion/cfusion-ear/cfusion-war/WEB-INF/cfusion/lib/neo_jaas.policy
-Dcoldfusion.classPath={application.home}/servers/hud/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib,/var/www/apps/onecpd/GeoServices_sandbox

*我说“我更成功的尝试之一”是因为实例确实启动了,并且这些类在 CF 类路径上[我可以用 createObject() 实例化它们],但是实例启动并不干净——有很多 Flex-相关错误:

jamie@icf109118-ubuntu:/opt/jrun4/servers/hud/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib$ sudo /opt/jrun4/bin/jrun -config /opt/jrun4/bin/jvm_onecpd.config start onecpd
Starting Macromedia JRun 4.0 (Build 108858), onecpd server
03/19 11:37:34 info JRun Naming Service listening on *:2911
03/19 11:37:35 info No JDBC data sources have been configured for this server (see jrun-resources.xml)
03/19 11:37:35 info JRun Web Server listening on *:8303
03/19 11:37:35 info JRun Proxy Server listening on *:51003
03/19 11:37:35 info Deploying enterprise application "JRun 4.0 Internal J2EE Components" from: file:/opt/jrun4/lib/jrun-comp.ear
03/19 11:37:35 info Deploying EJB "JRunSQLInvoker" from: file:/opt/jrun4/lib/jrun-comp.ear
Server onecpd ready (startup time: 2 seconds)
03/19 11:37:35 info Deploying enterprise application "cfusion" from: file:/opt/jrun4/servers/onecpd/cfusion.ear/
03/19 11:37:36 info Deploying web application "cfusion" from: file:/opt/jrun4/servers/onecpd/cfusion.ear/
java.lang.ClassNotFoundException: flex.server.j2ee.cache.CacheFilter
    at coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:235)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at coldfusion.bootstrap.ClassloaderHelper.initFilterClass(ClassloaderHelper.java:123)
    at coldfusion.bootstrap.BootstrapFilter.init(BootstrapFilter.java:34)
    at jrun.servlet.FilterObject.init(FilterObject.java:63)
    at jrun.servlet.FilterManager.loadFilter(FilterManager.java:220)
    at jrun.servlet.FilterManager.init(FilterManager.java:158)
    at jrun.servlet.FilterManager.create(FilterManager.java:75)
    at jrun.servlet.WebApplicationService.start(WebApplicationService.java:230)
    at jrun.ea.EnterpriseApplication.start(EnterpriseApplication.java:194)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:708)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:243)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:428)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:889)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
03/19 11:37:36 user failed to load: flex.server.j2ee.cache.CacheFilter
03/19 11:37:36 error Error loading class for Filter CFCacheFilter: Filter is disabled.
[1]java.lang.ClassNotFoundException: flex.server.j2ee.cache.CacheFilter
    at coldfusion.bootstrap.BootstrapClassLoader.loadClass(BootstrapClassLoader.java:235)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at coldfusion.bootstrap.ClassloaderHelper.initFilterClass(ClassloaderHelper.java:123)
    at coldfusion.bootstrap.BootstrapFilter.init(BootstrapFilter.java:34)
    at jrun.servlet.FilterObject.init(FilterObject.java:63)
    at jrun.servlet.FilterManager.loadFilter(FilterManager.java:220)
    at jrun.servlet.FilterManager.init(FilterManager.java:158)
    at jrun.servlet.FilterManager.create(FilterManager.java:75)
    at jrun.servlet.WebApplicationService.start(WebApplicationService.java:230)
    at jrun.ea.EnterpriseApplication.start(EnterpriseApplication.java:194)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:708)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:243)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:428)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:889)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
[0]javax.servlet.ServletException: flex.server.j2ee.cache.CacheFilter
    at coldfusion.bootstrap.ClassloaderHelper.initFilterClass(ClassloaderHelper.java:132)
    at coldfusion.bootstrap.BootstrapFilter.init(BootstrapFilter.java:34)
    at jrun.servlet.FilterObject.init(FilterObject.java:63)
    at jrun.servlet.FilterManager.loadFilter(FilterManager.java:220)
    at jrun.servlet.FilterManager.init(FilterManager.java:158)
    at jrun.servlet.FilterManager.create(FilterManager.java:75)
    at jrun.servlet.WebApplicationService.start(WebApplicationService.java:230)
    at jrun.ea.EnterpriseApplication.start(EnterpriseApplication.java:194)
    at jrun.deployment.DeployerService.initModules(DeployerService.java:708)
    at jrun.deployment.DeployerService.createWatchedDeployment(DeployerService.java:243)
    at jrun.deployment.DeployerService.deploy(DeployerService.java:428)
    at jrun.deployment.DeployerService.checkWatchedDirectories(DeployerService.java:179)
    at jrun.deployment.DeployerService.run(DeployerService.java:889)
    at jrunx.scheduler.SchedulerService.invokeRunnable(SchedulerService.java:230)
    at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

请注意,如果不将 {application.home}/servers/hud/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib 添加到 Dcoldfusion.classPath,服务器根本不会真正启动。

那么,在 jvm.config 中干净地向 ColdFusion 类路径添加内容的神奇公式是什么?

4

1 回答 1

3

来自 Christian Cantrell - 工程经理和传播者,我给你ColdFusion 类路径的权威指南(虽然它有点过时了)

以下是我认为与您的设置相关的部分摘录:

J2EE 部署

  1. 将类或 jar 文件添加到类路径的最简单方法是简单地将它们放在 lib 目录中,它们会自动被拾取。该目录位于 {cf_installation}/servers/lib。这些类文件将可供所有服务器使用。

  2. 您还可以通过将类文件放到“{cf_installation}/servers/default/cfmx/WEB-INF/lib”中,使您的类文件仅对 ColdFusion 服务器可用。(请注意,将它们放入 {cf_installation}/servers/default/cfmx/WEB-INF/cfusion/lib 将不起作用。)

  3. 您可以将它们放在任何 Java 扩展目录中。要查找 Java 扩展目录列表,请打开 ColdFusion 管理员并单击“系统信息”。在底部,您将看到一个名为“Java Ext Dirs”的系统属性。您可以将 jar 和 class 文件放在任何这些目录中,以让 ColdFusion 服务器获取它们。

  4. 另一种方法是通过 JRun 管理控制台添加类。打开控制台,在默认服务器下,单击设置,然后将您的类添加到类路径列表中。(注意您也可以点击默认服务器下的“ColdFusion MX 应用程序”,然后点击设置进行相同的更改。)

  5. 最后,再一次,您可以自己编辑 jvm.config 文件,但我还是建议您坚持使用上述方法之一。

从下面的评论更新

When editing the jvm.config file (option 5), try adding the directory path to the java.class.path= line in the jvm.config file (at the bottom). Not in the java.args= as you have done in the posted example.

于 2013-03-19T17:16:53.430 回答