【问题标题】:WebSphere Application Server JVM arguments not being read properly未正确读取 WebSphere Application Server JVM 参数
【发布时间】:2014-10-22 01:40:16
【问题描述】:

我们正在使用 WebSphere 7- 应用程序服务器来部署项目,并且这个应用程序服务器被赋予了这样的简单 JVM 参数,

–Dsecurityresource=/web/sharedLibraries/security_config.xml -DConfig=/web/properties/Config.ini

但是当尝试启动应用程序服务器时,会抛出一个原生错误(native_stderr.log),

<?xml version="1.0" ?>

<verbosegc version="GA24_Java6_SR15_20131016_1337_B170922_CMPRSS">

<initialized>
  <attribute name="gcPolicy" value="-Xgcpolicy:optthruput" />
  <attribute name="maxHeapSize" value="0x100000000" />
  <attribute name="initialHeapSize" value="0xc0000000" />
  <attribute name="compressedRefs" value="true" />
  <attribute name="compressedRefsDisplacement" value="0x0" />
  <attribute name="compressedRefsShift" value="0x3" />
  <attribute name="pageSize" value="0x10000" />
  <attribute name="requestedPageSize" value="0x10000" />
</initialized>

Exception in thread "main" java.lang.NoClassDefFoundError: Dsecurityresource=.web.sharedLibraries.security-config.xml
Caused by: java.lang.ClassNotFoundException: Dsecurityresource=.web.sharedLibraries.FalconCluster.security-config.xml
    at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:677)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
</verbosegc>
Could not find the main class: Dsecurityresource=/web/sharedLibraries/security-config.xml.  Program will exit.

JVM 参数在 WebSphere 中的以下位置给出。

Servers > Server Types > WebSphere application servers > server_name >Java and process management > Process definition > Java virtual machine and in Generic JVM arguments

它抛出 NoClassDefFoundError 很奇怪。

或者 Websphere 中是否有任何其他配置可能导致此问题?

注意:JVM参数中提供的文件和路径存在并且具有读取和执行权限

提前致谢。

【问题讨论】:

  • 查看 NoClassDefFoundError 我认为您没有提到参数作为 JVM 参数。它被解析为类名
  • @Neeraj:它作为 JVM 参数传递(编辑帖子)。但是有些它是如何作为类名传递的。这就是谜团。

标签: java jvm noclassdeffounderror websphere-7 jvm-arguments


【解决方案1】:

您在哪里设置这些参数?
您应该通过管理控制台设置它们:
Servers &gt; Server Types &gt; WebSphere application servers &gt; server_name。 然后,点击Java and process management &gt; Process definition &gt; Java virtual machine

或者把它们放在:

  • Generic JVM arguments 使用 -Dparameter=value
  • Custom Properties将参数定义为名称,将值定义为值

更新
当我粘贴您的变量时,它包含以下不可见字符而不是 -D 并得到相同的异常:

–Dsecurityresource

但是当我去的时候:

C:\IBM\WebSphere\AppServer85\profiles\AppSrv1\config\cells\cellName\nodes\nodeBame\servers\server1 

并手动修复server.xml文件中的条目,服务器正确启动。

 <jvmEntries xmi:id="JavaVirtualMachine_1183121908656" .... genericJvmArguments="-Xquickstart -Dsecurityresource=/web/sharedLibraries/security_config.xml -DConfig=/web/properties/Config.ini" ...>

所以请使用文本编辑器打开该文件,并在第一个 D 之前修复 - 字符。

【讨论】:

  • 是的,参数设置在正确的位置,如您所说的服务器 > 服务器类型 > WebSphere 应用程序服务器 > server_name >Java 和进程管理 > 进程定义 > Java 虚拟机和通用 JVM 参数。抱歉,我之前忘了提。
  • 因为它讲述了 java.lang.NoClassDefFoundError: Dsecurityresource=.web.sharedLibraries.security-config.xml 我猜那个参数后面有隐藏的 \n 。尝试将这些参数复制到纯文本编辑器并返回,或者手动清理并键入它们。
  • 没有 \n 个字符。所有参数都很好。但仍然是同样的问题。
  • @Rajath 更新了答案。可能发现了你的问题。
  • 我来这里是为了消除一个类似的问题,但我从答案中找到了文件。谢谢大家
猜你喜欢
  • 2017-07-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-05
  • 1970-01-01
相关资源
最近更新 更多