This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable To compile Servlets and Jsp

 
Yati Tan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to WebSphere and trying to compile simple Servlets and JSP files in my application already installed on WebSphere. Can anybody tell me how can I compile Simple Java file in Websphere Server ??

Pls reply soon.
 
Saurabh Deshpande
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi what are you using to build the jsp and servlets?
any IDE? or you have build the application and deployed on the server?
 
Yati Tan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saurabh ,

I am learning Web Sphere on my own and therefore, modifying the existing Java files and JSPs in already installed application. I dont know which IDE should I use with WebSphere. I read somewhere, Eclipse go with WebSphere on IBM website.

Can you still help me in compiling Java files which are in existing application in my Websphere Server folder.
 
Saurabh Deshpande
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Jsps get automatically compiled by the Websphere Server as far as my understanding goes.
Try to compile the java source files with our java commands as we would do for any standalone java application.
Include the lib folder in your classpath and the j2ee.jar and other jars you may require for your project.
 
Saurabh Deshpande
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse is an open-source IDE from Apache.
Websphere Studio Applicaiton Developer (WSAD) is a licensed IDE from IBM built on top of Eclipse with built-in Websphere Server
You can use eclipse to build(compile) the application and deploy using Websphere server.
Eclipse comes with built-in Tomcat and JBoss Servers. You can configure it to use different servers. But never did it with Wepshere.

Were you able to compile the jsps?
 
Yati Tan
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Saurabh,

I am still h aving problem in compiling my java files which are in one of the packages on Websphere. The problem is that "javac" compiler is not identifying the packages mentioned on the top of class which I have imported. I have included all Jar's files in the classpath - Could you tell me where I went wrong.


My import statement looks like :
import java.io.IOException;
import java.rmi.NoSuchObjectException;
import java.util.Vector;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.ibm.websphere.samples.plantsbywebsphereejb.Catalog;
import com.ibm.websphere.samples.plantsbywebsphereejb.CatalogHome;
import com.ibm.websphere.samples.plantsbywebsphereejb.CustomerInfo;
import com.ibm.websphere.samples.plantsbywebsphereejb.OrderInfo;
import com.ibm.websphere.samples.plantsbywebsphereejb.OrderKey;
import com.ibm.websphere.samples.plantsbywebsphereejb.ShoppingCart;
import com.ibm.websphere.samples.plantsbywebsphereejb.ShoppingCartContents;
import com.ibm.websphere.samples.plantsbywebsphereejb.ShoppingCartHome;
import com.ibm.websphere.samples.plantsbywebsphereejb.StoreItem;
import com.ibm.websphere.samples.plantsbywebsphereejb.Util;

and After I am compiling my Java file, Iam getting problem as -

ShoppingServlet.java:238: cannot find symbol
symbol : variable Util
location: class com.ibm.websphere.samples.plantsbywebspherewar.ShoppingServlet
Util.debug("updatequantity: shopping cart ref must have timed out
, create a new one");

Where as I have imported the file Util through import statements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic