如何在 Weblogic Admin Console 中设置属性文件的类路径? [英] How to set the classpath of properties file in Weblogic Admin Console?

查看:32
本文介绍了如何在 Weblogic Admin Console 中设置属性文件的类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Apache Tomcat 服务器.

I am using Apache Tomcat Server.

在加载应用程序时,它从一个属性文件中读取,该文件通常会放置在 Tomcat 服务器的 lib 文件夹中.

While the application is loading it reads from a properties file and the file will be usuall placed in the lib folder of Tomcat server.

由于我使用的是 Windows 7,我需要在 Weblogic Server 10.3.5 上测试应用程序

Since I am using Windows 7 and I need to test the application on Weblogic Server 10.3.5

在运行应用程序时,它无法将应用程序部署到服务器,因为服务器找不到属性文件.

While running the application it cannot deploy the application to the server because the server cannot find the properties file.

我尝试在

服务器 > AdminServer > 服务器启动 > 类路径

并尝试将属性文件放在Weblogic Server HOME中

and tried to put the propertues file in the Weblogic Server HOME

C:\ORA_WL\MIDDLEWARE\user_projects\domains\base_domain\lib

但是还是报错

java.lang.Exception: java.lang.NoClassDefFoundError: 无法初始化类 com.bonsai.webutility.properties.SystemProperties

java.lang.Exception: java.lang.NoClassDefFoundError: Could not initialize class com.bonsai.webutility.properties.SystemProperties

推荐答案

您的班级尝试在哪里查找属性文件?使用相对路径?

Where does your class attempt to find the properties file? Using a relative path?

Server Start 选项卡仅适用于使用节点管理器启动的服务器,而不适用于使用 startWebLogic 脚本启动的服务器.因此,如果您的应用程序在管理服务器上运行,您可能需要编辑 startWeblogic 脚本本身以将属性文件放在您的类路径中.

The Server Start tab only applies to servers started with the node manager, not with the startWebLogic script. So if your application is running on the admin server, you probably need to edit the startWeblogic script itself to put the properties file on your classpath.

更好的选择是将属性文件直接打包在您的 .war/.ear 中.参考这里的解决方案:Java:在战争中访问属性文件

A better option is to package the properties file directly in your .war/.ear. Reference the solution here: Java: Accessing properties file inside a war

这篇关于如何在 Weblogic Admin Console 中设置属性文件的类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆