[EJB 3.0] - java.lang.UnsupportedOperationException: setProperty must be
by Usul
Hi,
Im trying to develop a simple webservice with "EJB 3.0" and a simple client.
I use:
- jboss-4.2.2.GA
- Eclipse
My two Server classes:
package myserv;
|
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
| import javax.jws.WebService;
|
|
| @Stateless
| @WebService(endpointInterface = "myserv.ICalculatorBean")
| @Remote(ICalculatorBean.class)
| public class CalculatorBean
| {
|
| public int add(int a, int b)
| {
| return a+b;
| }
|
| public int subtract(int a, int b)
| {
| return a - b;
| }
| }
package myserv;
|
| 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 ICalculatorBean extends java.rmi.Remote
| {
|
| public int add(int a, int b);
|
| public int subtract(int a, int b);
| }
My Client class:
package myclient;
|
| import java.net.URL;
|
| import javax.xml.namespace.QName;
| import javax.xml.rpc.Service;
| import javax.xml.rpc.ServiceFactory;
|
| import myserv.*;
|
| public class Client {
| public static void main(String[] args) throws Exception
| {
| System.out.println("Starting Test Client");
| URL url = new URL("http://127.0.0.1:8080/steffenwstest/CalculatorBean?wsdl");
| QName qname = new QName(
| "http://myserv/",
| "CalculatorBeanService");
|
| System.out.println("Creating a service Using: \n\t"
| + url + " \n\tand " + qname);
| ServiceFactory factory = ServiceFactory.newInstance();
| Service remote = factory.createService(url, qname);
|
| System.out.println("Obtaining reference to a proxy object");
| ICalculatorBean proxy = (ICalculatorBean) remote.getPort(ICalculatorBean.class);
| System.out.println("Accessed local proxy: " + proxy);
|
|
| System.out.println("9+8= " + proxy.add(9, 8));
| }
| }
I get this Error:
anonymous wrote : Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
| at $Proxy0.add(Unknown Source)
| at myclient.Client.main(Client.java:30)
| 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:151)
| ... 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.(SOAPMessageImpl.java:67)
| at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:161)
| at org.jboss.ws.core.CommonSOAP11Binding.createMessage(CommonSOAP11Binding.java:59)
| at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:156)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:289)
| at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:517)
| ... 4 more
The error is thrown in this line:
System.out.println("9+8= " + proxy.add(9, 8));
Note:
- I compiled both server and client with Java 5.0
- I did copy the following files into /lib/endorsed:
- jboss-saaj.jar
- jboss-jaxws.jar
- jboss-jaxrpc.jar
- jaxb-api.jar
- jaxb-impl.jar
My server uses everything from \server\all\lib.
My client uses everything from \client and \lib\endorsed.
What more can I do?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155459#4155459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155459
16 years, 1 month
[JBoss Portal] - Link for downalding a document PDF in a portlet
by khadijbal
I want to make a link for telecharger file PDF, in a portlet, but that does not work, i have a error.
Here is my code in the portlet:
public void doView(RenderRequest req, RenderResponse rep)
| throws PortletException, IOException {
| String filename = (String) req.getParameter("filename");
|
| if (filename!=null) {
| rep.setContentType("application/pdf");
| File file= new File ("C://Documents and Settings/"+filename);
| InputStream in = new FileInputStream(ff);
| OutputStream outs = rep.getPortletOutputStream(); try {
| int bit = in.read();
| while ((bit) >= 0) {
| outs.write(bit);
| bit = in.read();
| }
| } catch (Exception e) {
| e.printStackTrace(System.out);
| }
| outs.flush();
| outs.close();
| in.close();
| }
| }
i have this exception:
Cause: javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.IllegalStateException: The window output stream is already used
Message: org.apache.jasper.JasperException: java.lang.IllegalStateException: The window output stream is already used
StackTrace:
javax.portlet.PortletException: org.apache.jasper.JasperException: java.lang.IllegalStateException: The window output stream is already used
at org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:91)
at portal.portlets.PListeFormation.doView(Unknown Source)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155442#4155442
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155442
16 years, 1 month
[JBoss jBPM] - Re: Integrate JPA with JBPM-JPDL3.2.2
by sreepathia@gmail.com
Thanks, I am using the setsession to make this integration work. like
jbpmContext = jbpmConfiguration.createJbpmContext();
jbpmContext.setSession(<>);
Now the session object is handling all the database activities for me. The session is getting opened and also closed automatically by my transaction manager configured thru spring.
I may need some info for the scenario below:
Actual problem now when i try to close the context using jbpmContext.close() jbpm tries to close the session associated with the context. as the session was automatically closed when i moved out of my method and trying to close the jbpmconext later after doing some business logic.
couple of ways i have in my mind,but not sure if this si right.
1) should we close the jbpm context after every action we do and create a new one later,will it not affect the performance.
2) Should we not close the jbpmconext in this scenario, Will there be any problems in keeping the context's in the stack which are of no use.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155441#4155441
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155441
16 years, 1 month