[jbossws-dev] [Design of JBoss Web Services] - Re: WSContractConsumer API in a seam app

maeste do-not-reply at jboss.com
Fri Feb 23 10:35:31 EST 2007


Hi Jason, 
your hints helped me a lot in finding and solving problem in dynamic class generation.
Now it seems ok and all the apps seems to work not bad (well we still have some point open, but it basically works).
One of the opened points is about class loading when we use jaxws generated class to call webservices.
Generated class is always loaded correctly and also library (putted in ear and loaded as java module in application.xml using an isolated classloader in jboss-app) works perfectly after a fresh startup of the server.
The problem is on finding class in library's jars after an hot deployment. It doesn't work and we get a ClassNotFoundException (not always the same calss) when we invoke the endpoint operation.

Our class loading related code is:

  | classLoader = new URLClassLoader(new URL[]{outputDir.toURL()}, Thread.currentThread().getContextClassLoader());
  | 			URLClassLoader classLoader = new URLClassLoader(new URL[]{outputDir.toURL()}, Thread.currentThread().getContextClassLoader());
  | 			Thread.currentThread().setContextClassLoader(classLoader);
  | 			
  | 			serviceClass = JavaUtils.loadJavaType("it.javalinux.ws." + className , classLoader);
  | 			service = serviceClass.newInstance();
  | 

The use of loaded class and other classes generated by wsConctractConsumer is in other methods of our utility class created and used by a Seam' Stateful bean. 

We tried also to be more rude:

  | Properties prop = new Properties();
  | //			 BEGIN
  | 			SecurityAssociation.setPrincipal(new SimplePrincipal("admin"));
  | 			SecurityAssociation.setCredential("admin".toCharArray());
  | 		// END
  | 	        prop.put( "java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" );
  | 	        prop.put( "java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" );
  | 	        prop.put( "java.naming.provider.url", "jnp://localhost:1099");
  | 	        InitialContext ctx = new InitialContext(prop);
  | 	        RMIAdaptor rmiserver = (RMIAdaptor) ctx.lookup("jmx/invoker/RMIAdaptor");
  | 			ObjectName onameBean = new ObjectName("seam.jboss.org:loader=Wise");
  | 			rmiserver.invoke(onameBean, "newClassLoader" , new Object[]{outputDir.toURL(),true}, new String[]{"java.net.URL","boolean"});
  | 			
  | 

But we get the same error.

Any other useful hint?
Thanks in advance

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021145#4021145

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021145



More information about the jbossws-dev mailing list