I've just bought an iMac and would like to start programming on it. But I can't configure Tomcat and Netbeans to work together. I installed Tomcat and it seems it is working. But when I try to build a web application, netbeans ask all the time my user name and password. I already configured the user.xml but it's not working.
Can anyone give a tip?
Cheers
I had the same issue and I followed #Raph's answer and it worked. After that, I had another issue, Netbeans returned this error message:
Deployment error: Starting of Tomcat failed, check whether the /Applications/Tomcat/bin/catalina.sh and related scripts are executable
To solve this, in terminal, I navigated to tomcat-folder/bin and executed:
chmod 755 *.sh
And it solved my issue, cause it made the scripts executable.
Add a new Tomcat server is quite easy on NB. No "install" as a traditional sense needed to do that:
Download any compressed (not installers) tomcat version from http://tomcat.apache.org
Just unzip (uncompress) in your preferred folder. You dont need do any thing else.
Go to Tools ---> Servers -----> Add server.
Select Apache Tomcat Server. Then on "server location" label, select the folder where you have uncompressed your Tomcat Server. You can define in this window your log and password. NB will automatically change your user.xml.
This is a good way to configure as many servers as you want, and easily configure its access and management data.
I hope it helps.
Related
I know that this question has already been asked a couple of time but any answers helped me to fixed my own problem. Like I said I am working on OSX Mavericks and I would like to use tomcat with Eclipse JEE. Here is exactly what I did :
- I downloaded Eclipse JEE for mac.
- I downloaded Apache 7.0.47 on http://tomcat.apache.org/download-70.cgi
- I put my folder in /Library/apache-tomcat-7.0.47 and I created a symbolic link in this same folder that I named tomcat
- I tryied to configure it with Eclipse but when I start the server an error message occur :
"Port 8080 required by Tomcat v7.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s)."
Do you know which process is using the port 8080 on mac OS and how to kill it ?
I tried to start the server on another port by changing it in eclipse in port 8081. But still nothing appear on localhost:8081.
I tried to launch appache with the terminal by typing : "/Library/Tomcat/bin/startup.sh" and still nothing happened, my web browser just tell me : "no data received".
I hope I have been understable and hope somebody could give me an issue.
I've not tried this on Mavericks, but I have used Tomcat 7 with the previous two versions of Eclipse on Lion and Mountain Lion.
• Be sure you are using the correct edition, Eclipse IDE for Java EE Developers Eclipse IDE for Java EE Developers not "Eclipse Standard 4.3.1" or "Eclipse IDE for Java Developers" nor any others. In theory you should be able to add plugins in order to get the equivalent, but that has never worked for me nor for many other folks.
• After downloading Tomcat, run it through the BatChmod app, turning on the checkboxes to clear the filesystem meta-data. By default, file permissions will block Tomcat from running on a Mac (in my experience at least).
• Test Tomcat by itself. Drag the "startup.sh" into a Terminal window and press Return to launch. Later drag the "shutdown.sh" into the same window to stop. Point a web browser to this address to see Tomcat's welcome:http://localhost:8080/ (Tip: You can trash all the .bat files when running on a Mac.)
• No need for symlinks. You should not have to do anything to at all to Tomcat, except the BatChmod. The trick is to configure a new server within Eclipse. The goal is to make Eclipse aware of your Tomcat folder. I'm sorry I cannot remember exact steps at the moment. Doing the configuration is not as easy as it should be – nothing in Eclipse is as easy as it should be.
• You may need to start from scratch. Trash Eclipse and all of its config files, settings files, etc., both visible and invisible. Do some googling to discover their locations.
• Beware that you should not share the "workspace" folder between versions of Eclipse. Others have advised that major (annual) versions of Eclipse are not completely compatible with their settings, prefs, and such.
• There may be some issues with Java 7 on Mavericks -- you may want to check the Apple Java Developer mailing list.
If you have a choice, considering using other tools instead of Eclipse. Eclipse is arcane and fragile. My first choice would be IntelliJ, though you'll need the commercial (not free of cost) version to do web server work. I only used Eclipse because of its plugin for Vaadin. Another choice is NetBeans which is easier to setup with Tomcat than Eclipse (and now has a good plugin for Vaadin btw).
Tip: I put Tomcat at the root level of my current user's home folder, just to keep things simple.
I have just downloaded NetBeans 7.3 for JavaEE and installed it with Tomcat 7.0.41 Everything went fine and I can run NetBeans, start and stop Tomcat from within the IDE and add and remove servers at will.
However when I try and create a Java web Application project my server list is empty.
The message I get at the bottom of the wizard for creating projects is "No servers are registered in the IDE. To register a server, click the "Add..." button.
I have Googled and got nothing and looked at the NetBeans docs and got nothing, help me
I am running Netbeans 7.3, Java 1.7, Tomcat 7.0.41 and Windows xp-3.
This Problem is solved by just Restarted Netbeans Software
Thanks to all
I know the original problem was solved, but I had a very similar issue, and in my case simply restarting Netbeans did not help, so I wanted to help anyone with my issue. It sounds stupid, but I wanted to warn people that they need to be sure to download the right tomcat zip file.
Tomcat lists several zip files on their server, and I should have been using the Windows-64 zip file. Instead, I downloaded the first file, which just said "zip". I am not sure what configuration this was. It ran in windows 7, but created the same sort of mysterious pattern in Netbeans. In the Services tab, I could clearly see Apache Tomcat listed under Servers. If I started the service it worked fine. However, when I right clicked on my project and attempted to resolve missing server problem, it would not list tomcat in the list. The list is filtered to only show servers that are valid with the version of Java EE 6 or whatever you are using. In my case, apparently the original tomcat I downloaded was not valid.
You have to register the server inside Netbeans.
Simply a matter of going to the servers tab under tools & adding a new server & browsing to the installation location.
Follow the tutorial on the link below here (start at the time I have set):
Tutorial
Try this remove all server from the IDE and then double click the netbeans exe go to customize select the the tomcat server alone and then install
sample
Go to Tools -> Plugin -> Update Plugin.Worked for me, give it a try.
I have developed a java webservice application that I have been running on my dev-computer and in the meanwhile been setting up a dedicated ubuntu based linux server.
I have installed oracle-jre, mysql and apache tomcat 7 on this linux server and
after reading documentation I understand that I can either copy the deployed project archive (.WAR) or I can simply copy the project folder, into the servers /webapps/ folder from my development computer. Then restart tomcat7 and it should automatically run the webapp.
On my dev-computer with Eclipse IDE the webservice works properly as expected, but I cannot access the POST URL methods at all on the server
e.g. localhost:8080/Webservice/rest/account/login
(The installation on the server seems to be O.K as the Apache examples all work properly.)
I cannot see any logs in the /logs/ directory, in fact the folder is completely empty, so I cannot debug whats actually happening. Why aren't logs writing to the Catalina.out file?
Am I deploying this correctly as explained above?
Do I need to configure Eclipse or any project settings to reflect the change from the eclipse IDE / dev-computer to the server? E.g Is there any real difference?
A lot of questions there, but I wanted to clarify as much as possible,
Cheers,
Oliver
I fixed this issue by reinstalling tomcat.
I was starting on JAVA web development today and encountered some problems, I installed my tomcat7 on my ubuntu machine. Now when I browse to //localhost:8080, I get the default welcome page saying:
This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat7/webapps/ROOT/index.html
Tomcat7 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat7 and CATALINA_BASE in /var/lib/tomcat7, following the rules from /usr/share/doc/tomcat7-common/RUNNING.txt.gz.
But strangely when I try echo $CATALINA_HOME nothing shows up.
Also I can not copy/create anything in the default /var/lib/tomcat7/ROOT though it's just a matter of providing few permissions but I was wondering whether it is the right way to do it?,
What I would like to do is create a separate directory in my home where I can put my web application and tomcat can read hem from there. Is there a way to do it? In apache I can do it by changing the document-root and directory but I don't know how to do it for tomcat
But strangely when I try echo $CATALINA_HOME nothing shows up.
This is because the packaged version sets CATALINA_HOME just prior to launching Tomcat, after reading it from a configuration file (typically somewhere in /etc).
Also I can not copy/create anything in the default
/var/lib/tomcat7/ROOT though it's just a matter of providing few
permissions but I was wondering whether it is the right way to do it?
The permissions problem has to do with you not being root (or the Tomcat user). Most packaged Tomcat installations (deb or RPM) tend to install with a specific user in mind, and copying stuff in as a different sometimes won't work.
/usr/share/tomcat7 is your CATALINA_HOME directory, and it has links to the other directories, such as /var/lib/tomcat7/webapps, /etc/tomcat7, etc. You shouldn't copy directly into a web application, you should package the web application into a WAR file and "deploy" it. The advantages are numerous.
What I would like to do is create a separate directory in my home
where I can put my web application and tomcat can read hem from there.
Is there a way to do it?
Yes, one is created when "deploying a web app". Look to the standard Tomcat7 documentation, and consider installing the "manager" web application if you like a non-command line interface. Now that you know what "installation" of a web app is called, it will likely be an easier task.
In apache I can do it by changing the document-root and directory but
I don't know how to do it for tomcat
Tomcat has a different, slightly more restrictive set of requirements for a document-root. You need to learn it, and just come to terms with the idea that it's never going to be the same. Basically under the "webapps" directory, is a WAR file or a expanded directory that came from a WAR file. Editing in-place is not a good idea for Tomcat, as the CGI-equivalents are not read from disk each time they are ran, they are linked into the memory of Tomcat. This means that a change in the directory might not affect your web application, which is good enough reason to not bother changing the on-disk files for a deployed web application.
Modify the web application, repackage it, and update the deployment. It's really the "right" way to go with Tomcat.
Give permission 777 to the webroot folder
sudo chmod -R 777 Webroot
After moving to the tomcat folder
I am getting an error when I try to build my project in NetBeans. I am using JBoss 5.1.0 server and have attached that to my project. The error is -
The following error occurred while executing this line:
.../myPath/build-impl.xml:176: The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=<app_server_installation_directory>
I am using Mac OS X Lion.
I was missing a library. When I right clicked the project and went to libraries, it showed me library missing. I added the library and did a clean and build and the error disappeared
Clean builds did not help me, either. I took a look at project.properties and found that j2ee.server.home was not set anywhere, although j2ee.platform.classpath depends on it.
I do have Weblogic Server set up under /home (on a Linux machine).
So, I closed the project and added a line to project.properties:
j2ee.server.home=/home/blister/wls/wlserver
(where wlserver = the server name)
And reopened the project. Presto, the app now builds. It still doesn't know where the app server is, but at least I can built my jar and can worry about deploying it later. (I tell it to build a war which deploys nicely to Weblogic.)
If you are using netBeans Ide, then right click on the project. click properties. in the properties menu select Run. in that the first text box is server. There select the server. with which u want to run the project. If the server details are not configured before. configure server details and try. it wil help you to solve the above problem.
This worked for me.
Right click on the Project -> Properties -> Run
And Change the server Setting from the current server to another sever and click OK.
Wait for any background scanning to finish.
Repeat the processes 1 to 3 again this time selecting the actual server you want to run the code on.
Then try Re-Running your application.
I also had this error. However despite adding servers in the Run section of the Properties window, repeatedly no servers showed as being available to add to the Project ( again within the Run section ). The solution to being able to see a server in this server list was to run Netbeans as an admin ( which I saw Rotunba referencing in this thread..It was then possible to add a server and the project built successfully..
I solved it like this, I added in the ANT properties field
"j2ee.server.home=http://localhost/"
tolls>options>java>Ant
this in linux netbeans
It could also be as simple as not running your IDE i.e. netbeans as an administrator on your machine. I had the same problem. Wasted some time.