1.2.0.CR4 Released, Ready for GA
by Jason T. Greene
All,
I think we are ready for GA release. I have fixed the last critical
issues, and have released a CR4 that is now compatible with AS 4.2. 4.2
is supposed to be code complete this week, so barring any sudden changes
we should be ready to start the GA QA process.
-Jason
17 years, 10 months
[Design of JBoss Web Services] - Re: WSContractConsumer API in a seam app
by maeste
"jason.greene(a)jboss.com" wrote :
| You mention that the invocation fails. Does the service class actually load successfully? Are you caching object references?
|
Ok, let me explain a little:
Our app (called Wise, take a look to javalinuxlabs.org if you like to understand better ideas behind) generate client on the fly. I mean that it generate client code when you select a wsdls. Then the client code is generated and a generic web based interface too. After an hot deployment you have to restart the navigation flow and other client class wll be generated. No cache and no generated class reusing.
anonymous wrote :
| Is this code running in container? Are you hot deploying the client code? If so, the output folder will cease to exist after a hot deploy. The reason is that when you deploy your app its extracted in a tmp directory. Any relative file writes go there. When you redeploy a new directory is created, and thus the classes would be gone. If this is the case then you either need to regenerate them per redeploy, or store them in some absolute path name.
|
Yes I know. I think all things are done considering all jboss deployment standards. Just for clarify: we don't have problem loading our generated class, but (after redeployment) we experiences problem in loading classes of jbossws or javax.* contained in jars deployed inside the ear apps.
Here is my complete utility class (sorry, this is becoming a long post):
| /*
| * Created on 11/02/2007
| *
| * To change the template for this generated file go to
| * Window - Preferences - Java - Code Generation - Code and Comments
| */
| package it.javalinux.wise.jaxCore;
|
| import [...]
| public class WSDynamicClient {
|
| private Class serviceClass;
| private Class endPointClass;
|
|
| private Object service;
| private Object endPoint;
| URLClassLoader classLoader;
|
| private Map<String, Method> endPoints;
|
| private Map<String, Method> webMethods;
|
| private String tmpDeployDir;
|
| public void init(String wsdlURL, String cid,String userName, String password) {
| try {
| WSContractConsumer wsImporter = WSContractConsumer.newInstance();
| wsImporter.setGenerateSource(true);
| //wsImporter.setMessageStream(System.out);
| setCurrentTmpDeployDir();
| System.out.println(tmpDeployDir);
| List<String> cp = defineAdditionalCompilerClassPath();
| wsImporter.setAdditionalCompilerClassPath(cp);
|
|
| File outputDir = new File(tmpDeployDir + "/WSDLS/" + cid);
| if (!outputDir.exists()) {
| outputDir.mkdir();
| }
| wsImporter.setOutputDirectory(outputDir);
| wsImporter.setSourceDirectory(outputDir);
| String targetPkg = "it.javalinux.ws";
| wsImporter.setTargetPackage(targetPkg);
| wsImporter.consume(getUsableWSDL(wsdlURL,userName,password));
|
| String className = getServiceClassName(outputDir);
| 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"});
| //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();
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
|
| private String getUsableWSDL(String wsdlURL, String userName, String password) {
| if (StringUtils.trimToNull(userName) == null || StringUtils.trimToNull(password) == null) {
| return wsdlURL;
| }
| return null;
| }
|
| private String getServiceClassName(File outputDir) {
| String className =null;
| FilenameFilter filter = new FilenameFilter() {
| public boolean accept(File dir, String name) {
| return name.endsWith("Service.class");
| }
| };
| File scanDir = new File(outputDir.getAbsolutePath() + "/it/javalinux/ws/");
| System.out.println(scanDir);
|
| String[] children = scanDir.list(filter);
|
| if (children != null) {
| className = children[0].substring(0, children[0].length() - 6);
|
| }
| return className;
| }
|
| private List<String> defineAdditionalCompilerClassPath() {
| List<String> cp = new LinkedList<String>();
| cp.add(tmpDeployDir + "jboss-jaxws.jar");
| cp.add(tmpDeployDir + "jaxb-api.jar");
| cp.add(tmpDeployDir + "jaxb-impl.jar");
| cp.add(tmpDeployDir + "jaxb-xjc.jar");
| return cp;
| }
|
| private void setCurrentTmpDeployDir() {
| tmpDeployDir = Thread.currentThread().getContextClassLoader().getResource("jboss-jaxws.jar").getPath().substring(5);
| tmpDeployDir = tmpDeployDir.substring(0, tmpDeployDir.lastIndexOf("!")) + "-contents/" ;
|
| }
|
| public List<String> getEndPointList() {
| endPoints = new HashMap<String, Method>();
| for (Method method : serviceClass.getMethods()) {
| WebEndpoint annotation = method.getAnnotation(WebEndpoint.class);
| if (annotation != null) {
| endPoints.put(annotation.name(),method);
| }
| }
| return new ArrayList<String>(endPoints.keySet());
| }
|
| public void selectEndPoint(String name) throws Exception {
|
| Method method = endPoints.get(name);
| endPoint = serviceClass.getMethod(method.getName(), method.getParameterTypes()).invoke(service, (Object[]) null);
| endPointClass = serviceClass.getMethod(method.getName(), method.getParameterTypes()).getReturnType();
| }
|
| public List<String> getWebMethod() {
| webMethods = new HashMap<String, Method>();
|
| for (Method method : endPointClass.getMethods()) {
| WebMethod annotation = method.getAnnotation(WebMethod.class);
| if (annotation != null) {
| webMethods.put(annotation.action(),method);
| }
| }
|
| return new ArrayList<String>(webMethods.keySet());
| }
|
| public Object invokeOperation(String methodName, Object[] args) throws Exception {
| Method methodToInvoke = webMethods.get(methodName);
| return endPoint.getClass().getMethod(methodToInvoke.getName(),methodToInvoke.getParameterTypes()).invoke(endPoint, args);
| }
|
| public List<WebParameter> getWebParams(String methodName) {
| LinkedList<WebParameter> parameters = new LinkedList<WebParameter>();
| Method method = webMethods.get(methodName);
| Annotation[][] annotations = method.getParameterAnnotations();
| Class[] methodparameterTypes = method.getParameterTypes();
| for (int i = 0; i < annotations.length; i++) {
| for (int j = 0; j < annotations.length; j++) {
| if (annotations[j] instanceof WebParam ) {
| parameters.add(new WebParameter(methodparameterTypes,((WebParam) annotations[j]).name()));
| break;
| }
| }
| }
| return parameters;
|
| }
|
| }
|
|
Be careful when replacing the context loader when running in a container. If you do this you should restore the original thread context loader.
-Jason
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021381#4021381
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021381
17 years, 10 months
[Design of JBoss Web Services] - Re: WSContractConsumer API in a seam app
by jason.greene@jboss.com
"maeste" wrote : Hi Jason,
| 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.
|
You mention that the invocation fails. Does the service class actually load successfully? Are you caching object references?
Is this code running in container? Are you hot deploying the client code? If so, the output folder will cease to exist after a hot deploy. The reason is that when you deploy your app its extracted in a tmp directory. Any relative file writes go there. When you redeploy a new directory is created, and thus the classes would be gone. If this is the case then you either need to regenerate them per redeploy, or store them in some absolute path name.
anonymous wrote :
|
| 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();
| |
|
Be careful when replacing the context loader when running in a container. If you do this you should restore the original thread context loader.
-Jason
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021281#4021281
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021281
17 years, 10 months
[Design of JBoss Web Services] - Re: WSContractConsumer API in a seam app
by maeste
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
17 years, 10 months
Merged Tests From 1.2.0 to Trunk
by Jason T. Greene
All,
I have merged everything in 1.2.0 to trunk. I reviewed the changes and
everything looks good; however, in case I missed something, the change
revision is 2446.
-Jason
17 years, 10 months
Re: Explanation on how JBoss WS handles port numbers?
by Thomas Diesler
The way we work is:
* customers create a support case - somebody from WS support will look at it
* community members create a jira issue that shows how to reproduce the
issue - we can schedule and fix it in lin ewith our other priorities
cheers
-thomas
Chris Laprun wrote:
>
> On Feb 15, 2007, at 10:53 AM, Thomas Diesler wrote:
>
>> > Ideally, no changes would be required in our web service
>> configuration (i.e. we don't want our users to have to change several
>> configuration files).
>> > It seems like it is currently the case with 1.0.4. Is this correct?
>>
>> Yes that is correct. Unless JBWS-1115 is truly resolved (which you
>> claim it is not) the user will have to modify the jbossws configuration.
>
> In my experience, JBWS-1115 is fixed. However, some of our users are
> still experiencing issues with port numbers, especially when it comes
> to using HTTPS.
>
>> > can someone look at http://jira.jboss.com/jira/browse/JBWS-1515
>>
>> I commented.
>
> Thanks.
>
> Best,
> Chris
>
> ==
> JBoss Portal Developer / WSRP Lead
> JBoss, a division of Red Hat
>
>
--
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
Web Service Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
17 years, 10 months