Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

making the bean a servlet  RSS feed

 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am trying to extend my Session bean to Generic/HttpServlet...i know its bogus...but i only want to do it.

i added to my bean


public class ABCBean extends GenericServlet implements SessionBean
{
//usual methods
.....
.....
// and

public void service(HttpRequest req, HttpResponse res)
{

response.setContentType("text/html");
// get the printwriter
// print something
}

}


For your information...i compiled it FLAWlessly

only at deployment i got "component missing from the application" error (in logs)

Any Ideas...wild guesses!!!

expecting a quick reply

Jay
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course it is wired and we have this discussion only for the sake of your exercise.
In theory there is nothing stopping you from having a servlet implementing whatever interface you�d like, or a bean extending whatever class you want. Hence at least in theory you might be able to develop your class twice, once as a Servelt and second as an EJB. However the servlet cannot act as an ejb or vice versa (this is why I�m thinking you need two entries in your deployment descriptor and the same class deployed twice, once in an ejb.jar and second within the war). The reason is very simple: the servlet gets deployed within your web app as part of the WEB-INF/classes folder, listen to http requests and has its special set of deployment descriptors element, while the ejb gets deployed within the ejb container in its own ejb-jar file, has a different set of deployment descriptors and listen to RMI/IIOP, or local method calls.
So, how do your deployment descriptors look like, and how does your packaging looks like?
 
jay akhawri
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi valentin,

actually i was thinking about the diployment descriptor the other way...

1) i need to have a war file and i have a servlet too (the bean that extends to it).

2) i need to have dd that tells about my servlet to container.

Now (offcource i have not tried it right now, as i wanna right down the ideas as it comes..nevermind)

I must be able to redeploy the same bean class (now a servlet)...as a web component of the same old bean application...whose gonna object!!

then call my bean as servlet or let my bean execute a service() method.

Benefits....it will be too early to think bout that.

thanks,Happy thinking,
Jay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!