Archive for IntelliJ IDEA

Remote Debugging on WebLogic Server

  1. in /bin/startWebLogic.cmd add:
    set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=7002,server=y,suspend=n
  2.  In IDEA – Edit Run Configuration:
    Add – Remote – localhost, 7002
  3. Start Server
  4. In IDEA click Debug button (Shift + F9)
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

Remote debug setting

set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n

in IntelliJ IDEA:

  1. add new Configurations – Remote
  2. change the port to 8001

Leave a Comment

IntelliJ IDEA debug vs Ant Build

When running code under the debugger, local variables were not available while stepping through a method. Instance variables (under “this”) were available.

Solution: Add debug=”true” in ant build script javac tag

Comments (2)