4

I am trying to create and load dynamically classes in weblogic (10.3.2.0). It is ADF application which I deploy to the weblogic server.

When I print

((GenericClassLoader)this.getClass().getClassLoader()).getFinderClassPath()

I see the path to my directory (of course not just this path)

C:\...\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp\_WL_user\test\753the\dynamicClasses

(I have added directory dynamicClasses to manifest for deployment WAR profile). In this directory I create class files. I have checked it, files are really created there. When I try to load created class with the same classloader, for which I have printed classpath, ClassNotFoundException is thrown.

It knows the path to the directory with classes and to jar file, but it doesn't load classes.

With URLClassLoader I can load classes. But I need so that my classes would be seen by the classes loaded "usual" way.

I am able to run it correctly just with system CLASSPATH.

Please, do you know an explanation? Is the manifest file in WAR the wrong place for specifiing classpath?

Thank you in advance

Qjeta

qjeta
  • 41
  • 1
  • 2
  • just a note: because I need to create classes on runtime, I need to know where to save them (this makes method getFinderClassPath) and to load them (to set correctly the classpath) – qjeta Mar 12 '10 at 10:48
  • Have you read Understanding WebLogic Server Application Classloading: http://download.oracle.com/docs/cd/E12840_01/wls/docs103/programming/classloading.html – David G Mar 13 '10 at 16:19
  • yes, but I haven't found there answer for my issue. I may miss something. – qjeta Mar 15 '10 at 11:44

1 Answers1

0

Have you tried with the trailing slash

C:...\system11.1.1.2.36.55.36\DefaultDomain\servers\DefaultServer\tmp_WL_user\test\753the\dynamicClasses\

Or does it only work with jar names if given via the MANIFEST file, and not with directory name.

JoseK
  • 31,141
  • 14
  • 104
  • 131
  • For jar files, it doesn't work too. Trailing slash didn't help. It looks like that classpath from manifest file is for some reason ignored. Thanks for reply – qjeta Mar 12 '10 at 10:33
  • To rule out, the final MANIFEST is packaged under META-INF/ right? Can you follow this example http://stackoverflow.com/questions/1272648/need-to-read-own-jars-manifest-and-not-root-classloaders-manifest and force the loading of MANIFEST and check the classpath as it's attribute? – JoseK Mar 12 '10 at 11:11
  • I have ear which contains war. in manifest files of both is written classpath to my directory. getFinderClassPath() contains path to my directory just when manifest fie is inside war (ear's manifest file seems to influence nothing). When I printout Class-Path attributes from all Manifest files, there is not path to my directory – qjeta Mar 12 '10 at 12:48