Rectangle 27 6

Apache Tomcat is a webserver and Java servlet container in one, while Apache HTTPD is just a plain webserver (often with only PHP support). They use Apache Tomcat when they want be able to run Java/JSP/Servlet. It can be added to an existing Apache HTTPD / PHP setup. Or the other way round, they bring Apache HTTPD in front of Apache Tomcat to be able to have a "This site is in maintenance" page when Tomcat is been shutdown for some upgrade/maintenance.

For communication between Apache HTTPD and Apache Tomcat, the Tomcat Connector is usually been used. It's also known as mod_jk.

Are there any security issues if you JUST run Apache?

Apache is the name of a software foundation. Do you mean Apache HTTPD or Apache Tomcat? Regardless, I don't see any security issues when running them together, let alone separately. What's the rationale behind this question anyway? Are you new to Java/JSP/Servlet or something?

Well, I am not new. When I was part of a Java shop, this stuff was handled by someone else and I really never got that kind of stuff answered. Now that I am doing a php site I am simply wondering what I am missing since I just run Apache HTTPD :)

You'll only miss the ability to run Java code behind a website served by JSP/Servlet.

When to Use Apache vs. Apache+Tomcat? - Stack Overflow

apache tomcat webserver
Rectangle 27 6

Though its too late from the date of posting the question, thought this might be useful for others who have a similar question. Jersey comes with a test framework called the Jersey Test Framework which allows you to test your RESTful Web Service, including the response status codes. You can use it to run your tests on lightweight containers like Grizzly, HTTPServer and/or EmbeddedGlassFish. Also, the framework could be used to run your tests on a regular web container like GlassFish or Tomcat.

Do you have a good example on how to mock call handlers ?JerseyHttpCall -> MyResource -> CallHandler.getSomething() How can we mock CallHandler here ?

java - Unit testing a JAX-RS Web Service? - Stack Overflow

java web-services unit-testing junit jax-rs
Rectangle 27 376

You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script. If in vain, close Eclipse and then open the task manager and kill all java and/or javaw processes.

Or if you actually installed it as a Windows service for some reason (this is namely intented for production and is unhelpful when you're just developing), open the services manager (Start > Run > services.msc) and stop the Tomcat service. If necessary, uninstall the Windows service altogether. For development, just the ZIP file is sufficient.

Or if your actual intent is to run two instances of Tomcat simultaneously, then you have to configure the second instance to listen on different ports. Consult the Tomcat documentation for more detail.

perfect, this has been plaguing me forever. I executed it as sh shutdown.sh in terminal within the /bin directory.

Hello BalusC, I like you ! There is no shutdown.bat in my bin folder. Tomcat was installed as a service and not as a zip. Stopping tomcat service in services fixed the problem. Thanks. Chenqui.

@Borat: You're welcome. Keep in mind that you'd really better uninstall the service and get the zip instead.

Opening the system monitor or task manager and killing a java process which is using about 400 MB or more RAM will also solve the problem. It is unknowingly reserving the process.

java - Several ports (8005, 8080, 8009) required by Tomcat Server at l...

java eclipse tomcat
Rectangle 27 376

You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script. If in vain, close Eclipse and then open the task manager and kill all java and/or javaw processes.

Or if you actually installed it as a Windows service for some reason (this is namely intented for production and is unhelpful when you're just developing), open the services manager (Start > Run > services.msc) and stop the Tomcat service. If necessary, uninstall the Windows service altogether. For development, just the ZIP file is sufficient.

Or if your actual intent is to run two instances of Tomcat simultaneously, then you have to configure the second instance to listen on different ports. Consult the Tomcat documentation for more detail.

perfect, this has been plaguing me forever. I executed it as sh shutdown.sh in terminal within the /bin directory.

Hello BalusC, I like you ! There is no shutdown.bat in my bin folder. Tomcat was installed as a service and not as a zip. Stopping tomcat service in services fixed the problem. Thanks. Chenqui.

@Borat: You're welcome. Keep in mind that you'd really better uninstall the service and get the zip instead.

Opening the system monitor or task manager and killing a java process which is using about 400 MB or more RAM will also solve the problem. It is unknowingly reserving the process.

java - Several ports (8005, 8080, 8009) required by Tomcat Server at l...

java eclipse tomcat
Rectangle 27 6

First of all, Servlets is the very basics of Java for Web development. So, whatever web development you are doing, like Web Services, you'll need a Servlet Container, as Tomcat.

So the answer to your question is "you cant run it's only on Apache HTTP Server", because it's not a Servlet Container.

How can I run a Java app on Apache 2.2 without Tomcat? - Stack Overflo...

java apache tomcat
Rectangle 27 2

There was change in the way logging is implemented in Solr version 4.3 and higher. Please follow the directions outlined in Solr Logging - Using the example logging setup in containers other than Jetty for steps on how to setup logging to work properly with Tomcat.

java - unable to run solr on tomcat in linux(404 not found /solr) - St...

java apache tomcat solr
Rectangle 27 5

Tomcat as the client has to be considered as a client which does not run in the same application server container. So you have to package all relevant classes/interfaces into the .war file which is deployed on Tomcat.

Looking at the stack trace: The JBoss server does respond, it's the JBoss client who reports that a class is missing:

The actual error (missing class) is packaged in a NamingException.

So you have to put the relevant classes into the .war file for Tomcat: It's probably your remote interface recc.business.login.LoginBeanRemote.

I always have EJB classes (implementation) and their interfaces in two separate packages, and the EJB client gets a .jar file which just contains the interfaces (and possibly exceptions). So a .jar consisting of interfaces and possibly exceptions gets packaged into the .war for the client.

Generally speaking these items have to be checked, if a stand-alone client fails to work

jboss-client.jar
  • Are the remote interfaces in the class path?
  • Are the properties for the InitialContext complete?
  • Is the JNDI name correct? And is that JNDI name really visible from the client?
InitialContext
final Properties initialContextProperties = new Properties();

    initialContextProperties.put(Context.INITIAL_CONTEXT_FACTORY,
            "org.jboss.naming.remote.client.InitialContextFactory");

    initialContextProperties.put(Context.PROVIDER_URL,
            "remote://localhost:4447");

    initialContextProperties.put(Context.URL_PKG_PREFIXES,
            "org.jboss.ejb.client.naming");

    // See .../jboss-7/standalone/configuration/application-users.properties
    initialContextProperties.put(Context.SECURITY_PRINCIPAL, "user");
    initialContextProperties.put(Context.SECURITY_CREDENTIALS, "password");
jndi.properties
jboss-ejb-client.properties

Great answer, thank you. I forgot to add the jar file to my classpath and I put the LoginBeanRemote in a package with a different name than the ejb-project. Unfortunately I still can't run the ejb. Can you take a look on my updated question?

I am not sure if your JNDI name builder is correct (distinctName is empty, so there is a "//" somewhere, and if the "ejb:" scop is visible for a remote client. Please have a look at JNDI Lookup on JBoss AS 6.0. This is applicable as well to JBoss 7, so try "java:global/...", because this scope is globally visible. And double check that the JNDI name you use turns up in the JBoss admin console as well. Please add the method of the EJB you are calling.

The "//" works on my console client and is also mentioned in official jboss documentation. I tried "java:global/.." It's causing an error, that "java:global" is not bound to the context, do you have any Idea what's missing? BTW: I have no EAR file in my deployment folder, I just deploy the .jar file

Is jboss-ejb-client.properties really in the class path of the .jar for Tomcat?

Have a look at JBoss AS7 JNDI ref. Instead of "Remote JNDI using ejb:" try "Remote JNDI using remote:". This explains as well the problems you have had and you are having now.

JNDI lookup fails when connecting from Tomcat to an EJB in JBoss 7.1.1...

tomcat jboss ejb jndi lookup
Rectangle 27 3

You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script.

java - Tomcat Server Error - Port 8080 already in use - Stack Overflow

java tomcat
Rectangle 27 3

You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script.

java - Tomcat Server Error - Port 8080 already in use - Stack Overflow

java tomcat
Rectangle 27 1

The most common issue with the setup you have described, without more context, is that you are most likely using absolute URLs to point at your js / css files. As such when you put them into the servlet container under /my-app they no longer reference properly as they are trying to go to the root /. You need to use relative URLs when describing the location of the resource files on the path.

Hi, Shawn. I have updated the answer. The index.html file contains relative URLs that point to the resources. All the HTML/CSS/JS are in the src/main/resources/public folder and at the same level as the index.html file.

angularjs - Deploying Spring Boot WAR to Tomcat 8 - HTTP 404 when acce...

angularjs spring spring-mvc tomcat spring-boot
Rectangle 27 3

JAX-RS is strongly linked to HTTP, hence most implementations (eg Jersey, Apache CXF) run in a servlet, which in turn runs in a container such as Tomcat or Jetty. I guess you could develop your own standalone JAX-RS implementation, but you'd end up reinventing the wheel as you'd be forced to implement most aspects of a web server.

Your worries about clustering also seem unfounded. Clustering Tomcat is simple, it is a very common thing to do and there's plenty of information available on the subject. It seems like clustering a custom implementation would actually be a much harder job.

In addition, the REST interfaces should be stateless. So clustering should not be a problem at all.

Jersey can also run with the JDK mini webserver.

tomcat - Containerless deployment of JAX-RS Restful Service In Java - ...

java tomcat deployment jetty jax-rs
Rectangle 27 12

Ok, servlets are smalish applications that are designed to run inside of a container. They provide an extension point for you to insert your java code into either a simple servlet container like tomcat, or a more fully featured application server like glassfish. You want to do this because the application server does the heavy lifting of dealing with the http interaction and provides other features like security, logging, session management, error handling, and more (see the servlet specification).

When you make your application live within an application conatiner (web server with all those other extra features), you can also manage the lifecycle of your application better. You'll be able to start and stop the application without shutting down the web server, redeploy, start more instances, etc. Plus, when you come up with that great second application, its easy to drop it in right next to the first one. Or, you can cluster several machines together for easy redundancy and load balancing, features of the application server.

This is just a start, there are many more features, technologies, and frameworks out there to help you make container based applications. Servlet tutorial.

php - Running Java on a Web Server - Stack Overflow

java php web-applications servlets
Rectangle 27 1

You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn't, then you would have gotten a browser specific HTTP connection timeout error message.

You need to shutdown it. Go to /bin subfolder of the Tomcat installation folder and execute the shutdown.bat (Windows) or shutdown.sh (Unix) script.

eclipse - Error With Port 8080 already in use - Stack Overflow

eclipse tomcat6 ubuntu-9.10
Rectangle 27 1

If you deploy your application in a Tomcat, then you have to create a class which extends SpringBootServletInitializer to boot up the Spring container. Your Application class with the main method is only called when you run the JAR/WAR with java -jar yourfile.jar with the embedded Tomcat (which is included by default with Spring Boot Starter Web).

You are a lifesaver. Once I extended the class mentioned in the docs, it worked and displayed the Spring bootup information in the log.

java - IntelliJ Spring Gradle Project Annotations Not Working - Stack ...

java spring spring-mvc intellij-idea gradle
Rectangle 27 0

Do you have the right server connectors installed? Open the "Servers" view by clicking: Window -> Show View -> Servers (or maybe -> others... -> Servers). If your server (with the correct version) is not listed: click right mouse in Servers view -> New -> Server -> choose the right connector and install it. Then drag your project to the newly created server or choose "Add and remove" by right clicking the servers name.

tomcat - Eclipse: cannot run a servlet like on Netbean: HTTP Status 40...

eclipse tomcat servlets netbeans http-status-code-404
Rectangle 27 0

I am The author of this question, and I solved it. I will provide the solution so that others can get help from it.

As I followed this installation steps carefully, then the installation is correct.

The only problem that caused the error is in the web.xml: - When create a new "Dynamic Web Project" (As my case) - Take care of this file: WebContent -> WEB-INF -> web.xml - The <welcome-file> </welcome-file> tags must refer to exist files to display in the browser. - If there are some default tags delete them. - when you create for example a new HTML file named index.html, then make sure that the web.xml file refers to it. <welcome-file>index.html</welcome-file>

Digression (irrelevant to the solution above) I am actually working on NetBeans extensively doing simple Java Standard Edition projects. I rarely encountered problems with NetBeans, and when they occur I can solve them easily either myself or by searching for information about the problem.

When I began learning the Java Entrprise Edition, and see tutorial on NetBeans, I started my first project from the first day.

But I found most of the tutorials use Eclipse and that was the reason why I installed it.

When I moved to Eclipse. I encountered many problems, and each problem take many hours to search and solve. that takes three days before starting one project.

I am wondering why people prefer Eclipse over NetBeans. I think there is some reason. (^_^)

eclipse - Apache tomcat 7 No error with localhost page, But when run p...

eclipse tomcat localhost http-status-code-404
Rectangle 27 0

I met almost the same problem, I use embedded tomcat to deploy a web application. I put a file "aaa.html" into the welcome-file-list. But when I run the tomcat and access the webapp by url "http://localhost:8080/appname/", tomcat will tried to return back the index.jsp (which also exists in my application) instead of aaa.html. In order to show my specified welcome page aaa.html, I have to add another index.html and let index.html redirects to aaa.html, like below:

<welcome-file-list>
    <welcome-file>index.html</welcome-file>   <-- added for tomcat 7
    <welcome-file>aaa.html</welcome-file>
</welcome-file-list>

java - Why does Tomcat 7 append index.html to URLs when Tomcat 6 does ...

java tomcat spring-mvc tomcat7
Rectangle 27 0

You've another instance of Server already running. You can confirm this by going to http://localhost:8080 in your webbrowser and check if you get the specific 404 error page and Tomcat default home page. Both are equally valid evidence that Tomcat runs fine.

Open the task manager and kill all java and/or javaw processes. Now open your project and run your application. Open Window -> Preferences -> Server

If Tomcat is not installed go through these steps otherwise skip step

  • Select the Tomcat Root folder which has bin folder and click Next.
  • There are no resources to be configured and hence click Finish.
  • The configured Apache Tomcat Server will be displayed in the Servers view.
  • In "Server" area, right click -> Add and Remove...
  • Under this, the project need to be configured add the project from "Available:" box to "Configured:"
  • Click finish to run the server.

java - Tomcat v7.0 Server setup for ports 8086 and 8009 - Stack Overfl...

java eclipse installation port tomcat7
Rectangle 27 0

Errr no. Apache tomcat is a server which acts as a container for Java-based 'servlets'. Apache http server is a general server for http requests. What you have listening on port 8080 must be tomcat since you get the tomcat error page.

rApache is specifically a handler for the apache http server. Normally apache http server just sends back a file when a request for /foo.html comes in, but it can be configured to run a program via a handler, which is what rApache is.

You can run apache http server AND tomcat on the same machine, they just have to be listening on different ports. If you try and run them on the same port the second one won't start.

By default apache http server listens on port 80, so if you are running it as root then going to http://localhost/ will get a response if it is running.

There's another nginx server installed on the same machine. So if I go to localhost it's getting directed to nginx server. How can I change the port of apache2 in my case. I'll even try to googling it.

r - Is it possible to install rApache on tomcat 6.0? - Stack Overflow

r tomcat apache2 rapache
Rectangle 27 0

Ok, servlets are smalish applications that are designed to run inside of a container. They provide an extension point for you to insert your java code into either a simple servlet container like tomcat, or a more fully featured application server like glassfish. You want to do this because the application server does the heavy lifting of dealing with the http interaction and provides other features like security, logging, session management, error handling, and more (see the servlet specification).

When you make your application live within an application conatiner (web server with all those other extra features), you can also manage the lifecycle of your application better. You'll be able to start and stop the application without shutting down the web server, redeploy, start more instances, etc. Plus, when you come up with that great second application, its easy to drop it in right next to the first one. Or, you can cluster several machines together for easy redundancy and load balancing, features of the application server.

This is just a start, there are many more features, technologies, and frameworks out there to help you make container based applications. Servlet tutorial.

php - Running Java on a Web Server - Stack Overflow

java php web-applications servlets