On 11/11/2019 8:23 AM, Mark Phillips wrote:
> I am running Apache NetBeans IDE 11.2 with Java: 1.8.0_201 on Debian (Linux
> version 5.0.0-32-generic running on amd64). I have a tomcat 7.09 server
> installed and running. I can deploy war files from the tomcat manager app
> and I can see the tomcat log files in the Netbeans app. However, I cannot
> find a way to associate the tomcat server with my Netbeans project. Tomcat
> shows up in the list of servers, and I can start and stop it from Netbeans
> Services tab.
> 
> The project says I am missing a server association, but when I click on
> Resolve Missing Server the resulting dialog does not have my tomcat 7
> server listed. I have tried removing my tomcat installation from Netbeans
> and adding it from the Resolve Missing Server dialog, but I still cannot
> deploy directly from Netbeans because, you guessed it, I have a Missing
> Server Problem! I have also restarted Netbeans to no avail.
> 
> I have fiddled with permissions for the tomcat7 installation to the point
> of chmod 755 for the whole directory (this is my development laptop and I
> only run instances locally), and that has not helped. Tomcat is installed
> in /var/lib/tomcat7. The user and group is tomcat7. Tomcat 7 should work
> with JDK 1.8, as it is certified for Java 6 and above.
> 
> I also have issues with installing two tomcat servers - still can't deploy
> not does the project recognize any of them. I installed tomcat 9 in
> /var/lib/tomcat9 with user and group tomcat9.
> 
> What I dream of is two tomcat instances, one tomcat 7 and the other tomcat
> 9, and the ability to deploy from Netbeans to test my project with both
> servers. How can I do that, or is that not possible? How do I get at least
> one server running so I can deploy from Netbeans?
> 
> Thanks!
> 
> Mark
> 

I'm using NetBeans 11.1, but it should be the same for 11.2.

Don't use the distribution's Tomcat. Instead, do the following:

1. Download the latest versions (I use 9, 8.5, and 7) from
tomcat.apache.org.

2. Create a top level directory for convenience in your home directory.
I use ~/Apache

3. Copy the .tar.gz files for the various Tomcats into that directory

4. Unpack the .tar.gz files

You should now have directories apache-tomcat-7.0.x,
apache-tomcat-8.5.x, and apache-tomcat-9.0.x.

5. In each apache-tomcat-x.y.z directory, you should find a conf folder

6. In the conf folder, you will find tomcat-users.xml

7. Edit tomcat-users.xml per instructions found in the comments of that
file.

You will want a manager-script role / user so that NetBeans can control
the server.

8. When you add the server to NetBeans, use the same user name and
password created in step 7.

The reason for doing all of this is quite simply, permissions. NetBeans
deploys WAR files to Tomcat by copying a context.xml file to
$CATALINA_BASE/conf/Catalina/localhost/app.xml.

The contents of that app.xml file contain the actual location of the web
application (it's not copied over to the Tomcat distribution), as well
as the context path served by Tomcat.

If you don't have write permissions to
$CATALINA_BASE/conf/Catalina/localhost, then the deploy / undeploy will
not work.

I normally only run one Tomcat instance at a time on my development
systems. However, if you want to run more than one Tomcat instance,
you'll have to edit $CATALINA_BASE/conf/server.xml and change at least
the shutdown port and HTTP/1.1 ports to be unique across all Tomcat
instances.

This setup is quite nice, in that I have full access to the Tomcat
installation with my user account. I can add jars to $CATALINA_BASE/lib
(for example, JDBC jars), and add environment settings to
$CATALINA_BASE/bin/setenv.sh.

Finally, if you get stuck on a Tomcat-related issue, you're more likely
to get help on the Tomcat mailing list if you've installed the latest
version of Tomcat from tomcat.apache.org rather than use a distribution
version. It's not that distribution versions are necessarily bad, it's
just that each distribution does things differently. Apache Tomcat from
tomcat.apache.org is set up the same way regardless of OS (OK - .sh
versus .bat files not withstanding).

. . . just my two cents
/mde/


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to