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.
Related
Hi I already develop my application using Netbeans IDE.
Now I want to run my application in Tomcat server for actual use. I already copy my project to tomcat/webapps.
But when I tried to run my application:
http://localhost:8081/myAppFolder/
it gives me an error message :The requested resource (/Opportunities-Registration/) is not available.
I should change the url to make it work:
http://localhost:8081/Opportunities-Registration/web/index.jsp
How can I open my application using http://localhost:8081/myAppFolder/ insteand of http://localhost:8081/Opportunities-Registration/web/index.jsp ?
Update:
All my servlet is also become 404 not found
Thank you
SOLVED
Solution:
1. copy .war file which is contained in dist folder of your netbeans project
2. Place your .war file to tomcat/webapps
3. Start your tomcat
4. You are good to go
I am coding a website using java servlets and am using eclipse and tomcat. When I test it using localhost, it works fine. But when I am deploying it on my actual website, the directory structure is messed up and the files are not called properly.
My eclipse directory structure on localhost is
Project Name
.src/packageName/java files
.WebContent/HTML files.
When I make a call from the html files, I use the relative location and tomcat automatically knows to look in the src/packageName folder. For example, from the /WebContent/login.html page makes a onClick call as follows,
. This will automatically trigger the java file in /src/packageName/welcome
When I am deploying it in my actual website, the WebContent/login.html is throwing an error WebContent/welcome file is not found. How do I tell my website to search in /src/packageName folder?
Hmm...have you been sure to package the application as a war for deployment.
I get 404 error when trying to run a jsp file eclipse. The confusing thing is the server is running and I can go to localhost:8080 without any problems. I have attached an image of my configuration of server, the jsp file and also the location of the file and the error.
I embed the image cause of the reputation thing so I have linked it
More information:
I am using TOMCAT 7, ECLIPSE KEPLER I have checked the location of helloworld.jsp its in WebContent. I have restarted the server. I have created another dynamic web project nothing works. I get the same problem I can go to localhost:8080 but I cant run an JSP file
SOLVED:
Okay guys its pretty simple to solve this problem. There are two things you need to try.
1)Right click your project and export the war file into C:\ProgramFiles\Tomcat7 folder
If this does not work then.
2) Right click your project and export the war file into some directory and copy the war file into C:\ProgramFiles\Tomcat7 then start the Tomcat server and there you go your JSP file work.
You will probably end up doing step 2 because of stupid windows file permissions
Also thanks for all the help guys really appreciate it.
Make sure that u have put your Jsp files into the WebRoot and check the location and even check your Web.xml and after that run and still if its not working then post your Web.xml here.
Unfortunately, user3135774's solution does not work for me, as am using an Apple computer.
I have read and researched another problem (Error 500: No Output Folder), which I have along with Error 404, carefully, and I think this is related to permission issues.
The JSP file is supposed to be compiled and then deployed under Tomcat/work/Catalina/localhost/YourProjectName. The 404 error message means that there is no files in that directory. Since Eclipse has no write permission to this directory, you have to change the access permissions. After changing the permission to 777, there we have the compiled .java and .class files.
Since you do not have any of them
index.html/index.htm/index.jsp/default.html/default.htm/default.jsp page
To run your jsp page :
In Eclipse:
=>goto Java Resource
=>right click on your jsp page
=>in that select Run as Server.
After applying everythings, it did not work for me to read image file in eclips.
Finally, It works! after that I change deploy path.
Server Locations>Deploy path(Set with "Workspace" of Eclipse)
I have been working on a Java web application and i am using SmartGwt on Netbeans 7.3 and out of a sudden I encountered this problem. I tried cleaning the build-impl.xml then restarting the IDE and I should say I have fairly low knowledge on this. Can someone please tell me why it is giving an error and how I can fix that?
The error message says :
nbproject/build-impl.xml:1031: The module has not been deployed. See the server log for details.
BUILD FAILED (total time: 4 seconds)
Note: i am using Tomcat 7.0.34
may its so late but the response useful for others so :
Sometimes, when you don't specify a server or servlet container at the
creation of the project, NetBeans fails to create a context.xml file.
In your project under Web Pages, create a folder called META-INF.
Do this by right mouse button clicking on Web pages, and select:
New->Other->Other->File Folder
Name the folder META-INF. Case is important, even on Windows.
Create a file called context.xml in the META-INF folder.
Do this by right mouse button clicking on the new META-INF folder, and
select:
New->Other->XML->XML Document
Name it context (NetBeans adds the .xml)
Select Well-formed Document
Press Finish
Edit the new document (context.xml), and add the following:
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/app-name"/>
Replace app-name with the name of your application.
Now your in-place deployment should work. If not, make sure that the
file can be read by everyone.
The context.xml file is specific to Tomcat. For more information about
that file, see the Tomcat documentation at tomcat.apache.org.
Start your IDE with administrative privilege( Windows: right click and run as admin), so that it has read write access to tomact folder for deployment. It worked for me.
Take a look at the server logs!
I had been with this for hours. The awful Tomcat servlet is not very helpful neither but if you can see the stacktrace that should be enough.
For instance, I read the following error message there:
As you can see, the message was pretty clear and easy to fix :-)
Check if there any other instance of the server is running already
Check if the port that will be used by the server is free.
If you add jars in tomcat's lib folder you can see this error
Close Netbeans.
Delete all libraries in the folder "yourprojectfolder"\build\web\WEB-INF\lib
Open Netbeans.
Clean and Build project.
Deploy project.
One of the main reason for this error is due to permission not granted to all users. so remove this error, follow the following steps :
1) Go to the C:/Programme Files/Apache Software Foundation/Tomcat 7.0
2) Right click on the Tomcat 7.0 folder and click on properties.
3) go to Security Tab.
4) Select the User and click on Edit... button
5) Grant all the permission to the user and click on apply and ok.
Refresh the system and now try. I hope it will work
if you still getting this error try this.
Go to Netbeans services
Remove Apache Tomcat.
Add Apache Tomcat again.
Build Project.
Deploy Project
in my case , it said that the 8080 port is in use , so I change the server port of Tomcat to 8081 and it works
Check whether you placed the within the .. or outside the ...
If you placed it outside the server tag , and if you try to access the init-parameter then it will give error.
Where can I view Tomcat log files in Eclipse?
For some reason my Tomcat installation/log folder is always empty.
BTW, does Tomcat dump to the log file after a while or is it immediate?
I'm not sure if you were after catalina.out or one of the other logs produced by Tomcat.
But, if you're after the catalina.out log file then follow the directions below:
In the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration". Click on the "Common" tab.
Towards the bottom of the screen you can check the "File" checkbox and then specify a file that can be used to log your console (catalina.out) output.
Finally, restart the Tomcat server.
Go to the "Server" view, then double-click the Tomcat server you're running. The access log files are stored relative to the path in the "Server path" field, which itself is relative to the workspace path.
Another forum provided this answer:
Ahh, figured this out. The following system properties need to be set, so that the "logging.properties" file can be picked up.
Assuming that the tomcat is located under an Eclipse project, add the following under the "Arguments" tab of its launch configuration:
-Dcatalina.base="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Dcatalina.home="${project_loc}\<apache-tomcat-5.5.23_loc>"
-Djava.util.logging.config.file="${project_loc}\<apache-tomcat-5.5.23_loc>\conf\logging.properties"
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
http://www.coderanch.com/t/442412/Tomcat/Tweaking-tomcat-logging-properties-file
Looks like the logs are scattered? I found access logs under
<ProjectLocation>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\logs
if you're after the catalina.out log and you are using eclispe with tomcat, this works for me:
create catelina.out some where in your computer. In my case, I put it in logs directory of my tomcat install directory
e.g: /opt/apache-tomcat-7.0.83/logs/catena.out
go to your eclipse, in the servers tab, double-click on the Tomcat Server. You will get a screen called Overview.
Click on "Open launch configuration". Then click on the "Common" tab.
At standard input and output section, check "output file", click on file system and then selected the folder where your create your catelina.out.
Finally, restart the Tomcat server.
#royalsampler said:
Go to the Servers view in Eclipse then right click on the server and click Open. The log files are stored in a folder realative to the path in the "Server path" field.
Since the path field is uneditable, you can also "Open Launch Configuration", click Arguments tab, copy the VM argument for catalina.base (within quotes). This is the full path of your WTP webapp directory. Copying the value to the clipboard can save you the laborious task of browsing the file system to the path.
Also note you should be seeing the output to the log file in your Console view as you run or debug.
Double click and open the server.
Go to 'Arguments'.
-Dcatalina.base= .. something.
Go to that something.
Your logs are there.
If you want logs in a separate file other than the console:
Double click on the server--> Open Launch Configuration--> Arguments --> add
-Dlog.dir = "Path where you want to store this file" and restart the server.
Tip: Make sure that the server is not running when you are trying to add the argument.
You should have log4j or similar logging framework in place.