I compiled a servlet with jsk19 with netbeans. Servlet is deployed on ApacheTomcat10. I can open that Servlet writing directly servlet URL pattern in my browser, but on Netbeans if I run this servlet a message appears "browser cannot be run". I have checked many times my configuration with "TOOLS" "OPTION" "GENERAL". I also tried to start browser (Firefox) via "shell" to be sure netbeans path configuration of browser was right and it was right. I Also tried to configure my browser clicking with right click mouse on my project and set up browser configuration inside option, but same trouble came-up. My log file error in netbeans reports nothing about this error. Any guess?
Related
I have made a website in java struts2 and i have hosted it.
Its running well but what happens is whenever i try to execute any action it gives error of 404 . when i run on any local server through eclipse everything is fine ,no error and no exceptions but after hosting it gives this error.
when i run on local host its URL is ёhttp://localhost:8280/foryou/searchonbb.actionё and everything works perfectly.
and when i try to execute same action online its shows URL something like this http://info4blood.in/foryou/foryou/BloodBankSection.jsp#login and error image is attached . what i found is when i deployed app in Cpanel all java classes are placed in WEB-INF folder with .class files as well. So is this the problem ?? But i am able to login in to an account and after login into any account and when try to execute some action i face problem.
Note: while uploading my web app i set contextpath to "foryou".
Anybody please help . Thanks in advance :)
From what I can understand, it's a context problem.
Fix your code such that is works for root context (/) locally i.e. http://localhost:8280/foryou/searchonbb.action will become
http://localhost:8280/searchonbb.action
Upload on server with name ROOT.war (case is important)
If there is existing ROOT.war on server, simply stop tomcat and rename it and then upload your ROOT.war
This worked for me :
In eclipse (right click on my project) under properties > web project settings > set context path to "/" and now make WAR file of your project .
Upload project in NGASI panel (hosting panel provided by webhosting providers) and deploy your project and after deploying (it will ask you to set context path) set context path in ngasi panel to "foryou" which is my project name and deployed it .and it worked perfectly !
I'm using NetBeans 7.2 and GlassFish 3.1.2 and I'm running a web application with JSPs and Servlets. There seems to be some errors in the output because I'm getting a blank webpage when the app is run. I understand that the log file is located in glassfish/domains/logs folder, but I'm not able to see any System.out or System.err inside of that text file.
Is there anything I have to configure so that I can read the log and come to know as to where I'm going wrong? Ideally I'm trying to debug the servlet.
In NetBeans, go to Tools->Servers. Select the GlassFish Server and on the 'common' tab the 'Domains folder' + the 'Domain Name' is the root folder you need to browse to on your machine. Inside of that folder, you'll see a 'logs' folder which will contain the 'server.log' file.
I made a small web application using Netbeans, it contains some JSP pages. Anyway, when I built the project it created a folder called dist and inside it there's a .war file. How do I run it? When creating my application I used GlassFish Server and JavaDB for Database.
Try the following steps;
Log in to glassfish at :http://localhost:4848/ (typically) providing
the user name and password.
Click on the applications on the common tasks on left frame of
browser and then click on the deploy button to bring in the Deploy
Applications or Modules screen.
Click on the browse button to locate your war or alternatively you
can choose any local packaged file or directory check box to locate
your application archive or directory. Remember the type of the
application is a mandatory field which you have to choose otherwise
you can't proceed further.
Click "Ok" to deploy. Once successful, it takes you to application
page, there you can see Launch, Redeploy and Restart depending the
application type. If you want to undeploy or enable/disable
particular application you can do so by selecting the check box and
then click the desired button.
You have to deploy the war to your application server in order to run it.
I’m trying to develop a Spring 3 MVC application using the Springsource Tool Suite/Eclipse IDE.
My current application context in STS/Eclipse is /localhost:8080/realtyguide/
What I want is to access the application as root using just /localhost:8080/
I tried in eclipse.. Project > Properties > Web Project Settings > entered “/” for Context Root . But this just returned a “404 error - requested resource (/) is not available” after executing the app. And it also broke the app. So I just put context root back to 'realtyguide'.
I deployed the app to my webhost on a Tomcat server. I edited the server.xml’s and elements and so I was able to bring up the index page with the url www.mydomain.com.
However, the links to the other pages are broken. It is also not picking up the static resources for the index page like css and jquery files.
I believe this is caused by my app’s application context of /localhost:8080/realtyguide/ in eclipse (in my development pc). The rest of the pages returned by my controller has a url of /localhost:8080/realtyguide/page_name
How do I change my app’s application context to run as root in eclipse, as in simply /localhost:8080/. So that my pages would be called as simply /localhost:8080/page_name
Is the solution a setting I should make in my web or Spring configuration files or in eclipse?
I’ve tried googling this but have not found a clear, definitve answer. I am very new to this and a detailed answer from you will be of great help.
Thanks to the other answers provided. However, it doesn't address my main objective - to run the app as root inside eclipse.
This is how I was able to do it. I changed Tomcat's conyext path in eclipse.
Do the following:
Right click on the server name from the Server Console > Open
Click on the Modules tab
Click on a module then click the Edit button
Edit the entry for Path to the desired context path then click
OK
You need to make your web-app the "default" application, ROOT. There are step-by-step instructions on the Tomcat Wiki, at http://wiki.apache.org/tomcat/HowTo#How_do_I_make_my_web_application_be_the_Tomcat_default_application.3F.
One way is to name the war simply ROOT.war (uppercase).
This works only if you deploy not from eclipse
If you have done your links/urls with <c:url> or <spring:url> then it should work without problems.
Simply change server.xml in Tomcat Server.
Package Explorer > Servers
expend path Tomcat vX.X Server
open server.xml
go to Server > Service > Engine
find your Context and change path to value "/"
restart the server!
I installed Apache Tomcat on my Windows machine, and it seems like its installed successfuly. I can see the property window, and I can start the server but I don't know what to do next.
Where do I save jsp files at.. do I create a directory or does apache tomcat create its own directories?
that's my only problem.. how do i make and edit files now that its installed
Create the JSP code that you'd like to write in your favorite text editor.
Select "File" and "Save As" from the text editor toolbar. A dialog box appears.
Navigate to the "File name" text field and type the desired file name within quotes. Add a JSP extension to the file name -- for example, "filename.jsp" -- and click "Save."
Put it at location C:\apache-tomcat-7.0.28\webapps\ROOT.
Go to tour browser and enter url "http:// localhost:8080//filename.jsp"
This post will give you description about how you can run your project using Apache Tomcat Server.
I would like to define these terms before proceeding:
Apache Tomcat Server(Jakarta Tomcat): It is an open source web server and servlet container developed by the Apache Software Foundation (ASF). It implements the Java Servlet and the JavaServer Pages (JSP) specifications and provides a pure Java HTTP web server environment for java code to run.
JavaServerPages(JSP): It is a technology that helps in creating dynamically generated web pages.
Step1
Install Java.
Step2
Install Apache Tomcat
At the time of installation, it will by-default recognize JRE path.
(under installed java location directory)
Step3
Now Go-To:
Start
Programs
APACHE TOMCAT
MONITOR TOMCAT
Step4
An icon will appear on the taskbar, this icon will automatically appear after following
above step:
Step5
Click on that icon and START TOMCAT, you can see the following dialog box:
Step6
Now open Mozilla Firefox(or any other browser)
Step7
Type
[http://localhost:8080/][1] on address bar and press enter.
The same can be seen here:
Step8
It will show tomcat, as shown in above window.
(if not, then try again, may be a problem in installation or you’re not following above
steps correctly
Step9
Now, go to:
C:drive
Programs Files
Apache Software Foundation
tomcat
web-apps
(or navigate where you have installed APACHE TOMCAT)
Step10
Open web-apps and “copy your project” or “make new folder”, which you want to run in JSP.
Example: amit2012PROJECT
Now, go back :
Tomcat
Root
Copy Web-inf from root
Paste this “web-inf” in your project folder i.e. amit2012PROJECT
Step11
Create a text file and name it as first.jsp, use the code shown below:
<html>
<head>
<title>blog post:ApacheTomcatServer</title>
</head>
<body>
<%-- START --%>
<%
out.println("UserName = amit2012, ");
out.println("Running first program in JSP.");
%>
<%-- END --%>
</body>
</html>
It includes HTML tags and encloses a JSP scriptlet which is a fragment of Java code that is run when the user requests the page.
Step12
Now for running your folder [ Eg. amit2012PROJECT as shown above]
[http://localhost:8080/][2]foldername.extension in any WebBrowser i.e:
[http://localhost:8080/amit2012PROJECT/first.jsp][3]
The Project will run successfully
Now, you can successfully try running JSP with ApacheTomcatServer.
Folder structure:
Apache-home/webapps/project_name/WEB-INF/classes
all jsp filse should come under project_name folder. and java classes comes under clasess.
Also need to put a special file named web.xml in WEB-INF folder.
You need to read this first. The file and directory structure of a web app.
First you need to start your server by going to bin folder present in tomcat
then double click the start.bat
now the server is up and running
now open a browser ,open tomcat
u will see the homepage of server
i think u might have already created a folder in webapps folder of tomcat
directory structure would look like this tomcatfolder --> webapps --> your file name let it be some " test " --> then the jsp file you have created
to run a jsp file located as shown in the above directory structure u need to type the url localhost:8080/test/file name of jsp
if it runs ok or otherwise if
server throws an error then it needs tools.jar file
go to the directory where u have ur jdk kit
open jdk file, then open lib file
copy tools.jar present in it
now again go to tomcat folder ,
open it and then go to lib folder paste it down there
over,go to browser type the url
$locallhost:8080/test/file name of jsp( dont type the $ symbol)
it should run now now..........