aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service" Watch "java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service" New topic
Author

java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service

Sowjanya Venkiteela
Greenhorn

Joined: Nov 25, 2009
Posts: 17
Dear All,

I am getting the above exception java.lang.reflect.UndeclaredThrowableException in my client program.

java.lang.reflect.UndeclaredThrowableException
at $Proxy0.echo(Unknown Source)
at com.ss.Client.main(Client.java:41)
Caused by: java.rmi.RemoteException: Call invocation failed; nested exception is:
java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:536)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invoke(CallImpl.java:277)
at org.jboss.ws.core.jaxrpc.client.PortProxy.invoke(PortProxy.java:156)
... 2 more
Caused by: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(Unknown Source)
at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:83)
at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:171)
at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:59)
at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:158)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:291)
at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:517)
... 4 more



My Coding is as follows:
Client.java:
-------------
package com.ss;

import java.net.URL;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;


public class Client {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

try{
URL url = new URL("http://127.0.0.1:8080/TestWebServiceEAR-TestWebService/WSBean?wsdl");
QName qname = new QName("http://ss.com/","WSBeanService");

System.out.println("Creating a service Using: \n\t"
+ url + " \n\tand " + qname);
ServiceFactory factory = ServiceFactory.newInstance();
Service remote = factory.createService(url, qname);
/*Call c=remote.createCall(new QName("http://abc.org/","WebSPort"));
c.setTargetEndpointAddress("http://127.0.0.1:8080/WSEAR-WS/WebS?wsdl");*/

System.out.println("Obtaining reference to a proxy object");
WSBeanRemote proxy = (WSBeanRemote) remote.getPort(WSBeanRemote.class);

System.out.println("Accessed local proxy: " +proxy);

String string = "John";

System.out.println("Sending: " + string+"calling web service :");
proxy.echo(string);

}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}

}


WSBean.java:
----------------
package com.ss;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

/**
* Session Bean implementation class WSBean
*/

@Stateless
@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(WSBeanRemote.class)

public class WSBean implements WSBeanRemote {

/**
* Default constructor.
*/
public WSBean() {
// TODO Auto-generated constructor stub
}
@WebMethod
public String echo(String input)
{
System.out.println("inside echo method"+input);
return "sjdgfjsgdf"+input;
}

}


WSBeanRemote.java:
-------------------------
package com.ss;

import java.rmi.Remote;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
@WebService
@SOAPBinding(style=Style.RPC)
public interface WSBeanRemote extends Remote{

@WebMethod
public String echo(String input);


}



I have been strucked in this for two days.Please help.

Thanks in Advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

See this


[My Blog] [JavaRanch Journal]
Sowjanya Venkiteela
Greenhorn

Joined: Nov 25, 2009
Posts: 17
Thank You Jaikiran,

My problem is resolved.

This is Bottom Up Approach where we are exposing EJB as a web service.

But,I want to know the Top Down Approach where I had a WSDL and I want to generate EJB classes.

Please provide necessary information.

Thanks in advance.

Oladeji Oluwasayo
Ranch Hand

Joined: Sep 10, 2010
Posts: 101

@Jaikiran that link is broken. Can you please provide a detailed solution. Someone is having a really tough time here.


OCPJP 6, OCMJD 6
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10266
    
168

Oladeji Oluwasayo wrote:@Jaikiran that link is broken. Can you please provide a detailed solution. Someone is having a really tough time here.


I've updated my previous post in this thread to contain the working link. Also, here's another discussion about this issue http://www.coderanch.com/t/91307/JBoss/JBoss-EJB-Webservices
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.reflect.UndeclaredThrowableException in JBOSS with EJB 3 as a web service