0

I am on WAS 6.0.2. I need an XML file in classpath for one of my applications.

Taking help from this post , I've configured Shared Library "common" with node scope. The shared library has the following entry.

C:\WebSphere\AppServer\CommonLibs\Config.xml

I then associated the shared libary with my application. When I run the server, I see the following in the log.

[2/10/11 7:36:13:614 EST] 00000017 CompoundClass E   WSVR0120E: An error occurred processing 
C:\WebSphere\AppServer\CommonLibs\Config.xml
java.util.zip.ZipException: Error opening zip file     
C:\WebSphere\AppServer\CommonLibs\Config.xml
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:140)
at java.util.jar.JarFile.<init>(JarFile.java:160)
at java.util.jar.JarFile.<init>(JarFile.java:98)
at com.ibm.ws.classloader.SinglePathClassProvider.buildContentsCache(SinglePathClassProvider.java:557)
at com.ibm.ws.classloader.SinglePathClassProvider.<init>(SinglePathClassProvider.java:99)
at com.ibm.ws.classloader.SinglePathClassProvider.create(SinglePathClassProvider.java:123)
at com.ibm.ws.classloader.CompoundClassLoader.addPaths(CompoundClassLoader.java:234)
at com.ibm.ws.classloader.JarClassLoader.addPaths(JarClassLoader.java:101)
at com.ibm.ws.classloader.ClassGraph.createClassLoaders(ClassGraph.java:472)
at com.ibm.ws.classloader.ClassGraph.calculate(ClassGraph.java:214)
at com.ibm.ws.classloader.ClassLoaderManager.initialize(ClassLoaderManager.java:204)
at com.ibm.ws.classloader.ClassLoaderManager.<init>(ClassLoaderManager.java:155)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:699)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:923)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2214)
at com.ibm.ws.runtime.component.ComponentImpl$_AsynchInitializer.run(ComponentImpl.java:304)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)

I guess the server only expects zip or jar files in the classpath. Please guide on how to include the XML file. Thanks.

Community
  • 1
  • 1
waqas
  • 124
  • 1
  • 10

2 Answers2

1

Perhaps you should try putting the xml file in a jar file.

See this question on how Java: Load a resource contained in a jar

Community
  • 1
  • 1
svachon
  • 7,666
  • 1
  • 18
  • 16
  • In case a change is needed in the configuration file, I will not be able to simply edit the file then. An extra step of packaging the XML file in jar file will be added. – waqas Feb 11 '11 at 07:26
1

I got it working by adding the classpath entry C:\WebSphere\AppServer\CommonLibs to

Application servers > server > Process Definition > Java Virtual Machine

using the admin console of Websphere. It works finally.

waqas
  • 124
  • 1
  • 10