Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Olivier Cleyman

Greenhorn
+ Follow
since May 29, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Olivier Cleyman

Hello Pawel.

Thanks a lot for you comment.
I tried to google a bit with the javax.xml.ws.WebFault and found indeed a solution to my problem with that annotation.

I helped me well.

Olivier
9 years ago
Hello,

I'm completely new to webservices.
I have to implement a quite straightforward web service.

I want my webservice to return a custom Exception and thus a custom SoapFault.

I'm currently Using EJB, JAXWS, WEBLOGIC 10.3 and the bottom up approach (which I know is not really good).


My Problem is that I do not succeed in achieving that. I get a exception.
java.lang.NoSuchMethodException on my custom exception class.


Here is the complete stack followed by my code.

Any help on solution or path to investigate would be quite useful
Thanks a lot.

Olivier


The Exception:


<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header />
<env:Body>
<echo xmlns="http://api.service.myproject.ox/">
<arg0 xmlns="">true</arg0>
</echo>
</env:Body>
</env:Envelope>


<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>java.lang.NoSuchMethodException: ox.myproject.service.api.jaxws.HelloWorldServiceExceptionBean.setCode(int)</faultstring>
<detail>
<ns2:exception xmlns:ns2="http://jax-ws.dev.java.net/" class="com.sun.xml.ws.encoding.soap.SerializationException" note="To disable

this feature, set com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false">
<message>java.lang.NoSuchMethodException: ox.myproject.service.api.jaxws.HelloWorldServiceExceptionBean.setCode(int)</message>
<ns2:stackTrace>
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="328"

method="createDetailFromUserDefinedException" />
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="306" method="getFaultDetail" />
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="170" method="createSOAPFaultMessage"

/>
<ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandler" file="EndpointMethodHandler.java" line="265" method="invoke"

/>
<ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="93" method="processRequest" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="598" method="__doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="557" method="_doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="542" method="doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="439" method="runSync" />
<ns2:frame class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java" line="243" method="process" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit" file="HttpAdapter.java" line="444" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java" line="244" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.servlet.ServletAdapter" file="ServletAdapter.java" line="134" method="handle" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke" file="HttpServletAdapter.java" line="272"

method="run" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter" file="HttpServletAdapter.java" line="185" method="post" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="180" method="doPost" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="727" method="service" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="64" method="service" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="820" method="service" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction" file="StubSecurityHelper.java" line="227"

method="run" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper" file="StubSecurityHelper.java" line="125" method="invokeServlet"

/>
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="292" method="execute" />
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="175" method="execute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java"

line="3498" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="321" method="doAs"

/>
<ns2:frame class="weblogic.security.service.SecurityManager" line="unknown" method="runAs" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2180"

method="securedExecute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2086" method="execute"

/>
<ns2:frame class="weblogic.servlet.internal.ServletRequestImpl" file="ServletRequestImpl.java" line="1406" method="run" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="201" method="execute" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="173" method="run" />
</ns2:stackTrace>
<ns2:cause class="java.lang.NoSuchMethodException" note="To disable this feature, set

com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace system property to false">
<message>ox.myproject.service.api.jaxws.HelloWorldServiceExceptionBean.setCode(int)</message>
<ns2:stackTrace>
<ns2:frame class="java.lang.Class" file="Class.java" line="1605" method="getMethod" />
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="323"

method="createDetailFromUserDefinedException" />
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="306" method="getFaultDetail" />
<ns2:frame class="com.sun.xml.ws.fault.SOAPFaultBuilder" file="SOAPFaultBuilder.java" line="170"

method="createSOAPFaultMessage" />
<ns2:frame class="com.sun.xml.ws.server.sei.EndpointMethodHandler" file="EndpointMethodHandler.java" line="265"

method="invoke" />
<ns2:frame class="com.sun.xml.ws.server.sei.SEIInvokerTube" file="SEIInvokerTube.java" line="93" method="processRequest" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="598" method="__doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="557" method="_doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="542" method="doRun" />
<ns2:frame class="com.sun.xml.ws.api.pipe.Fiber" file="Fiber.java" line="439" method="runSync" />
<ns2:frame class="com.sun.xml.ws.server.WSEndpointImpl$2" file="WSEndpointImpl.java" line="243" method="process" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit" file="HttpAdapter.java" line="444" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.HttpAdapter" file="HttpAdapter.java" line="244" method="handle" />
<ns2:frame class="com.sun.xml.ws.transport.http.servlet.ServletAdapter" file="ServletAdapter.java" line="134" method="handle"

/>
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke" file="HttpServletAdapter.java" line="272"

method="run" />
<ns2:frame class="weblogic.wsee.jaxws.HttpServletAdapter" file="HttpServletAdapter.java" line="185" method="post" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="180" method="doPost" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="727" method="service" />
<ns2:frame class="weblogic.wsee.jaxws.JAXWSServlet" file="JAXWSServlet.java" line="64" method="service" />
<ns2:frame class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="820" method="service" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction" file="StubSecurityHelper.java" line="227"

method="run" />
<ns2:frame class="weblogic.servlet.internal.StubSecurityHelper" file="StubSecurityHelper.java" line="125"

method="invokeServlet" />
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="292" method="execute" />
<ns2:frame class="weblogic.servlet.internal.ServletStubImpl" file="ServletStubImpl.java" line="175" method="execute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction" file="WebAppServletContext.java"

line="3498" method="run" />
<ns2:frame class="weblogic.security.acl.internal.AuthenticatedSubject" file="AuthenticatedSubject.java" line="321"

method="doAs" />
<ns2:frame class="weblogic.security.service.SecurityManager" line="unknown" method="runAs" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2180"

method="securedExecute" />
<ns2:frame class="weblogic.servlet.internal.WebAppServletContext" file="WebAppServletContext.java" line="2086"

method="execute" />
<ns2:frame class="weblogic.servlet.internal.ServletRequestImpl" file="ServletRequestImpl.java" line="1406" method="run" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="201" method="execute" />
<ns2:frame class="weblogic.work.ExecuteThread" file="ExecuteThread.java" line="173" method="run" />
</ns2:stackTrace>
</ns2:cause>
</ns2:exception>
</detail>
</S:Fault>
</S:Body>
</S:Envelope>







The code:

package ox.myproject.service.impl;

import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebService;
import javax.xml.soap.SOAPFault;

import org.apache.log4j.Logger;

import ox.myproject.exception.HelloWorldServiceException;
import ox.myproject.service.api.IHelloWorldService;

@Remote
@Stateless(name = "HelloWorldService", mappedName = "ox/HelloWorldService")
@WebService(endpointInterface = "ox.myproject.service.api.IHelloWorldService", serviceName = "OxHelloWorld")
public class HelloWordServiceImpl implements IHelloWorldService {

private static Logger LOG = Logger.getLogger(HelloWordServiceImpl.class);

@Override
public String echo(boolean withHelloWorldServiceException) throws HelloWorldServiceException {

if (withHelloWorldServiceException) {
throw new HelloWorldServiceException(1, "test1");
}

return "This is a HELLOWORLD service in OX/MYPROJECT project";
}

}







package ox.myproject.exception;

import java.io.Serializable;

public class HelloWorldServiceException extends Exception implements Serializable {


private int code;
private String description;

public HelloWorldServiceException(int code, String description)
{
this.code = code;
this.description = description;
}

public int getCode() {
return code;
}

public String getDescription() {
return description;
}

public void setCode(int code) {
this.code = code;
}

public void setDescription(String description) {
this.description = description;
}

}











9 years ago
Thanks for the info!

I don't know why this still doesn't work with
org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar and
org.eclipse.swt_3.2.2.v3236b.jar

My SWT classes compiles but don't run...
My SWT JFace classes don't compile at all because the above jars don't contain JFace related classes.


For SWT I downloaded swt-3.2.2-win32-win32-x86.zip et install it as a Java project.
Then In my own Project I relate to this SWT project and then it does compile and run....

So SWT is OK now but not JFace....


For the tutorials, I just had a look at
http://www-128.ibm.com/developerworks/opensource/library/os-ecgui1/
http://www.developer.com/java/other/article.php/3330861

But I'm reading Manning SWT/JFace in action.
10 years ago
Hummm

I just freshly installed Eclipse and I do know how to do it!

But if you don't include at least the SWT and JFace related jar in the project classpath it won't compile at all! I mean ma java classes with SWT and JFace code will not compile...the rest is fine of course.

That is why I added them... and that is also what all the tutorial on the subject says...

But in my case, and I don't know why, It will crash at runtime.

Anyway thanks a lot!
10 years ago
I know that it is supposed to be quite straightforward....
But it doesn't work for me...

Can you detail me your JRE setup?

I have red somewhere that I needed to include jars in my project java build path.
C:\eclipse-2.1.0\plugins\org.eclipse.jface_2.1.0\jface.jar
C:\eclipse-2.1.0\plugins\org.eclipse.runtime_2.1.0\runtime.jar
C:\eclipse-2.1.0\plugins\org.eclipse.swt.win32_2.1.0\ws\win32\swt.jar
C:\eclipse-2.1.0\plugins\org.eclipse.ui.workbench_2.1.0\workbench.jar
C:\eclipse-2.1.0\plugins\org.eclipse.core.runtime_2.1.0\runtime.jar

The problem is that it is an old version of Eclipse and now the jars don't have the same name anymore.
So I put thoses ones...

\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.jface_3.2.2.M20061214-1200.jar
\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar
\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.swt_3.2.2.v3236b.jar
\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.ui.workbench_3.2.2.M20070119-0800.jar
\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.core.runtime_3.2.0.v20060603.jar
\Eclipse\eclipse-SDK-3.2.2-win32\eclipse\plugins\org.eclipse.core.runtime.compatibility_3.1.100.v20060603.jar

My classes compiles, but there are problems at runtime.

BTW my installed JRE is JRE1.6.0


Thanks a lot for your help
10 years ago
Hello,

I've almost never build a java application using GUI.
Always did Web Application.

So I'm trying to do my first java SWT / JFace app using Eclipse.

I did find quite a lot of tutorial really helpful but I still have problems configuring my project in Eclipse 3.2.2!

Can some one tell which specific jar in need to include in my project JAVA BUILD PATH in order to be able to run my SWT / JFace properly?
10 years ago
They also said:

The first named variable in the expression is either an IMPLICIT OBJECT or an ATTRIBUTE.

Hope it helps...


Hi
It means
1) It will look for attribute in page,request,session and application scope
Am i right ???.
2)As i have read in hfsj that first value on lefside

i.e musicList["0"] is either
1)bean
2)map
3)array
4)List

So then why it will not get printed at output ???

Please reply me back.And thanx in advance

-SAnjay

--------------------

Eat JAVA, Drink JAVA, Sleep Java

OK just forget about the second question on WEB-INF, I know what went wrong:
I was forwarding to a static html page like this
req.getRequestDispatcher(/WEB-INF/ajsp.html").forward(req,resp);
which is, obviously, stupid

Still looking for question 1 infos


Thx

[ June 09, 2005: Message edited by: Olivier Cleyman ]

[ June 09, 2005: Message edited by: Olivier Cleyman ]
[ June 09, 2005: Message edited by: Olivier Cleyman ]
I have some gap in my understanding of the getResource / getResourceAsStream.

I know that we have access to thoses methods from the classloader and from the ServletContext.

I wanted to know if some one as a clear view on what we need to know about theses 4 methods for the certification.

I also have some interogation about the accessibility of resources under the WEB-INF directory.

I know that a user cannot access directly that kind of resource, but that we can give acc�s via the apllication. The thing is I do not practice this.
Is this access mechanism tranparent for us?? I don't think so.
For example I cannot forward in a sevlet to a JSP under the WEB-INF via the normal way:

req.getRequestDispatcher(/WEB-INF/ajsp.jsp").forwar(req,resp);


Can somebody help me with that?


Thanks a lot,
Olivier
Hi Vengan,

Thanks a lot for this errata page, I didn't even thought to look for an errata

Great!!

Olivier
Hello All,

I'am not sure to understand the Ignore EL material quite well...

In the HFS they are talkin on page 230 about ignoring the EL elements.

They said:


What is the effect? (choose all that apply.)

A. Nothing, this page directive is NOT defined.
B. The directive turns off the evaluation of Expression Language code by the JSP container in all of the web application's JSPs.
C. The JSP containing this directive should be treated by the JSP container as a well-formed XML file.
D. The JSP containing this directive should NOT have any Expression Language code evaluated by the JSP container.
E. This page directive will only turn off EL evalutation if the DD declares a element with a URL pattern that includes this JSP.
<hr></blockquote>


Reading the above quoted text (page 320) I answered: D.
But they gave us E as the result of this question.

For me those statements are conflicting!!!

Any one can help me clearing this up?

Thanks
Olivier
[ June 03, 2005: Message edited by: Olivier Cleyman ]
Hi All,

Are your sure your are using the same package definition in the DD and in the classes?
Did you put your compiled classes in the right place under the WEB-INF\classes?
Hi Moh,

I understand your concern now.
The thing is you mixed two JSP.

In the book there is only one JSP d�tailed. The one that gives you the kink between de CookieTest Servlet and the CheckCookie Servlet.
The Initial JSP containing the form is not in the book.

It should be like you or Leigh said.

If you do not want to write a JSP just change your doPost() method in the CookieTest Servlet into a doGet() method and acces the CookieTest directly with the url:



good luck...
[ May 30, 2005: Message edited by: Olivier Cleyman ]
Hello Moh,

1) The response to your first question is YES.
Each time you want to use a servlet, you need to register the servlet in your DD. No exception to this rule so yes, you need to declar both servlets in the WEB-INF\web.xml of you app.

You do that just the way it was explained previously on the book.
Your web.xml should be like this (assuming your classes are in the default package) :





2) Actually I do not see this JSP code in my own book! Anyway, the page should be like you wrote it, indeed.


Hope it helps...
Olivier
[ May 29, 2005: Message edited by: Olivier Cleyman ]