A bit update here... So I put the tools.jar from JDK_home\lib to my .m2 repo and updated the axis2 config pom.xml file to have that as a dependency. I am able to pass this error and run the wsgen tools now inside of Axis2Builder(with some hardcoded values).

I don't think that is the right way to do things so could someone suggest a better way to load a jar that is not in the repo?

Thanks, Lin

Lin Sun wrote:
Hi David,

Thanks for your reply!

Yes I am basically invoking the WSToolsObjectFactory.wsgen from Axis2Builder, which will be invoked during deployment of the module when .wsdl isn't provided for the service endpoint impl class.

I've build my classpath String (hardcoded values for now) as I need it to pass into the WSToolsObjectFactory.wsgen call, and I think it is running in geronimo kernel (see exception below). But the kernel still needs to load the jar files. For instance, the wsgen tool needs the JDK_home\lib\tools.jar from SUN's JDK, and the kernel doesn't seem to have it loaded so I kept getting a CNF error from the AnnotationProcessorFactory class in the tools.jar. How do I load a jar from JDK in the kernel?

09:50:45,484 ERROR [Deployer] Deployment failed due to
java.lang.NoClassDefFoundError: com/sun/mirror/apt/AnnotationProcessorFactory
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
at org.apache.geronimo.kernel.classloader.JarFileClassLoader.access$200(
JarFileClassLoader.java:52)
at org.apache.geronimo.kernel.classloader.JarFileClassLoader$6.run(JarFi
leClassLoader.java:308)
        at java.security.AccessController.doPrivileged(Native Method)
at org.apache.geronimo.kernel.classloader.JarFileClassLoader.findClass(J
arFileClassLoader.java:260)
at org.apache.geronimo.kernel.config.MultiParentClassLoader.loadClass(Mu
ltiParentClassLoader.java:299)

Thanks again, Lin

David Jencks wrote:

On Mar 22, 2007, at 2:06 PM, Lin Sun wrote:

Hi there,

I am trying to build a classpath string for the wsgen tools. Basically, I need to use a few sun jars, a few geronimo spec jars and a few axis2 jars and the module from the repository to build the classpath string. And I am trying to do this from Axis2Builder.

Jarek mentioned to me that I might be able to use configuration manager that can help me find the jars automatically if I just give it the group and actifact id. Could someone shed some light on how to use that?

If there isn't such a manager avail, what is the best way to get the geronimo server path so that I can find the jars from the path myself?

ServerInfo can get you the server locations, but if there are lots of repositories installed that won't do you much good.

If you have a Repository and an artifactId you can get the File location

You might be able to travel through the ConfigurationManager to various ConfigurationStores and eventually end up with a classpath, but I wonder if it would be possible and/or simpler to run the tool in a geronimo kernel and use our classloaders?

thanks
david jencks


Thanks a lot

Lin






Reply via email to