Wednesday, June 24, 2015

IOException parsing XML document from class path resource

I have a Test File in the package com.springt.test and trying to execute this java test file I am getting this below exception.

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource "<path of application context.xml>"

The solution i got it from google search that applicationContext.xml file should be under the src directory instead of any other directory/package. So I  moved applicationContect.xml under src directory and got resolved.

Friday, June 5, 2015

Sample build.xml to create war file based on eclipse directory structure

Yesterday I got a chance to write sample build.xml for one of my colleague. He has default build.xml for his project which is written by someone based on random directories (similar to war directory structure). This build.xml is used to pack the directory sturctures and place it into the tomcat server webapp directory. In this type scenario he did not able to debugging his application from eclipse.

I suggested them to create one more build.xml based on eclipse directory structure for production or uat deployment. For development purpose try to setup a tomcat server and debugging your application in eclipse without worrying about deployment. I provided that sample build.xml below. Please look it and provide your comments.

<?xml version="1.0" encoding="UTF-8"?>
<project name = "tems" basedir = "." default = "war">
   
    <property name="project-name" value="${ant.project.name}" />
    <property name="builder" value="Achappan Mahalingam" />

    <property name="war-file-name" value="${project-name}.war" />
    <property name="source-directory" value="src" />
    <property name="classes-directory" value="build/classes" />
    <property name="web-directory" value="WebContent" />
    <property name="web-xml-file" value="WebContent/WEB-INF/web.xml" />
    <property name="libs-directory" value="WebContent/WEB-INF/lib" />
    <property name="build-directory" value="build" />


    <target name = "info">
          <echo message = ""/>
          <echo message = "${project-name} Build File"/>
          <echo message = "-----------------------------------"/>
          <echo message = "Run by ${builder}"/>
       </target>

    <target name="war" depends="info">
        <mkdir dir="${build-directory}" />
        <delete file="${build-directory}/${war-file-name}" />
        <war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
            <classes dir="${classes-directory}" />
            <fileset dir="${web-directory}">
                <exclude name="WEB-INF/web.xml" />
            </fileset>
        </war>
    </target>
</project>

Wednesday, June 3, 2015

Remote Debugging Java Dynamic Web Application in Eclipse

I would like to debug my dynamic web application without using tomcat server setup on eclipse. So I got a solution from google and pasted here after i implemented.

Remote Debugging

If you cannot run your server inside Eclipse, try remote debugging. First, start the Server in debug mode. To run Tomcat in debug mode, run the following command.
- See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf
If you cannot run your server inside Eclipse, try remote debugging based on below procedures.

1. Start the Server in debug mode. To run Tomcat in debug mode, run the following command.

c:\xampp\tomcat\bin>catalina jpda start



2. Go to Run -> Debug Configurations… and create a new Remote Java Application. (I am using Eclipse Juno IDE)



The default debug port for both Tomcat and Eclipse is 8000, so we just accept the defaults

3. Click the Debug button to start the remote debugging process in eclipse debug mode.



GOOD LUCK!
go to Run -> Debug Configurations… and create a new Remote Java Application. - See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf
go to Run -> Debug Configurations… and create a new Remote Java Application. - See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf

Remote Debugging

If you cannot run your server inside Eclipse, try remote debugging. First, start the Server in debug mode. To run Tomcat in debug mode, run the following command.
- See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf

Remote Debugging

If you cannot run your server inside Eclipse, try remote debugging. First, start the Server in debug mode. To run Tomcat in debug mode, run the following command.
- See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf

Remote Debugging

If you cannot run your server inside Eclipse, try remote debugging. First, start the Server in debug mode. To run Tomcat in debug mode, run the following command.
- See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf

Remote Debugging

If you cannot run your server inside Eclipse, try remote debugging. First, start the Server in debug mode. To run Tomcat in debug mode, run the following command.
- See more at: http://blog.teamextension.com/debugging-java-web-applications-in-eclipse-366#sthash.YgdbIJTf.dpuf