web services - What is the reason of java.lang.reflect.InvocationTargetException when calling a SOAP WS? -
i tryig understand soap ws. write simple classes follow. when deploy application in glassfish , test it, server returns java.lang.reflect.invocationtargetexception. can problem is?
@webservice public class authorws { authorservice authorservice = new authorservice(); @webmethod public author getauthorbyid(int authorid) { return authorservice.getauthorbyid(authorid); } @webmethod public arraylist<author> getallauthors() { return authorservice.getallauthors(); } }
service class:
public class authorservice { authordao authordao = new authordao(); public author getauthorbyid(int authorid){ return authordao.getauthorbyid(authorid); } public arraylist<author> getallauthors(){ return authordao.getallauthors(); } }
dao class:
public class authordao { public author getauthorbyid(int authorid){ sessionfactory sessionfactory = new configuration().configure().buildsessionfactory(); criteria criteria = sessionfactory.opensession().createcriteria(author.class); criteria.add(restrictions.eq("authorid", authorid)); return (author) criteria.uniqueresult(); } public arraylist<author> getallauthors(){ sessionfactory sessionfactory = new configuration().configure().buildsessionfactory(); criteria criteria = sessionfactory.opensession().createcriteria(author.class); return (arraylist<author>) criteria.list(); }
exception:
'caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:483) @ org.glassfish.webservices.monitoring.webservicetesterservlet.dopost(webservicetesterservlet.java:313) ... 32 more caused by: com.sun.xml.ws.fault.serversoapfaultexception: client received soap fault server: com.sun.enterprise.container.common.spi.util.injectionexception: error creating managed object class: class com.hojat.librarysoapws.ws.authorws please see server log find more detail regarding exact cause of failure. @ com.sun.xml.ws.fault.soap11fault.getprotocolexception(soap11fault.java:193) @ com.sun.xml.ws.fault.soapfaultbuilder.createexception(soapfaultbuilder.java:131) @ com.sun.xml.ws.client.sei.stubhandler.readresponse(stubhandler.java:253) @ com.sun.xml.ws.db.databindingimpl.deserializeresponse(databindingimpl.java:203) @ com.sun.xml.ws.db.databindingimpl.deserializeresponse(databindingimpl.java:290) @ com.sun.xml.ws.client.sei.syncmethodhandler.invoke(syncmethodhandler.java:119) @ com.sun.xml.ws.client.sei.syncmethodhandler.invoke(syncmethodhandler.java:92) @ com.sun.xml.ws.client.sei.seistub.invoke(seistub.java:161) @ com.sun.proxy.$proxy312.getallauthors(unknown source)'
the problem on server side, can see stack trace
: client received soap fault server: com.sun.enterprise.container.common.spi.util.injectionexception: error creating managed object class: class com.hojat.librarysoapws.ws.authorws please see server log find more detail regarding exact cause of failure.
so check server log.
Comments
Post a Comment