Skip to content

Instantly share code, notes, and snippets.

Here is the workaround that worked for me:
1. Close Eclipse
2. In {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings. delete the following two files:
+) org.eclipse.wst.server.core.prefs
+) org.eclipse.jst.server.tomcat.core.prefs
3. Restart Eclipse
How To Uninstall tomcat7 On Ubuntu 15.04
To uninstall tomcat7 just follow these instructions.
Are you having problems? You can always add tomcat7again by following the instructions at this link.
Uninstall just tomcat7
`sudo apt-get remove tomcat7`
This will remove just the tomcat7 package itself.
Uninstall tomcat7 and it's dependencies
Note: I am using Ubuntu Linux.
– Close Eclipse
– Go to your Eclipse workspace directory
– Then go to directory .metadata/.plugins/org.eclipse.core.runtime/.settings
– In Ubuntu, I do it by: cd ~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings
– Delete the following two files:
– org.eclipse.wst.server.core.prefs
– org.eclipse.jst.server.tomcat.core.prefs
– You can do it by the following command:
@ToanPV90
ToanPV90 / requestdispatcher vs sendredirect.txt
Last active August 8, 2016 14:29
Difference about requestdistpatcher and sendredirect
First of all, the term "redirect" is in web development world the action of sending the client an empty HTTP response with just a Location header with therein the new URL on which the client has to send a brand new GET request. So basically:
Client sends a HTTP request to some.jsp.
Server sends a HTTP response back with Location: other.jsp header
Client sends a HTTP request to other.jsp (this get reflected in browser address bar!)
Server sends a HTTP response back with content of other.jsp.
You can track it with the webbrowser's builtin/addon developer toolset. Press F12 in Chrome/IE9/Firebug and check the "Network" section to see it.
@ToanPV90
ToanPV90 / gist:75a8b0b11d0329a6e418eaf5ce4379f8
Created August 8, 2016 09:52
Maven error “Failure to transfer…”
Info:
Description Resource Path Location Type Could not calculate build plan: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.0.2 from/to central (http://repo1.maven.org/maven2): No response received after 60000 ExampleProject Unknown Maven Problem
---------------------------------------------------Answer---------------------------------------------------
Remove all your failed downloads:
For *nix
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
@ToanPV90
ToanPV90 / user.sh
Created August 21, 2016 03:20
Add and Del user Ubuntu
To list all local users you can use:
cut -d: -f1 /etc/passwd
To list all users capable of authenticating (in some way), including non-local, see this reply: http://askubuntu.com/a/414561/571941
Some more useful user-management commands (also limited to local users):
To add a new user you can use:
@ToanPV90
ToanPV90 / missing 2 entries path maven project
Created August 22, 2016 15:35
missing 2 entries path maven project
I have solved this issue by below steps:
Right click the Maven Project -> Build Path -> Configure Build Path
In Order and Export tab, you can see the message like '2 build path entries are missing'
Now select 'JRE System Library' and 'Maven Dependencies' checkbox
Click OK
Now you can see below in all type of Explorers (Package or Project or Navigator)
src/main/java
http://docs.oracle.com/cd/E13222_01/wls/docs92/webapp/basics.html
http://docs.roguewave.com/hydraexpress/3.5.0/html/rwsfservletug/4-7.html
http://javabeat.net/spring-mvc-application-context/
http://www.programcreek.com/
https://netbeans.org/kb/docs/javaee/ecommerce/intro.html#about
https://docs.jboss.org/author/display/JBWS/Web+Services+Introduction
http://www.javatips.net/
http://www.sanfoundry.com/
@ToanPV90
ToanPV90 / Difference in servlet mapping url pattern
Created August 30, 2016 10:11
Difference between / and /* in servlet mapping url pattern
<url-pattern>/*</url-pattern>
The /* on a servlet overrides all other servlets, including all servlets provided by the servletcontainer such as the default servlet and the JSP servlet. Whatever request you fire, it will end up in that servlet. This is thus a bad URL pattern for servlets. Usually, you'd like to use /* on a Filter only. It is able to let the request continue to any of the servlets listening on a more specific URL pattern by calling FilterChain#doFilter().
<url-pattern>/</url-pattern>
The / doesn't override any other servlet. It only replaces the servletcontainer's builtin default servlet for all requests which doesn't match any other registered servlet. This is normally only invoked on static resources (CSS/JS/image/etc) and directory listings. The servletcontainer's builtin default servlet is also capable of dealing with HTTP cache requests, media (audio/video) streaming and file download resumes. Usually, you don't want to override the default servlet as you would otherwise have to take ca
@ToanPV90
ToanPV90 / How do servlets work? Instantiation, sessions, shared variables and multithreading
Last active March 23, 2017 15:42
How do servlets work? Instantiation, sessions, shared variables and multithreading
ServletContext
When the servletcontainer (like Apache Tomcat) starts up, it will deploy and load all webapplications. When a webapplication get loaded, the servletcontainer will create the ServletContext once and keep in server's memory. The webapp's web.xml will be parsed and every <servlet>, <filter> and <listener> found in web.xml, or annotated with respectively @WebServlet, @WebFilter and @WebListener, will be created once and kept in server's memory as well. For all filters, the init() method will also be invoked immediately. When the servletcontainer shuts down, it will unload all webapplications, invoke the destroy() of all initialized servlets and filters, and finally the ServletContext and all Servlet, Filter and Listener instances will be trashed.
When the Servlet in question has a <servlet><load-on-startup> or @WebServlet(loadOnStartup) value greater than 0, then its init() method will also immediately be invoked during startup. Those servlets are initialized in the same order as "load-on-startup