开发者

How to deploy to jboss a file folder into a jar?

I'm developing a Jboss web service that requires to access files which are in a folder of the project. When I deploy the web service, 开发者_运维百科it creates a .jar, but the folder doesn't go inside of it, even if I added it to build path.

How do i tell jboss to place the folder inside of the .jar?

Thanks in advance.


I assume, because you explicitely say "jar" that your webservices are ejb endpoints, and not JAX-RPC servlet based webservices (because those would be packaged in a .war).

Unlike servlets, who are somewhat capable of finding files inside the project (as long as you can express their location as an offset to the web folder you can determine theire real location with ServletContext's getRealPath() EJB's don't have any "automatic" notion of directories.

So even if you could convince Eclipse to deploy files for you, I doubt it would help you much.

EDIT: in a web-archive (.war) everything inside the web folder will be accessible by the servlets at runtime via the mechanism explained before. Do note however that files inside web are accessible via the web interface, except those inside the WEB-INF folder, so I'd suggest to at least store your files somewhere in a subdirectory of WEB-INF.

On a more global scale you should also ask yourself the question if you really must deploy these files with the application - and redeploy them with each redeployment. One solution in that case is to create some directory on the server (say c:/applicationfiles), create a JVM option e.g. -Dserverfilestore=c:/applicationfiles and have your application determine that directory with

String storebase=System.getProperty("serverfilestore");

The rest should be quite obvious. This solution will also work with you EJB services btw.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜