[EJB 3.0] - ERROR [[action]] Servlet.service() for servlet action threw
by chrisrevilla
The problem is --->operacionesRHRemoto = (OperacionesRHRemoto) context.lookup("RHumanosEAR/"+OperacionesRH.RemoteJNDIName);
session.setAttribute("operacion", operacionesRHRemoto);
the problem is:
-when i use a stateful bean that call a class DispatchAction it doesnt work,
-when I use an ActionClass it doesnt work, it works fine,
-when I call the stateful using a simple class it works too,
Maybe I need to use a library, Idont know ... please help me.
************************
package de.struts.action;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import op.facade.*;
import java.util.Properties;
import org.apache.struts.action.*;
import org.apache.struts.actions.DispatchAction;
import de.facade.*;
import em.facade.*;
import de.Common;
import op.facade.*;
/**
* MyEclipse Struts Creation date: 03-15-2006
*
* XDoclet definition:
*
* @struts.action parameter="action"
* @struts.action-forward name="success" path="/jsp/operacion.jsp"
*/
public class ManejarOperacionAction extends DispatchAction {
// --------------------------------------------------------- Instance
// Variables
// --------------------------------------------------------- Methods
public ActionForward anadiraOperacion(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
//ActionMessages actionMessages = new ActionMessages();
ActionErrors actionMessages = new ActionErrors();
System.out.println("Esta ingresando a anadiraOperacion");
EmpBeanRemoto empBeanRemote;
// first try to get an existing cart from the current session
OperacionesRHRemoto operacionesRHRemoto = (OperacionesRHRemoto) session.getAttribute("operacion");
// when there is no cart create a new one and save it in the session
if (operacionesRHRemoto == null)
{ /*
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","localhost:1099");
*/
try
{
Context context = new InitialContext();
operacionesRHRemoto = (OperacionesRHRemoto) context.lookup("RHumanosEAR/"+OperacionesRH.RemoteJNDIName);
session.setAttribute("operacion", operacionesRHRemoto);
} catch (NamingException e)
{
e.printStackTrace();
throw new RuntimeException("Error de naming exception"+e.getMessage());
}
}
String sId = request.getParameter("eid");
System.out.println("manejaroperacion.anadiraoperacion--el empleado escogido es->:"+sId);
if (sId == null)
{
actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.param.noentry"));
} else
{
Integer id = Integer.parseInt(sId);
operacionesRHRemoto.asignarDepAEmp(id);
//cartLocal.addBook(id);
}
if (!actionMessages.isEmpty())
saveErrors(request, actionMessages);
return mapping.findForward(Common.SELF);
}
}
}
************its interfaces *********
package op.facade;
import java.util.Map;
import de.facade.Departamento;
import em.facade.Empleado;
import javax.ejb.Remote;
@Remote
public interface OperacionesRHRemoto {
public void asignarDepAEmp(Empleado empleado);
public void asignarDepAEmp(Integer id);
public void removerDeDep(Empleado empleado);
public void removerDeDep(Integer id);
public void eliminarOperaciones();
public Map obtenerOperaciones();
void revisar(Departamento departamento);
public void retirardeDepartamento(Integer id);
}
*********
package op.facade;
import em.facade.Empleado;
import de.facade.Departamento;
import java.util.*;
import javax.ejb.Local;
@Local
public interface OperacionesRHLocal {
public void asignarDepAEmp(Empleado empleado);
public void asignarDepAEmp(Integer id);
public void removerDeDep(Empleado empleado);
public void removerDeDep(Integer id);
public void eliminarOperaciones();
public Map obtenerOperaciones();
void revisar(Departamento departamento);
public void retirardeDepartamento(Integer id);
}
/************/
+- RHumanosEAR (class: org.jnp.interfaces.NamingContext)
| +- EmpBean (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy117 implements interface em.facade.EmpBeanLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
| | +- remote (proxy: $Proxy116 implements interface em.facade.EmpBeanRemoto,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
| +- DepBean (class: org.jnp.interfaces.NamingContext)
| | +- local (proxy: $Proxy121 implements interface de.facade.DepBeanLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
| | +- remote (proxy: $Proxy120 implements interface de.facade.DepBeanRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
| +- OperacionesRH (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| | +- remote (class: java.lang.Object)
| | +- remoteStatefulProxyFactory (proxy: $Proxy102 implements interface org.jboss.ejb3.ProxyFactory)
**************************************
PLEASE HELP ME tell me if I nedd to do some thing more?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068409#4068409
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068409
18Â years, 9Â months
[Installation, Configuration & DEPLOYMENT] - need help with simple deployment for jboss 4.2.1 and mysql
by geeky2
hello everyone,
i am attempting to deploy a simple jboss app that uses mysql as a datasource. this is the first time i have tried to connect to anything but the default datasource.
this is the error that i am getting:
>>
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:jar=jbosstest.jar,name=ClockOperationsLocalBean,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:unitName=MYSQLDS
ObjectName: jboss.j2ee:jar=jbosstest.jar,name=ClockOperationsRemoteBean,service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:unitName=MYSQLDS
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: persistence.units:unitName=MYSQLDS
State: NOTYETINSTALLED
Depends On Me:
jboss.j2ee:jar=jbosstest.jar,name=ClockOperationsLocalBean,service=EJB3
jboss.j2ee:jar=jbosstest.jar,name=ClockOperationsRemoteBean,service=EJB3
<<
this is my persistence.xml file:
<local-tx-datasource>
<jndi-name>MYSQLDS</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/primexdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>x</user-name>
y
<type-mapping>mySQL</type-mapping>
</local-tx-datasource>
i have made sure that that mysql jar file is located in the default/lib dir and i have also copied the sample mysql-ds.xml file in to the deploy directory - after making appropriate changes (not sure if this is redundant or not).
thx for any help
mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068408#4068408
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068408
18Â years, 9Â months
[JBoss Seam] - convert parameter f:param with s:convertdatetime
by jfrankman
I have a simple page that I am trying to pass a date parameter to:
| <s:button view="/RptphdmgbinderEdit.xhtml"
| id="create"
| value="Create rptphdmgbinder">
| <f:param name="policyeffdate" value="#{policy.effectiveDate.time}" rendered="#{policy.effectiveDate!=null}"></f:param>
| </s:button>
|
The date does get passed to the next page, but it is not in the format I want. I have tried to do something like:
| <f:param name="policyeffdate" value="#{policy.effectiveDate.time}" rendered="#{policy.effectiveDate!=null}">
| <s:convertDateTime pattern="MM/dd/yyyy"/>
| </f:param>
|
But this does not work. Other than adding a conversion method to my policy class is there any way and can make the date get passed according to the "MM/dd/yyyy" pattern. It seems like a pretty simple problem to solve, but I just can't figure this out. I was thinking there might be a way to do this with EL, but I am still a bit new at this. Any thoughts would be appreciated.
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068405#4068405
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068405
18Â years, 9Â months
[JBoss Seam] - Re: How to let user print off a list?
by davidfed
I needed a way to print content without showing it first. And it is a completely different layout than the visible page and required data that was just entered on the page.
I have this at the bottom of the visible page (Event.observe() is from Prototype):
<iframe id="printbox" name="printbox" src="#{referralController.faxUrl}"
| width="0" height="0" style="border:none">
| </iframe>
|
| <script type="text/javascript">
| Event.observe(window, 'load', printFax);
| </script>
|
Here's the javascript function:
function printFax()
| {
| if (window.frames['printbox'].document.URL.indexOf("faxcover") != -1)
| {
| window.frames['printbox'].focus();
| window.frames['printbox'].print();
| }
| }
|
The function checks to see if the iframe contains any printable content by checking the URL.
I leave the URL blank when first loading the page. When the print button is clicked the backing bean method stores the data, sets the printing URL and then reloads the same page. I include the conversation id so the printing page can find the data.
| faxUrl = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() +
| "/faxcover.seam?clr=true&cid=" + conversation.getId();
|
This works in both IE and FF. The page doesn't change visually but the print dialog appears for the hidden layout.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068404#4068404
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068404
18Â years, 9Â months