[EJB 3.0 Users] - java.rmi.ServerException: RemoteException
by 2vm
Hi
I am new to this community.I having a problem while accessing stateless session bean from client code.
I am using JBOSS 4.0.2
Following is the stack trace
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
null
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
at $Proxy0.create(Unknown Source)
at com.oneview.configure.delegate.ConfigureDelegate.getRemoteInstance(ConfigureDelegate.java:447)
at com.oneview.configure.delegate.ConfigureDelegate.fetchAllCameraDetail(ConfigureDelegate.java:59)
at com.oneview.configure.action.ConfigureCameraAction.processShowConfigureCameraView(ConfigureCameraAction.java:94)
at com.oneview.configure.action.ConfigureCameraAction.showConfigureCameraView(ConfigureCameraAction.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
null
at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:352)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:125)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:613)
at org.jboss.ejb.Container.invoke(Container.java:894)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.ejb.EJBException: Could not instantiate bean; CausedByException is:
null
at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:180)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invokeHome(StatelessSessionInstanceInterceptor.java:78)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:116)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
****************************************************
Following is my client code
private ConfigureRemoteInterface getRemote() {
ConfigureRemoteInterface configureRemoteInterface = null;
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "localhost:1099");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
InitialContext ctx = null;
try {
ctx = new InitialContext(p);
} catch (NamingException e) {
e.printStackTrace();
}
Object obj = null;
try {
obj = ctx.lookup("ejb/ConfigureJndi");
} catch (NamingException e) {
e.printStackTrace();
}
if(obj instanceof ConfigureHomeInterface){
}else if(obj instanceof ConfigureRemoteInterface){
System.out.println(ConfigureCameraAction.class.getName()+">>>>>>>>>>>>OBJ IS OBJECT>>>>>>>>>");
}
ConfigureHomeInterface configureHomeInterface=null;
configureHomeInterface = (ConfigureHomeInterface) PortableRemoteObject
.narrow(obj, ConfigureHomeInterface.class);
try {
configureRemoteInterface = configureHomeInterface.create();
} catch (RemoteException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
}
return configureRemoteInterface;
}
*****************************************
HOME class as follows
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ConfigureHomeInterface extends EJBHome {
public ConfigureRemoteInterface create() throws RemoteException, CreateException;
}
*******************************************
Remote as folows
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface ConfigureRemoteInterface extends EJBObject {
public String sayHello() throws RemoteException,DataHandlerException ;
public void ejbCreate(){}
public void ejbRemove(){}
public void ejbActivate(){}
public void ejbPassivate(){}
public void setSessionContext
(SessionContext sc ) {}
}
Any help at the earliest is always welcome :)
Thanks in advance !
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262851#4262851
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262851
14 years, 8 months
[JBoss Web Services Users] - WSDL generated incorrectly?
by Elenthril
Hi,
I am using wstools from eclipse 3.5.1. and jboss-5.1.0.GA to generate a top-down webservice. It is generated from the following, I believe (syntacticly) correct, wsdl with <mime:multipartRelated> elements.
| <?xml version="1.0" encoding="UTF-8"?>
| <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
| xmlns:tns="http://com.lei.nl/modelAgent"
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
| xmlns:lei="http://com.lei.nl/modelAgent"
| name="ModelAgentService"
| targetNamespace="http://com.lei.nl/modelAgent">
| <wsdl:types>
| <xsd:schema xmlns:lei="http://com.lei.nl/modelAgent" targetNamespace="http://com.lei.nl/modelAgent" >
| <xsd:element name="ModelAgentRequest">
| <xsd:complexType>
| <xsd:sequence>
| <xsd:element minOccurs="1" maxOccurs="1" name="modelType" type="xsd:string"/>
| <xsd:element minOccurs="1" maxOccurs="1" name="modelName" type="xsd:string"/>
| <xsd:element minOccurs="0" maxOccurs="unbounded" name="modelParameters" type="lei:ModelParameter"/>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:element>
| <xsd:element name="ModelAgentResponse">
| <xsd:complexType>
| <xsd:sequence>
| <xsd:element minOccurs="1" maxOccurs="1" name="returnCode" type="xsd:string"/>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:element>
| <xsd:complexType name="ModelParameter">
| <xsd:sequence>
| <xsd:element minOccurs="1" name="parameterName" type="xsd:string"/>
| <xsd:element minOccurs="1" name="parameterValue" type="xsd:string"/>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:schema>
| </wsdl:types>
| <wsdl:message name="invokeRequestMsg">
| <wsdl:part name="ModelAgentRequest" element="lei:ModelAgentRequest"/>
| <wsdl:part name="gdxAttachment" type="xsd:base64Binary"/>
| </wsdl:message>
| <wsdl:message name="invokeResponseMsg">
| <wsdl:part name="ModelAgentResponse" element="lei:ModelAgentResponse"/>
| <wsdl:part name="gdxAttachment" type="xsd:base64Binary"/>
| </wsdl:message>
| <wsdl:portType name="ModelAgentService">
| <wsdl:operation name="invoke">
| <wsdl:input message="tns:invokeRequestMsg" name="invokeRequestMsg"/>
| <wsdl:output message="tns:invokeResponseMsg" name="invokeResponseMsg"/>
| </wsdl:operation>
| </wsdl:portType>
| <wsdl:binding name="ModelAgentServiceSOAP" type="tns:ModelAgentService">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
| <wsdl:operation name="invoke">
| <soap:operation soapAction=""/>
| <wsdl:input name="invokeRequestMsg">
| <mime:multipartRelated>
| <mime:part>
| <soap:body parts="ModelAgentRequest" use="literal"/>
| </mime:part>
| <mime:part>
| <mime:content part="gdxAttachment" type="application/octet-stream"/>
| </mime:part>
| </mime:multipartRelated>
| </wsdl:input>
| <wsdl:output name="invokeResponseMsg">
| <mime:multipartRelated>
| <mime:part>
| <soap:body parts="ModelAgentResponse" use="literal"/>
| </mime:part>
| <mime:part>
| <mime:content part="gdxAttachment" type="application/octet-stream"/>
| </mime:part>
| </mime:multipartRelated>
| </wsdl:output>
| </wsdl:operation>
| </wsdl:binding>
| <wsdl:service name="ModelAgentSOAPService">
| <wsdl:port binding="tns:ModelAgentServiceSOAP" name="ModelAgentServiceSOAP">
| <soap:address location="http://localhost:9080/ModelAgentWeb/services/ModelAgentServiceSOAP"/>
| </wsdl:port>
| </wsdl:service>
| </wsdl:definitions>
|
All the classes are generated coorectly. However, the wsdl published by JBoss look like this
definitions name="ModelAgentService" targetNamespace="http://com.lei.nl/modelAgent" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://com.lei.nl/modelAgent" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://modelagent.lei.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| <types>
| <xs:schema targetNamespace="http://com.lei.nl/modelAgent" version="1.0" xmlns:tns="http://com.lei.nl/modelAgent" xmlns:xs="http://www.w3.org/2001/XMLSchema">
| <xs:element name="ModelAgentRequest">
| <xs:complexType>
| <xs:sequence>
| <xs:element name="modelType" type="xs:string" />
| <xs:element name="modelName" type="xs:string" />
| <xs:element maxOccurs="unbounded" minOccurs="0" name="modelParameters" nillable="true" type="tns:ModelParameter" />
| </xs:sequence>
| </xs:complexType>
| </xs:element>
| <xs:element name="ModelAgentResponse">
| <xs:complexType>
| <xs:sequence>
| <xs:element name="returnCode" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| </xs:element>
| <xs:element name="gdxAttachment" nillable="true" type="xs:base64Binary" />
| <xs:complexType name="ModelParameter">
| <xs:sequence>
| <xs:element name="parameterName" type="xs:string" />
| <xs:element name="parameterValue" type="xs:string" />
| </xs:sequence>
| </xs:complexType>
| </xs:schema>
| </types>
| <message name="ModelAgentService_invoke">
| <part element="ns1:gdxAttachment" name="gdxAttachment" />
| </message>
| <message name="ModelAgentService_invokeResponse">
| <part element="ns1:gdxAttachment" name="gdxAttachment" />
| </message>
| <portType name="ModelAgentService">
| <operation name="invoke" parameterOrder="ModelAgentRequest gdxAttachment">
| <input message="ns1:ModelAgentService_invoke" />
| <output message="ns1:ModelAgentService_invokeResponse" />
| </operation>
| </portType>
| <binding name="ModelAgentServiceBinding" type="ns1:ModelAgentService">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
| <operation name="invoke">
| <soap:operation soapAction="" />
| <input>
| <soap:body use="literal" />
| </input>
| <output>
| <soap:body use="literal" />
| </output>
| </operation>
| </binding>
| </definitions>
|
What happened here is the first parts of the request and response messages are lost, and cannot therefore not be read a client.
Has anyone any idea what i am doing wrong?
Thnak you
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262849#4262849
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262849
14 years, 8 months
[EJB 3.0 Users] - Simple hibernate web app
by pepelara
Hello,
I am a newbe in Hibernate but I am learning quickly. But I have reached a point that is taking me a lot of time.
I have developed a pretty simple web. It is just two JSP, index.jsp that redirects to user.jsp where I have all the code.
This is user.jsp,
| <%@page import="com.examscam.dao.*,com.examscam.model.*,
| com.examscam.util.*,org.hibernate.*;" contentType="text/html;" %>
|
| <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
| <jsp:useBean class="com.examscam.model.User" id="user" scope="request"/>
| <jsp:setProperty name="user" property="*" />
|
| <%
| HibernateUtil.beginTransaction();
| UserDAO userDAO = new HibernateUserDAO();
| java.util.List<User> users = null;
| String command = request.getParameter("command");
| if (command != null) {
| if (command.equals("Create")) {
| userDAO.create(user);
| }
| if (command.equals("Update")) {
| userDAO.update(user);
| }
| if (command.equals("edit")) {
| user = userDAO.findByPrimaryKey(user.getId());
| request.setAttribute("user", user);
| }
| if (command.equals("delete")) {
| userDAO.delete(user);
| request.setAttribute("user", null);
| }
| if (command.equals("Fuzzy Search")) {
| users = userDAO.findByExample(user, true);
| }
| if (command.equals("Strict Search")) {
| users = userDAO.findByExample(user, false);
| }
| if (command.equals("Clear")) {
| request.setAttribute("user", null);
| }
| }
| if (users == null) {
| users = userDAO.findAll();
| }
| request.setAttribute("users", users);
| HibernateUtil.commitTransaction();
| %>
|
| <html>
| <body>
| <form action="user.jsp">
| <!-- Here are our four textfields -->
| <input type="text" size="7"
| name="id" value=""> Id
| <BR/>
| <input type="text" size="30"
| name="loginName" value=""> Name
| <BR/>
| <input type="text" size="30"
| name="password" value=""> Password
| <BR/>
| <input type="text" size="30"
| name="emailAddress" value=""> Email
| <BR/>
| <!-- Here are all of our buttons!!! -->
| <input type="submit" name="command" value="Strict Search">
| <input type="submit" name="command" value="Fuzzy Search">
| <input type="submit" name="command" value="Update">
| <input type="submit" name="command" value="Create">
| <input type="submit" name="command" value="Clear">
| <BR>
| <c:forEach items="" var="user">
| <c:url var="editurl" value="user.jsp" >
| <c:param name="command" value="edit" />
| <c:param name="id" value=""/>
| </c:url>
| <c:url var="deleteurl" value="user.jsp" >
| <c:param name="command" value="delete" />
| <c:param name="id" value=""/>
| </c:url>
| <a href="">edit</a>
| <a href="">delete</a>
| <c:out value="" />
| <c:out value="" />
| <c:out value="" />
| <BR/>
| </c:forEach>
| </form>
| </body>
| </html>
|
The problem is that I am not building the web app correctly. For user.jsp I import a jar, hibernatedaoaccess.jar, where are the classes and interfaces I need,
| package com.examscam.dao;
|
| import java.util.List;
| import com.examscam.model.User;
|
| public interface UserDAO {
|
| public User create(User user);
| public boolean update(User user) ;
| public boolean delete(User user) ;
| public User findByPrimaryKey(Long primaryKey);
| public List<User> findByExample(User user, boolean fuzzy);
| public List<User> findAll();
|
| }
|
| package com.examscam.model;
|
| import javax.persistence.Entity;
| import javax.persistence.GeneratedValue;
| import javax.persistence.Id;
| import javax.persistence.Column;
| import javax.persistence.Table;
| import javax.persistence.Basic;
| import javax.persistence.Temporal;
| import javax.persistence.TemporalType;
| import javax.persistence.Transient;
|
| @Entity
| @Table (name="user", schema="examscam")
| public class User {
| private Long id;
| private String loginName;
| private String password;
| private String encryptedPassword;
| private String emailAddress;
| private Boolean verified;
| private java.util.Date lastAccessTime;
| private java.util.Calendar registrationDate;
|
| @Transient
| public String getEncryptedPassword() {
| return encryptedPassword;
| }
| public void setEncryptedPassword(String ep) {
| this.encryptedPassword = ep;
| }
|
| @Id
| @GeneratedValue
| @Column (name="id")
| public Long getId() {
| return id;
| }
| public void setId(Long id) {
| this.id = id;
| }
|
| @Column (name="login_name")
| public String getLoginName() {
| return loginName;
| }
| public void setLoginName(String loginName) {
| this.loginName = loginName;
| }
|
| @Column (name="password", nullable=false)
| public String getPassword() {
| return password;
| }
| public void setPassword(String password) {
| this.password = password;
| }
|
| @Column (name="emailAddress")
| public String getEmailAddress() {
| return emailAddress;
| }
|
| @Temporal(TemporalType.TIMESTAMP)
| public java.util.Date getLastAccessTime() {
| return lastAccessTime;
| }
|
| @Temporal(TemporalType.DATE)
| public java.util.Calendar getRegistrationDate() {
| return registrationDate;
| }
|
| @Basic
| public Boolean isVerified() {
| return verified;
| }
|
| public void setEmailAddress(String emailAddress) {
| this.emailAddress = emailAddress;
| }
|
| public void setLastAccessTime
| (java.util.Date lastAccessTime) {
| this.lastAccessTime = lastAccessTime;
| }
|
| public void setRegistrationDate
| (java.util.Calendar registrationDate){
| this.registrationDate = registrationDate;
| }
|
| public void setVerified(Boolean verified) {
| this.verified = verified;
| }
|
| public String toString() {
| return getId() + " : " +
| getLoginName() + " : " +
| getPassword() + " : " +
| getEmailAddress();
| }
| }
|
| package com.examscam.dao;
|
| import java.util.List;
| import org.hibernate.Criteria;
| import org.hibernate.Query;
| import org.hibernate.Session;
| import org.hibernate.criterion.Example;
| import org.hibernate.criterion.MatchMode;
| import com.examscam.model.User;
|
|
| public class HibernateUserDAO extends ExamScamDAO implements UserDAO {
|
| public User create(User user) {
| // TODO Auto-generated method stub
| if (user.getId() != null && user.getId() != 0) {
| user = null;
| }
| else {
| user.setLastAccessTime(new java.util.Date());
| user.setRegistrationDate
| (new java.util.GregorianCalendar());
| user.setVerified(false);
| super.save(user);
| }
| return user;
| }
|
| public boolean update(User user) {
| // TODO Auto-generated method stub
| boolean successFlag = true;
|
| try {
| if (user.getId() == null || user.getId() == 0) {
| successFlag = false;
| }else {
| super.save(user);
| }
| }
| catch (Throwable th) {
| successFlag = false;
| }
|
| return successFlag;
| }
|
| public boolean delete(User user) {
| // TODO Auto-generated method stub
| boolean successFlag = true;
|
| try {
| user.setPassword(" ");
| super.delete(user);
| } catch (Throwable th) {
| successFlag = false;
| }
|
| return successFlag;
| }
|
| @SuppressWarnings("unchecked")
| public List<User> findAll() {
| // TODO Auto-generated method stub
| String queryString = "from User";
| List<User> allUsers;
| Query queryResult =
| this.getSession().createQuery(queryString);
| allUsers = (List<User>) queryResult.list();
|
| return allUsers;
|
| }
|
| @SuppressWarnings("unchecked")
| public List<User> findByExample(User user, boolean fuzzy) {
| // TODO Auto-generated method stub
| List<User> users = null;
| Session session = this.getSession();
| Criteria criteria =
| session.createCriteria(User.class);
| Example example = Example.create(user);
| if (fuzzy) {
| example.enableLike(MatchMode.ANYWHERE);
| example.ignoreCase();
| example.excludeZeroes();
| }
| criteria.add(example);
| List<User> list = (List<User>) criteria.list();
| users = list;
| return users;
|
| }
|
| public User findByPrimaryKey(Long primaryKey) {
| // TODO Auto-generated method stub
| User user = (User)
| super.findByPrimaryKey(User.class, primaryKey);
|
| return user;
|
| }
|
| }
|
The question is depending on where I put the jar, running the web app against JBoss 4.2.2 GA, it does not find the hibernate.cfg.xml file or the interface UserDao as well.
And I can not get it works.
Any idea?
I am developing on Eclipse Ganymede RS1 that integrates the Data Base if needed and the apps server.
Thanking in advance,
Jose
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4262842#4262842
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4262842
14 years, 8 months