简体   繁体   English

Java Web应用程序中的项目引用问题

[英]Issue with Project References in Java Web Application

My project structure is as follows: 我的项目结构如下:

matrixWeb
----src(for Java code)
----WebContent
    ----WEB-INF
        ----lib
            ----custome-develop.jar
    ----resources (contains some config files under this folder)

Now another java code (custome-develop.jar) is being used and this code is packaged as jar and put inside the lib folder with all the references. 现在,正在使用另一个Java代码(custome-develop.jar),此代码打包为jar,并与所有引用一起放入lib文件夹中。 Now from my 'src' folder I am able to access code in that jar file. 现在,从我的“ src”文件夹中,我可以访问该jar文件中的代码。 But that custome-develop.jar needs to access the config files to under resource folder to do processing (resource folder contains property files for queuemanager name, queuename etc.). 但是custome-develop.jar需要访问资源文件夹下的配置文件以进行处理(资源文件夹包含用于队列管理器名称,队列名称等的属性文件)。

Could anybody tell me how to access the resource folder to get the property file. 谁能告诉我如何访问资源文件夹以获取属性文件。

I used below code but in that custome-develop.jar but did not worked: 我使用了下面的代码,但在那个custome-develop.jar中却没有用:

InputStream pin = Thread.currentThread().getContextClassLoader()
                .getResourceAsStream("/../../resources/QueueDetails.properties);

this 'pin' is null object. 此“ pin”为空对象。

I am using JBoss 7.1 and Java6 and doing admin console deployment! 我正在使用JBoss 7.1和Java6并进行管理控制台部署!

Please help me regarding this. 请帮助我。

Thanks, Debashis 谢谢,Debashis

Add your properties file in Jboss standalone.xml considering that you are using standalone application 考虑到您正在使用独立应用程序,请在Jboss standalone.xml添加属性文件

<system-properties>
     <property name="URLLIST" value="path for properties file"/>
</system-properties>

Then you can able to access this properties by using 然后,您可以使用来访问此属性

String prop = System.getProperty("PROPERTY_NAME_UNDER_UR_FILE");

See details 阅读详情

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM