Referencing Environment Variables in web.xml

You can use Ant-style variable substitution in any of the tomcat xml config files, such as: <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>${foo}</url-pattern> </servlet-mapping> Where foo is a Java System Property (sysprop). You can’t use OS Environment Variables (envvars) directly, I think… To use envvars, you can put set “CATALINA_OPTS=-DsomeJavaSysProp=%SOME_OS_ENVVAR%” in bin/setenv.bat (or similarly in bin/setenv.sh for *nix). You … Read more

Could not open ServletContext resource

Do not use classpath. This may cause problems with different ClassLoaders (container vs. application). WEB-INF is always the better choice. <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-config.xml</param-value> </context-param> and <bean id=”placeholderConfig” class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”> <property name=”location”> <value>/WEB-INF/social.properties</value> </property> </bean>

many url-pattern for the same servlet

I guess it has more to do with the servlet spec the container/netbeans is using rather than being an issue with the container. Your net beans seems to be using the spec 2.5 to construct the servlet mapping and hence you get <servlet-mapping> <servlet-name>fred</servlet-name> <url-pattern>*.jsp</url-pattern> <url-pattern>/url</url-pattern> </servlet-mapping> Read more about this here. It says Previous … Read more

The content of element type “…” must match in web.xml

One very simple solution which solves my problem. Change the schema reference from <!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “http://java.sun.com/dtd/web-app_2_3.dtd” > <web-app></web-app> to this <?xml version=”1.0″ encoding=”UTF-8″?> <web-app xmlns=”http://java.sun.com/xml/ns/javaee” version=”2.5″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”> // … // your all content goes here </web-app>

java.lang.IllegalArgumentException: Invalid in servlet mapping

<url-pattern>*NEXTEVENT*</url-pattern> The URL pattern is not valid. It can either end in an asterisk or start with one (to denote a file extension mapping). The url-pattern specification: A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for path mapping. A string beginning with a ‘*.’ prefix is used as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)