0

In jar:

Class A {getter setter}

In war:(load above jar runtime)

Class B {A a=new A()}

Problem :

Now the actual problem was when I deploy the war without adding that jar dependency (in pom), but want to pick that jar from some local sys folder when I deploy that war.

I tried URLClassLoader, problem here is I am able to load all the classes from jar, but still Class A is unable to resolve.

heenenee
  • 19,914
  • 1
  • 60
  • 86
Satscreate
  • 495
  • 12
  • 38
  • 1
    Try to google first. Possible duplicate of [How should I load Jars dynamically at runtime?](http://stackoverflow.com/questions/60764/how-should-i-load-jars-dynamically-at-runtime) – Kirill Jul 22 '15 at 17:36
  • Yah thanks kirill, tried all even the first approach works nicely which I googled the same, but when I build tat war first it's getting failed... But I can able to get the class which am looking for. But when I deploy into tomcat it should execute one class loader which I wrote and add that jar as a dependency for my war?? Tats a doubt – – Satscreate Jul 22 '15 at 17:50
  • Add the jar that contains Class A as a dependency to your war's pom file, but add it as `provided` so it doesn't get bundled and in the way of your `sys` folder loading. – heenenee Jul 22 '15 at 18:06
  • Yep... Tats the Usual way heenenee...in tat case I need to put tat jar as a dependency in Pom... I don't want tat...as simple we can say need to do the same Pom logic in Java class.. How.??? – Satscreate Jul 22 '15 at 18:31

0 Answers0