简体   繁体   English

在Weblogic(Linux)上部署的Web应用程序中创建用于读取值的属性文件的位置

[英]Where to creating properties file for reading values in a Web application deployed on Weblogic(Linux)

I have a Web application consisting of JSPs, Servlets and Java classes developed in Jdeveloper in Windows. 我有一个Web应用程序,包括在Windows中的Jdeveloper中开发的JSP,Servlet和Java类。

This applicaiton need to be deployed as WAR in Weblogic over a linux box. 此应用程序需要在Linux框中通过Weblogic部署为WAR。 Some of the servlet and Java classes have certain values hardcoded. 某些servlet和Java类具有硬编码的某些值。 I want to avoid this but for obvious reasons. 我想避免这种情况,但原因很明显。 Therfore I was thinking of using the properties file. 因此,我正在考虑使用属性文件。

Now where do i create this properties file in my jdeveloper so that when i create war file of it and and deploy to a Weblogic server, i have access to this Properties file or how should i code it my program so that wherever I put this properties file on my linux like \\u01\\cap\\domain\\machine\\domain_name\\readvalues.properties. 现在我在哪里可以在我的jdeveloper中创建这个属性文件,这样当我创建它的war文件并部署到Weblogic服务器时,我可以访问这个属性文件,或者我应该如何编写我的程序,以便无论我把这个属性放在哪里我的linux上的文件,如\\ u01 \\ cap \\ domain \\ machine \\ domain_name \\ readvalues.properties。 t is able to read it. t能够阅读它。

and then how do i mention the path in linux. 然后我如何在linux中提到路径。 Can you please help me with the code 你能帮我解释一下代码吗?

Stick the properties file in your war file and access it like you would any other properties file via: 将属性文件粘贴到war文件中,并像访问任何其他属性文件一样访问它:

props.load(MyClass.class.getResourceAsStream("/someProps.properties"));

The best place to put the properties file is in the /WEB-INF/classes folder. 放置属性文件的最佳位置是/ WEB-INF / classes文件夹。 So you need to load the properties files relative to that. 所以你需要加载相对于它的属性文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 部署在Tomcat上的WAR文件未读取application.properties文件 - WAR file deployed on Tomcat not reading application.properties File 在Java Web应用程序中读取属性文件 - Reading properties file in Java web application 在哪里可以找到部署在weblogic服务器10.3.5上的应用程序日志? - Where to find the application log that deployed on weblogic server 10.3.5? 从Tomcat Web应用程序调用在Weblogic上部署的远程Ejb bean - Remote Ejb bean deployed on Weblogic called from Tomcat web application Spring 配置文件未从 application.properties 读取值 - Spring Configuration file not reading values from application.properties 部署的GWT Web应用程序找不到属性文件中指定的路径 - Deployed GWT web application can't find path specified in properties file 在Linux服务器上部署的Java Web应用程序中上载文件时,权限被拒绝 - Permission denied when upload file in java web application deployed on linux server 从属性文件读取值 - Reading values from properties file 为Java / WebLogic Web Services创建特定于应用程序实例的缓存 - Creating an application instance specific cache for Java/WebLogic Web Services 需要从Java代码中获取将我的应用程序部署到的weblogic主机名 - Need to get the weblogic hostname where my application is deployed from within my java code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM