I have a JSP page titled "index.jsp" which uses three entity beans StudentEJB, LoginEJB, InstructorEJB. I get the following error when trying to deploy the CreateWAR web
component( which contains index.jsp) using the J2EE server provided by Sun. The names ending with home refer to the
remote home interface and the other names refer to the remote interface of the corresponding entity bean.
Error: Class [ InstructorHome ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /CreateWAR ]
Error: class [ InstructorHome ] cannot be found within this jar [ CreateWAR ].
Error: Class [ Instructor ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /CreateWAR ]
I have also enclosed a part of the index.jsp code snippet below
<%@ page import="Instructor,InstructorHome,Student,StudentHome,Login,LoginHome,javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException,java.io.*,java.util.*" %>
<%!
Login myLogin;
Instructor myInstructor;
Student myStudent;
InstructorHome instructorHome = null;
LoginHome loginHome = null;
StudentHome studentHome = null;
public void jspInit() {
try {
InitialContext ctx = new InitialContext();
Context myEnv1 = (Context)ctx.lookup("java:comp/env");
Object objref1 = myEnv1.lookup("ejb/SimpleInstructor");
instructorHome = ( InstructorHome ) PortableRemoteObject.narrow( objref1, InstructorHome.class);
Context myEnv2 = (Context)ctx.lookup("java:comp/env");
Object objref2 = myEnv2.lookup("ejb/SimpleLogin");
loginHome = ( LoginHome ) PortableRemoteObject.narrow( objref1, LoginHome.class);
Context myEnv3 = (Context)ctx.lookup("java:comp/env");
Object objref3 = myEnv1.lookup("ejb/SimpleStudent");
studentHome = ( StudentHome ) PortableRemoteObject.narrow( objref1, StudentHome.class);
} catch (RemoteException ex) {
System.out.println("Couldn't create the beans."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("Couldn't create the beans."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home objects: "+ ex.getMessage());
}
Could some please help me with this problem
Regards,
Vishwak Rajgopalan
-
Problem in deploying web components (5 messages)
- Posted by: vishwak rajgopalan
- Posted on: October 05 2003 18:37 EDT
Threaded Messages (5)
- Re:Problem in deploying web components by Badrish Agarwal on October 06 2003 00:04 EDT
- Problem with deploying web components by vishwak rajgopalan on October 06 2003 12:37 EDT
- Problem in deploying web components by km kasi on October 06 2003 03:35 EDT
- where you put your supporting files by shashi shekar on October 06 2003 06:24 EDT
- where you put your supporting files by ashish verma on October 06 2003 07:42 EDT
-
Re:Problem in deploying web components[ Go to top ]
- Posted by: Badrish Agarwal
- Posted on: October 06 2003 00:04 EDT
- in response to vishwak rajgopalan
War file contains only web components like Servlet, jsp etc.
Your ejb needs to be present in a jar file and this jar file should be accessible to your web components.
Where are your ejbs deployed ?
Right now your web component is not able to find ejbs. -
Problem with deploying web components[ Go to top ]
- Posted by: vishwak rajgopalan
- Posted on: October 06 2003 12:37 EDT
- in response to Badrish Agarwal
War file contains only web components like Servlet, jsp etc.
> Your ejb needs to be present in a jar file and this jar file should be accessible to your web components.
> Where are your ejbs deployed ?
> Right now your web component is not able to find ejbs.
My ejbs are deployed in a jar file which is in the same folder as the war file
I created. I have created both the war( CreateWAR ) and the jar files (CreateJAR) as a part of an ear file called "CreateProductApp.ear". -
Problem in deploying web components[ Go to top ]
- Posted by: km kasi
- Posted on: October 06 2003 03:35 EDT
- in response to vishwak rajgopalan
AWeb archive contains the files that make up a Web Application (WAR file). A WAR
file is deployed as a unit on one or more Servers.
A Web archive on WebLogic Server always includes the following files:
At least one servlet or JSP page, along with any helper classes.
A web.xml deployment descriptor, a J2EE standard XML document that
describes the contents of a WAR file.
A XXXXX.xml deployment descriptor, an XML document containing
Server-specific elements for Web applications.
A Web archive may also include HTML/XML pages and supporting files such as
image and multimedia files.
TheWAR file can be deployed alone or packaged in an Enterprise Archive (EAR file) with other application components. If deployed alone, the archive must end with a .war extension. If deployed in an EAR file, the archive must end with an .ear extension. (Note: If you are deploying an entire directory, do not name the directory .ear, .war, .jar and so on.)Servlets -
where you put your supporting files[ Go to top ]
- Posted by: shashi shekar
- Posted on: October 06 2003 06:24 EDT
- in response to vishwak rajgopalan
I mean while you creating war file did you include jar(which contains your supporting classes) file in the web-inf/lib directory. -
where you put your supporting files[ Go to top ]
- Posted by: ashish verma
- Posted on: October 06 2003 07:42 EDT
- in response to shashi shekar
Just bit different from topic.
Have a look at this and this should help u in understanding it.
By the way its a wrong practice to put lookup in Jsp or Servlets.
War- files for web components.
Jar- for ejb components and others.
Ear file contains web.war ejb.jar client.jar files
http://www.tusc.com.au/tutorial/html/index.html
Vishal.