Archive for Spring

Error configuring application listener of class Log4jConfigListener

SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener

In most cases, the described problem is caused by an error inside the application contex file (the applicationContext.xml file, or xxx-servlet.xml.) For instance, a bean definition contains a property that does not map to a setter on the actual class, a “property-placeholder” points to a location that is not found, or, the XML itself is invalid, etc. Unless you configure Tomcat logging to output Spring log statements, you won’t see the details.

For the error

SEVERE: Error listenerStart

Just need put the following into web.xml

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>[what you have in display-name or something unique to your web app]</param-value>
</context-param>

Advertisements

Leave a Comment

Basic Spring Project Setup Template

Download(new)
Download

Modules:

  • user signup/login/edit module
  • session management module
  • security interceptor module
  • global code list
  • user management module including user list, delete,active/inactive…
  • code type/code management module including list, delete, reorder…

How to use it

assume local folder is “c:\WYX\tmp”

  1. Extract zip file to your local “c:\WYX\tmp” and change the folder name from “yaan” to “myfirstproject”.
  2. New project in IDE, e.g. IntelliJ IDEA:
    project name:      “myfirstproject”,
    project location: c:\WYX\tmp\myfirstproject,
    Create module:    checked
    module name:     java
    module content root:   c:\WYX\tmp\myfirstproject\src\java
    module filelocation:     c:\WYX\tmp\myfirstproject\
  3. new module
    module name:     web
    module content root:   c:\WYX\tmp\myfirstproject\src\web
    module filelocation: c:\WYX\tmp\myfirstproject\
    next:   Do not create source directory
  4. In “Project Structure”, create “myfirstproject_lib” from lib folder
  5. Global replace “greenbestow” to “myfirstproject”, “GreenBestow” to “Myfirstproject”
  6. Change package name “greenBestow” to “myfirstproject”
  7. Change jdbc.properties
  8. In build.xml cahnge home, libhome, war_file
  9. Change greenBestow-servlet.xml to myfirstproject-servlet.xml
  10. change BaseJdbcService.java:
    public class BaseJdbcService extends NamedParameterJdbcDaoSupport {
    }
  11. for insert query, using:
    SqlParameterSource fileParameters = new BeanPropertySqlParameterSource(tag);
    KeyHolder keyHolder = new GeneratedKeyHolder();
    int row = getNamedParameterJdbcTemplate().update(q, fileParameters, keyHolder);
    if (row>0) {
    tag.setId(keyHolder.getKey().intValue());
    }
  12. add the following into web.xml
    <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>[what you have in display-name or something unique to your web app]</param-value>
    </context-param>

Download(new)
Download

Leave a Comment