問(wèn)題描述
Adobe ColdFusion 9 Multi-Server 在 CF Admin 中沒(méi)有JVM 和 Java 設(shè)置"頁(yè)面,因此要向 CF 類(lèi)路徑添加一些內(nèi)容,對(duì)于給定實(shí)例,該實(shí)例必須使用備用 jvm 啟動(dòng).配置.
Adobe ColdFusion 9 Multi-Server doesn't have the "JVM and Java Settings" page in the CF Admin, so to add something to the CF classpath, for a given instance, that instance must be started with an alternate jvm.config.
從備用 jvm.config 開(kāi)始我沒(méi)有問(wèn)題.但是,我確實(shí)準(zhǔn)確地知道如何以正確的方式編輯該文件.
I don't have a problem with starting with an alternate jvm.config. I do, however, have a problem knowing precisely how to edit that file in the proper way.
我的庫(kù)存 jvm.config 看起來(lái)像這樣(忽略換行符——它們不在實(shí)際文件中):
My stock jvm.config looks like this (ignore line breaks--they are not in the actual file):
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
我嘗試將類(lèi)文件夾添加到類(lèi)路徑中的一個(gè)比較成功的嘗試如下所示.(這里只是一對(duì).)
One of my more successful* attempts at adding a folder of classes to the classpath looks like this. (Here are just a couple.)
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
*我說(shuō)我更成功的嘗試之一"是因?yàn)閷?shí)例確實(shí)啟動(dòng)了,并且這些類(lèi)在 CF 類(lèi)路徑上[我可以使用 createObject() 實(shí)例化它們],但是實(shí)例啟動(dòng)并不干凈——有許多與 Flex 相關(guān)的錯(cuò)誤:
*I say "one of my more successful attempts" because the instance does start, and those classes are on the CF classpath [I can instantiate them with createObject()], but the instance start is not clean--there are many Flex-related errors:
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)
請(qǐng)注意,如果不將 {application.home}/servers/hud/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib 添加到 Dcoldfusion.classPath,服務(wù)器根本不會(huì)真正啟動(dòng).
Note that without adding {application.home}/servers/hud/cfusion.ear/cfusion.war/WEB-INF/cfusion/lib to Dcoldfusion.classPath, as well, the server wouldn't really start at all.
那么,在 jvm.config 中干凈地向 ColdFusion 類(lèi)路徑添加內(nèi)容的神奇公式是什么?
So, what is the magic formula for cleanly adding something to the ColdFusion classpath in jvm.config?
推薦答案
來(lái)自 Christian Cantrell - 工程經(jīng)理和傳播者,我給你 ColdFusion 類(lèi)路徑權(quán)威指南(雖然有點(diǎn)過(guò)時(shí)了)
From Christian Cantrell - Engineering Manager and Evangelist, I give you The Definitive Guide to the ColdFusion Classpath (although it is a bit dated)
以下是我認(rèn)為與您的設(shè)置相關(guān)的部分摘錄:
Here is an excerpt of the portion that I think relates to your setup:
J2EE 部署
將類(lèi)或 jar 文件添加到類(lèi)路徑的最簡(jiǎn)單方法是簡(jiǎn)單地將它們放到 lib 目錄中,它們會(huì)自動(dòng)被拾取.該目錄位于 {cf_installation}/servers/lib.這些類(lèi)文件將可供所有服務(wù)器使用.
The easiest way to add class or jar files to your class path is to simply drop them in the lib directory where they are automatically picked up. The directory is located at {cf_installation}/servers/lib. These class files will be available to all servers.
您還可以通過(guò)將類(lèi)文件放到{cf_installation}/servers/default/cfmx/WEB-INF/lib"中,使它們僅對(duì) ColdFusion 服務(wù)器可用.(請(qǐng)注意,將它們放入 {cf_installation}/servers/default/cfmx/WEB-INF/cfusion/lib 將不起作用.)
You can also make your class files available only to the ColdFusion server by dropping them in "{cf_installation}/servers/default/cfmx/WEB-INF/lib". (Note that putting them in {cf_installation}/servers/default/cfmx/WEB-INF/cfusion/lib will NOT work.)
您可以將它們放在任何 Java 擴(kuò)展目錄中.要查找 Java 擴(kuò)展目錄列表,請(qǐng)打開(kāi) ColdFusion 管理員并單擊系統(tǒng)信息".在底部,您將看到一個(gè)名為Java Ext Dirs"的系統(tǒng)屬性.您可以將 jar 和 class 文件放在任何這些目錄中,以讓 ColdFusion 服務(wù)器獲取它們.
You can drop them in any of the Java extension directories. To find a list of the Java extension directories, open the ColdFusion administrator and click on "System Information". Toward the bottom, you will see a system property called "Java Ext Dirs". You can put jar and class files in any of those directories to have them picked up by the ColdFusion server.
另一種方法是通過(guò) JRun 管理控制臺(tái)添加類(lèi).打開(kāi)控制臺(tái),在默認(rèn)服務(wù)器下,單擊設(shè)置,然后將您的類(lèi)添加到類(lèi)路徑列表中.(注意您也可以點(diǎn)擊默認(rèn)服務(wù)器下的ColdFusion MX 應(yīng)用程序",然后點(diǎn)擊設(shè)置進(jìn)行相同的更改.)
Another way to do it is to add classes through the JRun Management Console. Open up the console, and under the default server, click on settings, then add your classes to the class path list. (Note you can also click on "ColdFusion MX application" under the default server, then click on settings to make the same changes.)
最后,再一次,您可以自己編輯 jvm.config 文件,不過(guò),我還是建議您堅(jiān)持使用上述方法之一.
And finally, once again, you can edit the jvm.config file yourself, however again, I recommend you stick to using one of the methods above.
以下評(píng)論的更新
編輯 jvm.config 文件時(shí)(選項(xiàng) 5),嘗試將目錄路徑添加到 jvm.config 文件中的 java.class.path=
行(在底部).不像您在發(fā)布的示例中所做的那樣在 java.args=
中.
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.
這篇關(guān)于在多服務(wù)器 Adob??e Coldfusion 9 中為特定實(shí)例添加到 ColdFusion 類(lèi)路徑的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!