[JBossWS] - JAXWS: handlers and exceptions
by fburlet
Hi,
I don't understand everything in the exception handling in JAXWS.
I written a small webservice; the code is here under:
| package com.kiala.handler.test.webservice;
|
| import javax.ejb.Stateless;
| import javax.jws.HandlerChain;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
| import com.kiala.handler.test.exception.UserException;
|
| @Stateless
| @WebService
| @HandlerChain(file = "handler-chain.xml")
| @SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
| public class ExceptionService {
|
| public String throwException(String s) throws UserException {
| if ("Hello".equals(s)) {
| return "World!";
| } else {
| throw new UserException(s);
| }
| }
| }
|
UserException is a custom exception extending java.lang.Exception.
My question is: is UserException obliged to extend java.lang.RuntimeException in ordre to trigger the execution of the handlers's handleFault(MessageContext msgContext) method ? If I don't extend RuntimeException, the handleFault(MessageContext msgContext) is not executed... Note that the generated response is the same if I extend RuntimeException or not: the reason of my question. The specification and the doc is not clear (at least for me) about that.
I'm using jboss 4.2.0.GA and jbossws 1.2.1.GA with jdk 1.5.
Thanks for you help,
Fred.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050115#4050115
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050115
17 years, 6 months
[EJB 3.0] - javax.naming.NameNotFoundException: MyEjb3 not bound :(
by mailmustu
HI,
I wrote a simple bare minimum "Hello world" EJB 3.0, and deployed it in JBoss AS 4.0.5 with EJB 3 support.
I am getting an exception
"javax.naming.NameNotFoundException: MyEjb3 not bound"
I am deploying "MyEjb3.ear" file using an ANT script.
If u need to see build.xml or other XML files I can paste them in next post.
Note: EJBTrail works perfectly fine in my app server, so I do not think there are any environmental issues.
here is the code:
HelloWorldBean.java (Stateless session Bean)
| package com.mustafa.ejb30;
| import javax.ejb.Stateless;
|
| @Stateless
|
| public class HelloWorldBean implements HelloWorldLocal , HelloWorldRemote
| {
| public String sayHello(String name)
| {
| return("Hello "+name +" from your first EJB 3.0 component ...");
| }
| }
|
HelloWorldLocal.java (Local Interface)
| package com.mustafa.ejb30;
| import javax.ejb.Local;
|
| @Local
| public interface HelloWorldLocal
| {
| public String sayHello(String name);
| }
|
index.jsp (client jsp)
| <%@page import = "com.mustafa.ejb30.*" %>
| <%@page import = "javax.naming.*" %>
|
| <html>
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
| <title>MyEjb3 test app</title>
| </head>
|
| <body>
| <%
| HelloWorldLocal hw = null;
| InitialContext ctx = new InitialContext();
| hw = (HelloWorldLocal) ctx.lookup("MyEjb3/HelloWorldBean/local");
|
| String message = hw.sayHello("Mustafa!");
| %>
| Message is <%=message%>
|
| </body>
| </html>
|
Please let me know what am I missing.
Thanks in advance.
- Mustafa
http://mustafak.co.nr
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050114#4050114
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050114
17 years, 6 months
[JBoss Seam] - @In ? I don't get it ...
by limousyf
Hello,
I'm using a seam-gen generated application and I try to force the login when accessing the application because I always need a logged user in the session context (all data managed is linked to this logged user).
So I'm redirecting to login.seam instead of home.seam in index.xhtml but, when the login page is displayed I got this error:
javax.faces.el.EvaluationException: Cannot get value for expression '#{certificationList.firstResult}'
(...)
org.jboss.seam.RequiredException: In attribute requires non-null value: myCertifications.loggedCollaborateur
"certificationList" is the datamodel I'm using in another page in the application (not login.xhtml). It's used for a datatable.
In the factory method of this datamodel, I'm using the "loggedCollaborateur" to restrict the list so it cannot be null, seam is right.
But why is seam calling this "#{certificationList.firstResult}" before any login ?
By the way, here's my authenticator :
@Out(value="loggedCollaborateur", scope=ScopeType.SESSION)
Collaborateur loggedCollaborateur;
public boolean authenticate() {
log.info("authenticating #0", Identity.instance().getUsername());
if(em == null){log.error("Could not authenticate because EntityManager null."); return false;}
List users = em.createQuery("select u from User u where login_name=:username and password=:password")
.setParameter("username", Identity.instance().getUsername())
.setParameter("password", Identity.instance().getPassword())
.getResultList();
if(users.size() == 0) {
return false;
} else {
User user = users.get(0);
//fetch the collaborateur for this user
List colabs = em.createQuery("select c from Collaborateur where c.user_id=:userId")
.setParameter("userId", user.getUserId())
.getResultList();
loggedCollaborateur = colabs.get(0);
identity.addRole("admin");
}
return true;
}
And in the bean(s) using this outjected Collaborateur Object, I have:
@In(value="loggedCollaborateur")
Collaborateur loggedCollaborateur;
and then using this object to restrict my data.
Am I doing something wrong here ?
Lots of things wrong ?
Why is there this .firstResult call and how can I avoid the null value check before any login ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4050106#4050106
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050106
17 years, 6 months