开发者

Is it possible to use war archive as library?

开发者 https://www.devze.com 2023-03-31 12:15 出处:网络
In my application I have a directory that is in CLASS_PATH and where I store jar files. I use ATG so have to use my .class in properie file to have a way to init components (in this situation it\'s se

In my application I have a directory that is in CLASS_PATH and where I store jar files. I use ATG so have to use my .class in properie file to have a way to init components (in this situation it's servlet). So I need my webapp.war in my CLASS_PATH direcory. I put this war file but it does'nt work. How can I put my compiled servlet classes to this directory?

Of course it's not开发者_Go百科 good idea to put only this compiled classes from archive :)


I think what you are looking for is a custom class loader, adapted to handle WAR files. Such a class loader would unpack or peek into the WAR file, to extract the class files.

I have never heard of anyone loading from within WAR files, but it should not be that hard to implement.


Your classloader can not find the servlet classes in war because are in WEB-INF/classes.

Try to unzip and copy WEB-INF/classes to a classpath location


In ATG, Classpath setting start from the way in which you build the ear. Every module in ATG has a MANIFEST file, which specifies an attribute called "ATG Classpath". The value of this attribute is used to construuct the classpath at runtime. So, if you include the path to your class files as a value to this attribute, ATG automatically sets this in the classpath (runAssembler, to be more specific) when creating the ear. Jboss when deploying the ear will then pick it up.

0

精彩评论

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