1

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 good idea to put only this compiled classes from archive :)

Oleksandr
  • 2,346
  • 4
  • 22
  • 34

3 Answers3

1

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.

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
  • It's interesting thing but i need class file not only in runtime. Properties file it's txt file and i want to write smth like : $class = com.myapp.webap.HelloServlet – Oleksandr Aug 30 '11 at 08:17
  • I think you can make that happen with a custom class loader. I am no Java expert though, I just play one Stackoverflow. :) – Prof. Falken Aug 30 '11 at 08:20
  • I've just read this article. But it's not i need. I just need to write class name in properties file. And this file will processed by ATG Nucleus. I'm just need to give a hint to Nucleus. This approach could have be interesting if only i processed this .properties file but it's not me (it's framework). – Oleksandr Aug 30 '11 at 08:34
  • I can write servlets in other project and use this jar file like dependency but it is a bad idea, is it? – Oleksandr Aug 30 '11 at 08:37
1

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

ERNESTO ARROYO RON
  • 992
  • 1
  • 9
  • 22
  • Thanks. It's work. But it's only temporary solution. Do you think I should move all servlets from war to another project(module) and package it in jar? I can't find another way without hackaing.... – Oleksandr Aug 30 '11 at 09:31
0

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.

Srikumar S
  • 46
  • 3