[EJB 3.0 Users] - Re: Problem of polymorphism Web Service in EJB
by xiangyingbing
============== result from JBoss AS==============
============== result from JBoss AS==============
============== result from JBoss AS==============
|
|
| 18:05:01,199 DEBUG [ManagerBase] Start expire sessions StandardManager at 1257329101199 sessioncount
| 0
| 18:05:01,199 DEBUG [ManagerBase] End expire sessions StandardManager processingTime 0 expired sessio
| ns: 0
| 18:05:07,230 FINE [tcp] RMI Scheduler(0): close connection
| 18:05:07,230 FINE [tcp] RMI TCP Connection(9)-127.0.0.1: (port 1558) connection closed
| 18:05:07,230 FINE [tcp] RMI TCP Connection(9)-127.0.0.1: close connection
| 18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,120 INFO [STDOUT] ------------String is got:Test string
| 18:05:26,120 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Animal.1,age:1
| 18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,136 INFO [STDOUT] ------------Animal is got:Animal-->name:Human.1,age:1
| 18:05:26,136 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 INFO [STDOUT] ------------Human is got, name:Human.1, email:human1@gmail.com
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
| 18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Animal.1,age:1
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,151 INFO [STDOUT] ------------ArrayList<Animal> is got:
| 18:05:26,151 INFO [STDOUT] One Animal is got:Animal-->name:Human.1,age:1
| 18:05:26,151 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 18:05:26,167 WARN [StatelessBeanContext] EJBTHREE-1337: do not get WebServiceContext property from
| stateless bean context, it should already have been injected
| 1
|
|
|
============== result from client ==============
| Nov 4, 2009 6:05:25 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass
| INFO: Dynamically creating response wrapper bean Class com.ybxiang.ejbws.jaxws.ReturnSomething1Respo
| nse
| ===================testing===========================
| test:ejbWebServiceBean.passParameter1("Test string");
| test:ejbWebServiceBean.passParameter2(a1);
| test:ejbWebServiceBean.passParameter2(h);
| test:ejbWebServiceBean.passParameter3(h);
| test:ejbWebServiceBean.passParameter4(aa);
| test:ejbWebServiceBean.passParameter4(hh);
| ---------------[animal]------------------
| ------------returnedValue1:
| *** item:Animal-->name:Animal.1,age:1
| *** item:Animal-->name:Animal.2,age:2
| ---------------[human]------------------
| ------------returnedValue2:
| *** item:Animal-->name:Human.1,age:1
| *** item:Animal-->name:Human.2,age:2
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264250#4264250
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264250
16 years, 6 months
[EJB 3.0 Users] - Re: Problem of polymorphism Web Service in EJB
by xiangyingbing
============below codes are for Client test ============
============below codes are for Client test ============
============below codes are for Client test ============
|
| /**
| * EJBWebServiceBean.java
| *
| * This file was auto-generated from WSDL
| * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
| */
|
| package com.ybxiang.ejbws;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
|
|
| @WebService
| public interface EJBWebServiceBean extends java.rmi.Remote {
| @WebMethod
| public void passParameter1(java.lang.String arg0) throws java.rmi.RemoteException;
|
| @WebMethod
| public void passParameter2(com.ybxiang.ejbws.Animal arg0) throws java.rmi.RemoteException;
| @WebMethod
| public void passParameter3(com.ybxiang.ejbws.Human arg0) throws java.rmi.RemoteException;
| @WebMethod
| public void passParameter4(com.ybxiang.ejbws.Animal[] arg0) throws java.rmi.RemoteException;
| @WebMethod
| public com.ybxiang.ejbws.Animal[] returnSomething1(int arg0) throws java.rmi.RemoteException;
| }
|
|
|
|
|
|
| package com.ybxiang.ejbws;
|
| import java.net.URL;
|
| import javax.xml.namespace.QName;
| import javax.xml.ws.Service;
|
|
|
| public class TestMain {
| public static void main(String []args){
| try {
| URL location = new URL("http://127.0.0.1:8080/PolymorphismEJBWebService/EJBWebServiceBean?wsdl");
| QName serviceName = new QName("http://ejbws.ybxiang.com/","EJBWebServiceBeanService");
|
| Service service = Service.create(location, serviceName);
| //service.setHandlerResolver(new EmsHandlerResolver());
|
| QName port = new QName("http://ejbws.ybxiang.com/","EJBWebServiceBeanPort");
| EJBWebServiceBean ejbWebServiceBean = service.getPort(port, EJBWebServiceBean.class);
|
| Animal a1 = new Animal();
| a1.setName("Animal.1");
| a1.setAge(new Long(1));
| //
| Animal a2 = new Animal();
| a2.setName("Animal.2");
| a2.setAge(new Long(2));
| //
| Human h = new Human();
| h.setName("Human.1");
| h.setAge(new Long(1));
| h.setEmail("human1(a)gmail.com");
| System.out.println("===================testing===========================");
| System.out.println("test:ejbWebServiceBean.passParameter1(\"Test string\");");
| ejbWebServiceBean.passParameter1("Test string");
|
| System.out.println("test:ejbWebServiceBean.passParameter2(a1);");
| ejbWebServiceBean.passParameter2(a1);
|
| System.out.println("test:ejbWebServiceBean.passParameter2(h);");
| ejbWebServiceBean.passParameter2(h);
|
| System.out.println("test:ejbWebServiceBean.passParameter3(h);");
| ejbWebServiceBean.passParameter3(h);
| //
| Animal aa[] = new Animal[]{a1,a2};
| System.out.println("test:ejbWebServiceBean.passParameter4(aa);");
| ejbWebServiceBean.passParameter4(aa);
| //
| Human hh[] = new Human[]{h};
| System.out.println("test:ejbWebServiceBean.passParameter4(hh);");
| ejbWebServiceBean.passParameter4(hh);
| //
| System.out.println("---------------[animal]------------------");
| Animal[] returnedValue1 = ejbWebServiceBean.returnSomething1(1);
| System.out.println("------------returnedValue1:");
| for(Animal item:returnedValue1){
| System.out.println(" *** item:"+item);
| }
|
| System.out.println("---------------[human]------------------");
| Animal[] returnedValue2 = ejbWebServiceBean.returnSomething1(2);
| System.out.println("------------returnedValue2:");
| for(Animal item:returnedValue2){
| System.out.println(" *** item:"+item);
| }
|
|
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264249#4264249
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264249
16 years, 6 months
[EJB 3.0 Users] - Problem of polymorphism Web Service in EJB
by xiangyingbing
Dear friends,
I can use pure polymorphism Web Service in Glassfish and JBoss correctly.
But, after annotated with @Stateless, my codes does NOT work.
Namely, i can not make my code work in EJB3 environment.
My environment:
JDK, lates.
jboss-5.1.0.GA-jdk6
Windows XP.
My java files:
package com.ybxiang.ejbws;
|
| import javax.xml.bind.annotation.XmlSeeAlso;
|
| @XmlSeeAlso({Human.class})
| public class Animal implements java.io.Serializable{
| private String name;
| private Long age;
| public String getName() {
| return name;
| }
| public void setName(String name) {
| this.name = name;
| }
|
| public Long getAge() {
| return age;
| }
| public void setAge(Long age) {
| this.age = age;
| }
|
| public String toString(){
| return "Animal-->name:"+this.getName()+",age:"+this.getAge();
| }
| }
|
|
|
|
|
|
| package com.ybxiang.ejbws;
|
| public class Human extends Animal implements java.io.Serializable{
| private String email;
|
| public void setEmail(String email) {
| this.email = email;
| }
|
| public String getEmail() {
| return email;
| }
|
| public String toString(){
| return "Human-->name:"+this.getName()+",age:"+this.getAge()+","+"email:"+email;
| }
|
| }
|
|
|
|
|
|
|
| package com.ybxiang.ejbws;
|
| import java.util.ArrayList;
| import java.util.Iterator;
|
| import javax.jws.WebMethod;
|
| public interface EJBWebServiceInterface {
| public void passParameter1(String s);
| public void passParameter2(Animal a);
| public void passParameter3(Human h);
| public void passParameter4(ArrayList<Animal> lst);
| public ArrayList<? extends Animal> returnSomething1(int type);
| }
|
|
|
|
|
| package com.ybxiang.ejbws;
|
| import java.util.ArrayList;
| import java.util.Iterator;
|
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.xml.bind.annotation.XmlSeeAlso;
|
| import javax.jws.soap.SOAPBinding;
|
| @Stateless
| @WebService
| //(a)**XmlSeeAlso({Animal.class, Human.class})// Here i tried too!
| public class EJBWebServiceBean implements EJBWebServiceInterface{
| @WebMethod
| public void passParameter1(String s){
| System.out.println("------------String is got:"+s);
| }
| @WebMethod
| public void passParameter2(Animal a){
| System.out.println("------------Animal is got:"+a);
| if(a instanceof Human){
| System.out.println("************* It's realy human!!! *************");
| }
| }
| @WebMethod
| public void passParameter3(Human h){
| System.out.println("------------Human is got, name:"+h.getName()+", email:"+h.getEmail());
| }
|
| @WebMethod
| public void passParameter4(ArrayList<Animal> lst){
| System.out.println("------------ArrayList<Animal> is got:");
| if(lst!=null){
| Iterator<Animal> it = lst.iterator();
| Animal a = it.next();
| if(a instanceof Human){
| System.out.println("One human is got:"+((Human)a));
| }else{
| System.out.println("One Animal is got:"+a);
| }
| }else{
| System.out.println("------------List is null.");
| }
| }
|
| @WebMethod
| public ArrayList<? extends Animal> returnSomething1(int type){
| if(type==1){
| ArrayList<Animal> aa = new ArrayList<Animal>();
| {
| Animal animal1 = new Animal();
| animal1.setName("Animal.1");
| animal1.setAge(new Long(1));
| aa.add(animal1);
| }
| {
| Animal animal2 = new Animal();
| animal2.setName("Animal.2");
| animal2.setAge(new Long(2));
| aa.add(animal2);
| }
| return aa;
| }else{
| ArrayList<Human> bb = new ArrayList<Human>();
| {
| Human human1 = new Human();
| human1.setName("Human.1");
| human1.setAge(new Long(1));
| bb.add(human1);
| }
| {
| Human human2 = new Human();
| human2.setName("Human.2");
| human2.setAge(new Long(2));
| bb.add(human2);
| }
| return bb;
| }
| }
|
|
| }
|
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264248#4264248
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264248
16 years, 6 months
[jBPM Users] - Re: JobScheduler going crazy - ignoring wait
by rachel.primrose
Ok - so now I'm wondering if I need to report it or if it should be more of an administration and monitoring hassle.
Here's how to re-create it - if you think I should do a full report with code I will, otherwise perhaps someone can suggest a good administration strategy for this other than the most horrible "do a select every now and again to check".
So, here's the JPDL file:
| <process name="Dummy" xmlns="http://jbpm.org/4.0/jpdl">
| <start name="a">
| <transition to="b"/>
| </start>
| <state name="b">
| <on event="timeout">
| <timer duedate="10 seconds"/>
| <event-listener class="rachels.test.actionClasses.Sleep">
| </event-listener>
| </on>
| <transition to="c" name="toc">
| </transition>
| </state>
| <end name="c"/>
| </process>
|
The sleep class simply sleeps for 30s.
So, if you start a process instance of Dummy, after 10 seconds the Sleep class will do its thing.
If you kill the jvm mid-sleep, the job has already been acquired, but hasn't completed.
So, something was fixed in the code in 4.1 so now the job scheduler isn't going crazy which is nice.
BUT - this job is sitting there acquired and not necessarily completed in the DB.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264239#4264239
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4264239
16 years, 6 months