Monthly Archives: September 2016

Tomcat Server not starting with in 45 seconds

I had this issue while running the MVC application developed on Spring Tool Suite and it says “Server Tomcat v8.5.5 Server at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.

I tried increasing the timeout to 240 seconds and it did not help. If you do not know how to increase the timeout from the STS, follow this:

servers
Servers Tab

 

Double click the “Tomcat V8.5.5…” highlighted in the screenshot above and you should see the following screen:

timeout
Server properties

But changing the timeouts did not help. So what I had to do is to right click on the “Tomcat V8.5…” in the servers tab and Select “General” and click “Switch Location” on the general tab section so that it is pointing to server location as shown below:

general-tab
General settings

Then double click the servers again and now on the left hand-side of the window, select the radio button for the option “Use Tomcat installation (takes control of Tomcat installation) ” and this should help to fix the issue.

server-locations
Server Locations

The Apache Tomcat installation at this directory is version 8.5.5. A Tomcat 8.0 installation is expected.

When I was configuring Tomcat Server in SpringSource Tool Suite, I got the following error:

The Apache Tomcat installation at this directory is version 8.5.5. A Tomcat 8.0 installation is expected.

 

This is basically the problem with Tomcat it seems as per the forums and other resources. But you can fix the issue as the STS was looking for version 8.0 by editing the ServerInfo.properties in the jar file “\lib\catalina.jar” in the Tomcat installation server.

If you are using Bash like me here are the steps you need to make in order to fix the error:

$ cd lib
$ mkdir catalina
$ cd catalina/
$ unzip ../catalina.jar
$ vim org/apache/catalina/util/ServerInfo.properties
$ jar uf ../catalina.jar org/apache/catalina/util/ServerInfo.properties
$ cd..
$ rm -rf catalina

 

The serverInfo.properties file should be as below:

server.info=Apache Tomcat/8.0.0
server.number=8.5.5.0
server.built=Aug 31 2016 19:51:16 UTC

 

Note that it is just enough if you change “server.info” property and no need to change other information. They can stay as it is.

Now the issue should be fixed and you can continue with your work.

Note: If you are working on Windows, then you do not need to follow the above steps and you can use any archive tools like WinRar or Winzip and go to the location org/apache/catalina/util/ServerInfo.properties and make the change.

Hope this helps!!!

Resolve Error “Some selected protocols are invalid…”

Mule 3.8 supports only TLSv1.1 and TLSv1.2 by default due to vulnerability issues with TLSV1. So, by default only v1.1 and v1.2 TLS are enabled both at the Mule Runtime and the Anypoint Studio settings.

This scenario is applicable when you have a https requestor in your flow and configure it to enable the TLSv1, as the endpoint or service it is going to hit supports only TLSv1 and not the version 1.1 and 1.2.

To reproduce the error, I have intentionally added other properties in “TLS/SSL”. But in normal scenarios, you will be adding the properties for it to work.

tls-error
TLS Setting V1. Other properties are intentionally set blank.

Now when I run my application it gives the error saying “some selected protocols are invalid…..”.

Error:

org.mule.api.lifecycle.InitialisationException: Some selected protocols are invalid. Valid protocols according to your TLS configuration file are: TLS
v1.1, TLSv1.2
	at org.mule.transport.ssl.DefaultTlsContextFactory.globalConfigNotHonored(DefaultTlsContextFactory.java:106) ~[mule-transport-ssl-3.8.0.jar:3.8.0]
	at org.mule.transport.ssl.DefaultTlsContextFactory.initialise(DefaultTlsContextFactory.java:80) ~[mule-transport-ssl-3.8.0.jar:3.8.0]
	at org.mule.api.lifecycle.LifecycleUtils.initialiseIfNeeded(LifecycleUtils.java:57) ~[mule-core-3.8.0.jar:3.8.0]
	at org.mule.api.lifecycle.LifecycleUtils.initialiseIfNeeded(LifecycleUtils.java:35) ~[mule-core-3.8.0.jar:3.8.0]
	at org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient.configureTlsContext(GrizzlyHttpClient.java:120) ~[mule-module-http-3.8.0.jar:3.8.0
]
	at org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient.initialise(GrizzlyHttpClient.java:105) ~[mule-module-http-3.8.0.jar:3.8.0]
	at org.mule.module.http.internal.request.DefaultHttpRequesterConfig.initialise(DefaultHttpRequesterConfig.java:124) ~[mule-module-http-3.8.0.jar:3.8.
0]

 

The fix is to go and enable the TLSv1 in your Anypoint Studio settings. You can follow the steps here for enabling/disabling TLS settings for Anypoint Studio. If this occurs in your runtime after deploying the application, then follow the same steps by navigating to the runtime folder and browse the “conf” folder and open “tls-default.conf” and edit the values for enabledProtocols.

“enabledProtocols=TLSv1.1,TLSv1.2”

Enabling/Disabling TLS settings in MuleSoft’s Anypoint Studio

You all must be knowing that Mule ESB 3.8 by default supports only TLSV1.1 and TLSV1.2. Some applications need to post to endpoints that are based on TLSV1.0 and in order for it to work in local while developing your application, you might have to enable TLSV1.0 in Anypoint Studio.

Follow the steps to enable TLSV1.0 so that your applications running through Anypoint Studio will not complain any errors:

  1. Go to the AnyPoint Installation folder.
  2. Navigate to “Plugins” directory if you are using Windows.
  3. If you are using Mac, then navigate to Applications –> Anypoint Studio –>Contents –> Eclipse–>plugins.
  4. Now search for folder “org.mule.tooling.server.3.8.x.ee_6.1.x.yyy.mm.dd” and then navigate to directory “mule” and then to “conf” folder.
  5. Now you should find a files with name “tls-default.conf” and “tls-fips140-2.conf”.
  6. Edit each of the file by opening it and search for “enabledProtocols”.
  7. You should see “enabledProtocols=TLSv1.1,TLSv1.2”.
  8. Now add TLSv1 to the enabledProtocols.
  9. It should look like “enabledProtocols=TLSv1,TLSv1.1,TLSv1.2”.

Now restart your Anypoint Studio just to make sure that it picks up the new settings and your apps now should be supporting TLS1.0 with settings.

Similarly if you need to disable TLSv1.0 as it is not accepted by PCi compliance, remove it from the enabledProtocols.

Note: This feature of editing the TLS values is available since Studio 5.4.3 as per the MuleSoft website. I hope this helps!!!

Shortcut for organizing Imports in Spring STS

Whenever you are writing OOP, basic thing you will do is to create many types and create instances of the types in other classes. And unless we import the types in the code, you will see unresolved references error. Instead of resolving each unresolved references, you can press CTRL+SHIFT+O that is a short cut for organize imports in Spring STS or any eclipse based tool. If you are working on Mac like me then the shortcut is COMMAND+SHIFT+O.