Hey guys and gals,
I am having some problems with a j2ee application I am creating and I was wondering whether there are any guru's on the forums?
Thanks in advance,
Leon
Hey guys and gals,
I am having some problems with a j2ee application I am creating and I was wondering whether there are any guru's on the forums?
Thanks in advance,
Leon
There are several people on here with Java and J2EE experience - including me.
Post your problem...
cheers,
dave
Let's see what's troubling you and maybe someone can help.
To err is human. To really foul things up ... you need a computer.
Cool nice one guys:
Right I have two beans, route and delivery request. There is a relationship between them to say a delivery request has many routes. This deploys fine. However I am using asant run-client together with code used to test the beans without sitting them in a jsp/serlet.
However when I run the command I get the following error:
I know that the problem is in the parcel request bean because my test code works without the call to DeliveryRequest newDR = drHome.create(dr);.Buildfile: C:\Documents and Settings\Leon Allen\My Documents\Parcel_Tracking\build.xml
run-client:
[java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[java] java.rmi.RemoteException: Bean class for ejb [DeliveryRequestBean] does not define a method corresponding to [Home] interface method [public abstract model.DeliveryRequest model.DeliveryRequestHome.create(model.DeliveryRequestDTO) throws java.rmi.RemoteException,javax.ejb.CreateException]
[java] at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:170)
[java] at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
[java] at model._DeliveryRequestHome_Stub.create(Unknown Source)
[java] at client.RouteClient.exerciseBusinessMethods(RouteClient.java:97)
[java] at client.RouteClient.main(RouteClient.java:35)
[java] Caused by: java.rmi.RemoteException: Bean class for ejb [DeliveryRequestBean] does not define a method corresponding to [Home] interface method [public abstract model.DeliveryRequest model.DeliveryRequestHome.create(model.DeliveryRequestDTO) throws java.rmi.RemoteException,javax.ejb.CreateException]
[java] at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:128)
[java] at $Proxy42.create(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
[java] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequest DispatcherImpl.java:651)
[java] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatche rImpl.java:190)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImp l.java:1653)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java: 1513)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:89 5)
[java] at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:17 2)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java: 668)
[java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl .java:375)
[java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.jav a:284)
[java] at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
[java] at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)
BUILD SUCCESSFUL
Total time: 3 seconds
Any ideas?
Thanks for any help,
Leon
Does your bean class have the corresponding ejbCreate(DeliveryRequestDTO) and ejbPostCreate(DeliveryRequestDTO) methods?
cheers,
dave
A server runtime exception perhaps? Could the delivery requets bean not 'like' asant? A server runtime exception would happen if you didnt have the right delivery requests.
To err is human. To really foul things up ... you need a computer.
Wilkied - thanks for that, I did have the methods but I was specifying that it took the other class not DeliveryRequestDTO. So thanks!
However got another one now(sorry about this!)
I have checked the ejb ref's tab for the RouteBean and it is set to be ejb/routeBean. Any ideas?run-client:
[java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[java] java.rmi.RemoteException: nested exception is: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/routeBean; nested exception is:
[java] javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/routeBean
[java] at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:170)
[java] at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
[java] at model._DeliveryRequestHome_Stub.create(Unknown Source)
[java] at client.RouteClient.exerciseBusinessMethods(RouteClient.java:97)
[java] at client.RouteClient.main(RouteClient.java:35)
[java] Caused by: java.rmi.RemoteException: nested exception is: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/routeBean; nested exception is:
[java] javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/routeBean
[java] at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:213)
[java] at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:797)
[java] at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:194)
[java] at $Proxy58.create(Unknown Source)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:117)
[java] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequest DispatcherImpl.java:651)
[java] at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatche rImpl.java:190)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImp l.java:1653)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java: 1513)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:89 5)
[java] at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:17 2)
[java] at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java: 668)
[java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl .java:375)
[java] at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.jav a:284)
[java] at com.sun.corba.ee.impl.transport.ReaderThreadImpl.doWork(ReaderThreadImpl.java:73)
[java] at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:382)
[java] Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/routeBean
[java] at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:665)
[java] at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:108)
[java] at javax.naming.InitialContext.lookup(InitialContext.java:351)
[java] at model.DeliveryRequestBean.establi****emHome(DeliveryRequestBean.java:458)
[java] at model.DeliveryRequestBean.ejbCreate(DeliveryRequestBean.java:291)
[java] at model.DeliveryRequestBean_586119849_ConcreteImpl.ejbCreate(DeliveryRequestBean_586119849_ConcreteImp l.java:654)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:585)
[java] at com.sun.enterprise.security.SecurityUtil$2.run(SecurityUtil.java:146)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at com.sun.enterprise.security.application.EJBSecurityManager.doAsPrivileged(EJBSecurityManager.java:93 0)
[java] at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:151)
[java] at com.sun.ejb.containers.EJBHomeInvocationHandler.invoke(EJBHomeInvocationHandler.java:166)
[java] ... 17 more
Thanks again,
Leon
Doh, just realised I was being stupid, had the reference on the wrong bean![]()
Gotta restart the server now and fingers crossed it may work ....
Mwuh ha ha (weird manical laughter)
You fix one problem, and another one pops up
Any ideas on this one?run-client:
[java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
[java] java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
[java] javax.transaction.RollbackException: Transaction marked for rollback.
[java] at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:170)
[java] at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
[java] at model._DeliveryRequestHome_Stub.create(Unknown Source)
[java] at client.RouteClient.exerciseBusinessMethods(RouteClient.java:97)
[java] at client.RouteClient.main(RouteClient.java:35)
[java] Caused by: java.rmi.RemoteException: Transaction aborted; nested exception is: javax.transaction.RollbackException: Transaction marked for rollback.; nested exception is:
[java] javax.transaction.RollbackException: Transaction marked for rollback.
[java] at com.sun.enterprise.iiop.POAProtocolMgr.mapException(POAProtocolMgr.java:213)
[java] at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:797)....
Sorry about this barrage of questions,
Leon
That one is probably a little hard to decipher without the code to hand. What application server are you using out of interest? Are you handling your own transactional model or is the container doing it?
"All our beliefs are being challenged now, and rightfully so, they're stupid." - Bill Hicks
THAT is sooooo cheating.
How did i know it would be leon, without even looking?! he he he
Rai: How is this cheating? I'm not asking them to do my assignment just help me with teething problems
DaBeeenster: I'm using the sun application server with container managed persitance.
I was joking hun, you know what i'm like... CHILLL OUT!
gimme a few days, and i'll be on here racking their brains!
Wahooo think it works, time to backupThat's for all the help guys.
I'm sure I will be back later with more questions.
Thanks again.
Right guys I have another question (sorry). If I use a jsp page to access a bean e.g.
This will input a row into my database table but it is always the same row. i.e. when I reload the page it overwrites the row I have just inputed.Code:<%-- * Allowing customers to choose how they want the parcel to be sent --%> <%@ page language="java" %> <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en"> <%@ page import="model.DeliveryRequest, model.DeliveryRequestHome, model.DeliveryRequestDTO, javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %> <%! private DeliveryRequest dRequest = null; public void jspInit() { } public void jspDestroy() { dRequest = null; } %> <html> <head><link rel="stylesheet" type="text/css" href="pts_style.css"/></head> <body> <center><h3>Delivery Request Testing</h3></center> <p> <% String fullname = request.getParameter("fullname"); String pack_weight = request.getParameter("pack_weight"); String coll_address1 = request.getParameter("coll_address1"); String coll_address2 = request.getParameter("coll_address2"); String coll_towncity = request.getParameter("coll_towncity"); String coll_postcode = request.getParameter("coll_postcode"); String coll_country = request.getParameter("coll_country"); String dest_address1 = request.getParameter("dest_address1"); String dest_address2 = request.getParameter("dest_address2"); String dest_towncity= request.getParameter("dest_towncity"); String dest_postcode = request.getParameter("dest_postcode"); String dest_country = request.getParameter("dest_country"); %> <% try { InitialContext ic = new InitialContext(); Object objRef = ic.lookup("java:comp/env/ejb/TheDelivery"); DeliveryRequestHome drHome = (DeliveryRequestHome)PortableRemoteObject.narrow(objRef, DeliveryRequestHome.class); DeliveryRequestDTO newDR = new DeliveryRequestDTO("1235",fullname,pack_weight,coll_address1,coll_address2,coll_towncity,coll_postcode,coll_country,dest_address1,dest_address2,dest_towncity,dest_postcode,dest_country); dRequest = drHome.create(newDR); } catch (RemoteException ex) { System.out.println("Couldn't create delivery request bean."+ ex.getMessage()); } catch (CreateException ex) { System.out.println("Couldn't create delivery request bean."+ ex.getMessage()); } catch (NamingException ex) { System.out.println("Unable to lookup home: "+ "TheDelivery "+ ex.getMessage()); } %> </body> </html>
Can anyone tell me how to fix this?
Thanks again,
Leon
When you reload the page? Are you certain it's just not the same record that was inserted before, that it is not being overwritten?
To err is human. To really foul things up ... you need a computer.
There are currently 1 users browsing this thread. (0 members and 1 guests)