1

We have two web applications developed using Spring and Hibernate. We have deployed these two applications on Tomcat 7. Sometimes these applications are running fine if we don't access both applications. Sometimes it is giving some exceptions if the both the applications are accessed at the same time.

Ex: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser.

Whichever the application we have accessed first works fine but second one doesn't work.

We are sure that we can run n number of applications on server.

8
  • If there are multiple webapps, then each will have their own context-path. Under that situation, there should be no problem. So you have on webapp, which is ROOT.war in your webapps, other webapp if stackoverflow.war, then context-path is domain-name/stackoverflow/remainingurl. Commented Nov 9, 2015 at 10:27
  • I did not do any configuration in server.xml or any xml file in server. Should I ? Commented Nov 9, 2015 at 10:34
  • I am getting this exception Now also. HTTP Status 500 - org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found . . .Please help Commented Nov 9, 2015 at 10:36
  • This error is unrelated to tomcat not running something on same port. This is 500, so the mistake of the developer programming server-side webapp. Commented Nov 9, 2015 at 10:37
  • 2
    You have a classpath problem, one of your applications is setting the system wide property javax.xml.parsers.SAXParserFactory but this dependency is available on the classpath of only one of your applications. Please set this property explicitly in all of your applicatications whenever you need an xml parser or just put this dependecy in a place where tomcat can put it in the classpath it makes avallable to all web apps. Commented Nov 9, 2015 at 13:27

2 Answers 2

1

Answering your actual question,

Is it possible to run multiple web application on the same port in tomcat 7?

Yes, it is. Tomcat can run multiple web applications on a single port. The default Tomcat port number is 8080.

java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser

Something else is causing this error.

Sign up to request clarification or add additional context in comments.

1 Comment

This error is because I did not include xml parse apis in build path. Now I included. Running fine. Thank you.
0

Multiple web applications running on the tomcat, on the same port will not create problem unless and until each others context-path is overridden.

From the exception it is clear that one of the web-application is not correctly configured to access the required jar. You can copy the required jars to Tomcat/libs, e.g on windows the path is "C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\lib".

Jars in $Tomcat/lib directory are visible to all the deployed web-apps. Reference: Difference between keeping jar files in WAR and Tomcat lib folder

Feel free to comment out for further help.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.