Spring application fails to load in STS 4.1

I have a spring web application which is running in Spring 5 (written in 3, later upgraded to 4 and 5 over the time). It was created in STS 2.x, later the workspace has been imported to STS 3.x without any problem. Though I have been using STS 4.1 for other SpringBoot projects, my old web application was still being developed in STS 3.x.

I imported the application to STS4.1 last week. The tomcat starts. But it does not load my application.

Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/9.0.13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Nov 2 2018 14:27:55 UTC
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 9.0.13.0
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.8.0_181\jre
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_181-b13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: H:\Dev\apache-tomcat-9.0.13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: H:\Dev\apache-tomcat-9.0.13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=H:\Dev\apache-tomcat-9.0.13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=H:\Dev\apache-tomcat-9.0.13
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=H:\Dev\apache-tomcat-9.0.13\wtpwebapps
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=H:\Dev\apache-tomcat-9.0.13\endorsed
Oct 19, 2019 6:48:23 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Oct 19, 2019 6:48:23 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library [1.2.18] using APR version [1.6.5].
Oct 19, 2019 6:48:23 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Oct 19, 2019 6:48:23 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
Oct 19, 2019 6:48:23 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized [OpenSSL 1.1.1 11 Sep 2018]
Oct 19, 2019 6:48:23 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Oct 19, 2019 6:48:24 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Oct 19, 2019 6:48:24 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Oct 19, 2019 6:48:24 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Oct 19, 2019 6:48:24 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1674 ms
Oct 19, 2019 6:48:24 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Oct 19, 2019 6:48:24 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.13
Oct 19, 2019 6:48:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\docs]
Oct 19, 2019 6:48:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\docs] has finished in [22] ms
Oct 19, 2019 6:48:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\examples]
Oct 19, 2019 6:48:25 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextInitialized()
Oct 19, 2019 6:48:25 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextInitialized()
Oct 19, 2019 6:48:25 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeAdded('StockTicker', 'async.Stockticker@302552ec')
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\examples] has finished in [534] ms
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\host-manager]
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\host-manager] has finished in [31] ms
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\manager]
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\manager] has finished in [32] ms
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\ROOT]
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory [H:\Dev\apache-tomcat-9.0.13\webapps\ROOT] has finished in [46] ms
Oct 19, 2019 6:48:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Oct 19, 2019 6:48:25 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Oct 19, 2019 6:48:25 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1299 ms

As you see in the above log, Spring context never loaded. When I tried to load the application URL, it was throwing HTTP Status 404 – Not Found error.

I had faced this kind of problem in earlier version of STS/Eclipse. It would be resolved either by tomcat server configuration or maven update or rebuilding or restart of eclipse. This was not resolved by either of these techniques and drove me crazy for two days.

I found one of the sites was showing the bug in STS 4.x which was fixed in 4.2. So, I want to try this as well. I tried to upgrade. Upgrade went well. But it didnt solve the problem. later I deleted the whole STS folder and used a fresh 4.4.0.RELEASE. Everything went smooth.. 😅😅

Nice picture, isn't it? I captured it at the Temple of tooth, Kandy (6 Jun 19)

Nice picture, isn’t it? I captured it at the Temple of tooth, Kandy (6 Jun 19)

Tomcat started in Eclipse. But application is not started

This is a strange problem after I migrated from old version of STS to STS4.


Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/9.0.13
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Nov 2 2018 14:27:55 UTC
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 9.0.13.0
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.8.0_181\jre
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_181-b13
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: D:\Pandian\Documents\workspace_crm\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: H:\Dev\apache-tomcat-9.0.13
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=D:\Pandian\Documents\workspace_crm\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=H:\Dev\apache-tomcat-9.0.13
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=D:\Pandian\Documents\workspace_crm\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=H:\Dev\apache-tomcat-9.0.13\endorsed
Sep 19, 2019 5:20:19 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Sep 19, 2019 5:20:19 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library [1.2.18] using APR version [1.6.5].
Sep 19, 2019 5:20:19 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Sep 19, 2019 5:20:19 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
Sep 19, 2019 5:20:19 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized [OpenSSL 1.1.1 11 Sep 2018]
Sep 19, 2019 5:20:19 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Sep 19, 2019 5:20:21 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Sep 19, 2019 5:20:21 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Sep 19, 2019 5:20:21 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Sep 19, 2019 5:20:21 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2281 ms
Sep 19, 2019 5:20:21 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Sep 19, 2019 5:20:21 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/9.0.13
Sep 19, 2019 5:20:22 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Sep 19, 2019 5:20:22 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Sep 19, 2019 5:20:22 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Sep 19, 2019 5:20:22 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1107 ms

  • Removed the server tomcat and added again
  • Removed few .props files from workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings.
  • changed the server locations in Server overview screen

Nothing helped except Maven Build.. Still Open. I’ll update if I have a solution later.

I captured this Green corridor at Royal Botanical Gardens, Peradeniya

I captured this Green corridor at Royal Botanical Gardens, Peradeniya

Eclipse tomcat does not start – May be locked by another process.

Happy Western New Year 2019!

I had a single spring web project. It became too big over the day. I had to split it up into multiple reusable projects so that I can build APIs. After I split it, Tomcat refused to start with the following error.


Publishing failed with multiple errors
Could not delete D:/Pandian/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/crm-upload/WEB-INF/lib. May be locked by another process.
Could not delete D:/Pandian/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/crm-upload/WEB-INF. May be locked by another process.

I tried to clean work folder, It doesn’t work. I did the following sequence to resolve this.

  1. Remove the tomcat server from eclipse server tab
  2. Restart Eclipse
  3. Add a new tomcat server
  4. Start the project

 

java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log

Lets build a new spring 3 app from maven.

See the maven version is 3.x

set path=c:\mavan\bin
mvn --version

See what are the archetypes are available

E:\workspace>mvn archetype:generate

Now, let’s generate the project

E:\workspace>mvn archetype:generate -DarchetypeGroupId=org.fluttercode.knappsack -DarchetypeArtifactId=spring-mvc-jpa-demo-archetype -DarchetypeVersion=1.1 -DgroupId=com.mycoompany.springapp -DartifactId=my-spring-app -Dversion=1.0-SNAPSHOT -DinteractiveMode=false

Now you can see a new folder my-spring-app is created

E:\workspace>cd my-spring-app

Convert the project as a Eclipse project and take a coffee break

E:\workspace\my-spring-app>mvn eclipse:eclipse

To instruct Eclipse about mvn, do the following. e:\workspace is my Eclipse workspace

E:\workspace\my-spring-app>mvn -Declipse.workspace=e:\workspace eclipse:add-maven-repo

Import my-spring-app to eclipse and publish to Weblogic.

weblogic-spring-eclipse-error

eclipse.buildId=4.3.0.I20130605-2000
java.version=1.7.0_15
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86

Error
Sat Nov 29 15:17:14 SGT 2014
weblogic.application.ModuleException: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)

Solve this by replacing the sl4j version to the one compatible with weblogic. For me it is 1.6.1

java.lang.NoSuchMethodError while starting tomcat 7 from Eclipse

My tomcat 7 server is starting and working fine by itself. When I stop it and try to start from Eclipse, it gives a NoSuchMethodError which aborts the server starting.

java.lang.NoSuchMethodError: org.eclipse.wst.server.core.model.ServerBehaviourDelegate.getTempDirectory(Z)Lorg/eclipse/core/runtime/IPath;

somebody is getting same error, but still not resolved. http://www.eclipse.org/forums/index.php?t=msg&goto=557431&S=432a9edd157438a3661ca16edfe4a4ab

I have raised a bug report to eclipse. Lets see.

>>>

I just got an update from Eclipse Bugzilla

Your Build Identifier indicates you are using Eclipse 3.5, which only works
with WTP 3.1.x.  WTP 3.2.x, which includes the new Tomcat 7.0 support, requires
Eclipse 3.6.x.  Running WTP 3.2.x with Eclipse 3.5.x is not supported.  You
will have to install Eclipse 3.6 since upgrading 3.5.x to 3.6 is not supported.
Once you have Eclipse 3.6 with WTP 3.2.x installed (using the Java EE package
is the easiest) you can create a new workspace and import your existing
projects, or you can simply open old workspace.  If you open the old workspace
with Eclipse 3.6 and WTP 3.2.x, using that workspace with Eclipse 3.5 and WTP
3.1.x is not supported.

Since Eclipse 3.5.x and WTP 3.2.x is not a supported combination, I’m marking
this bug as invalid.

Upgrade karega!

Target runtime Apache Tomcat v6.0 is not defined

I was upgrading the tomcat in my eclipse from version 6 to 7. Servers were added, old servers were removed. Tomcat 6 installed. But the server is not starting because of the following error.

Target runtime Apache Tomcat v6.0 is not defined.    <project name>        Unknown    Faceted Project Problem

It keeps my old server entry for the project.

We need to right click on the project, properties and Targeted Runtimes. Uncheck the old entry and enable the new entry. This should solve this error.

Targeted Runtimes

Targeted Runtimes

Still server is facing some other issue. Need to check up.

Integrating tomcat 6.0 and Eclipse europa

Till now I was using eclipse and tomcat separately, I was not that much serious about deployment, generally I goto the web application folder and edit/compile there itself. I know tomcat can be integrated with Eclipse, but I never tried. Today I have no other go. I need to do it. Here are the steps.

Register Tomcat with Eclipse

Select Window>Preferences

select the server you want to add, here we are adding tomcat 6.0 available under apache node

fill the necessary details

Here you can see the server is added to the list

You can see a new Project called Servers added to the Project explorer, If it is already there, the server might have been appended to the list

now open the corresponding web project to be deployed and start running it (ctrl + F11). Select Run on Server option

specify the server in which the application is to be deployed.

Move the projects to be deployed to the server. Here we have only one.

Thats it. done! see the web page is getting loaded!