Thursday, April 18, 2013

Send JSON data to struts2

No comments:
Send JSON data to struts2


I found a nice article which points out how the struts2 receives json data from UI and returns the json data as response.


We need to add a dependency in pom.xml

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-json-plugin</artifactId>
            <version>${struts2-json-plugin.version}</version>
        </dependency>


In action class just add the interceptor which maps the json data to the actions class.
    <action name="jsonTest" class="com.blah.action.JsonTestAction">          <interceptor-ref name="json">              <param name="contentType">application/json</param>          </interceptor-ref>          <result type="json"/>      </action>

Json data can be returned from strust2 action to View in the form of

        <action name="jsonTest" method="jsonTest" class="com.blah.action.JsonTestAction">
            <result type="json"/>
        </action>


Happy Coding.

--
Thank you.


Regards,
Kaleeswaran.S
Read More

Wednesday, April 17, 2013

Confluence Publisher Plugin with Jenkins

2 comments:
Confluence Publisher Plugin with Jenkins

I integrated confluence publisher plugin with Jenkins. Here are the steps, it may be helpful to some one.

1) First I installed the confluence publisher plugin in jenkins.

2) Created a account in confluence (on demand service).

3) Get the Server Base Url,




Wiki Url will be like,





4) Configure this Confluence Url in jenkins global configuration



5) Then confgiure which file need to be uploaded in Specific job configuration




6) The specified files will be uploaded to the confluence, the jenkins console will be like,




7) Attached files can be found in confluence in the link





Thats it. Enjoy Happy Coding :).

Additional Info :



--
Thank you.


Regards,
Kaleeswaran.S
Read More

Tuesday, April 16, 2013

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure on Mysql, MAMP and MAC OS

No comments:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure on Mysql, MAMP and MAC OS
I just created the a new user in phpmyadmin with all the privileges to all the databases.








and

I used the dependency

    <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.9</version>
    </dependency>

Which didn't work and throwed the exception. After some googling find the solution. I just changed the mysql connector dependency version. Now it is working.

    <!-- MySQL database driver -->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.24</version>
    </dependency>



    public void testTheApp() throws Exception {
        Connection conn = null; 
        try {
//            WARNING: Could not obtain connection metadata
//            java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:
            System.out.println("AppTest started.... ");
            Class.forName("com.mysql.jdbc.Driver");
            Properties connectionProperties = new Properties();
            connectionProperties.put("user", "java");
            connectionProperties.put("password", "java");
            conn = DriverManager.getConnection("jdbc:mysql://0.0.0.0:8889/java", connectionProperties);
            System.out.println("Connection success ...... ");
        } catch (Exception e) {
            e.printStackTrace();
        } finally 
        { 
            if (conn != null) 
            { 
                try 
                { 
                    conn.close (); 
                    System.out.println ("Database connection terminated"); 
                } 
                catch (Exception e) { /* ignore close errors */ } 
            } 
        }
    }

jdbc:mysql://0.0.0.0:8889/java (Works)jdbc:mysql://172.16.23.59:8889/java (Works)
jdbc:mysql://172.0.0.1:8889/java (Wont work)
Happy Coding :)
Read More

Wednesday, April 10, 2013

package javax.servlet does not exist

No comments:
package javax.servlet does not exist

Add a dependency


        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>


Happy Coding :)
--
Thank you.


Regards,
Kaleeswaran.S
Read More

html5 chart library

No comments:
HTML5 chart library

HTML5 and JS library rocks on graphs. Earlier it was little difficult to implement. Now it is very easy.

Highcharts



http://www.highcharts.com/demo/line-time-series/grid

Rgraph




I have used the RGraph, it is very easy to implement. Refer the doc. There are variety of graphs are available.





http://www.rgraph.net/

amCharts
Chart.js
Flotr2



     Financial graphs are nice on this library.
http://www.humblesoftware.com/flotr2/

Float






http://www.flotcharts.org/
--
Thank you.


Regards,
Kaleeswaran.S
Read More

Tuesday, April 9, 2013

JSON generator on JAVA

No comments:

JSON generator on JAVA,

http://java.dzone.com/articles/java-api-json-processing-jsr

--
Thank you.


Regards,
Kaleeswaran.S
Read More

Interact with Jenkins through Jenkins.jar

No comments:
Interact with Jenkins through Jenkins.jar


https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTdi94ODgrLWV6OaI5CxKqXkhuZlxjhVP13i7ezOYWSdOWY5OGURZIePzh0

To get the help commands from Jenkins,

java -jar /Users/users/Downloads/jenkins-cli.jar -s http://localhost:8080/jenkins/ help

Results will be like




Trigger a build from terminal

java -jar /Users/user/Downloads/jenkins-cli.jar -s http://localhost:8080/jenkins/ build DemoJob

Jenkins-cli jar can be downloaded from http://localhost:8080/jenkins/cli

Environment variable values can be accessed from shell($FOO, %FOO%) and Ant ( ${env.FOO} )  like

The parameter are available as environment parameters. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env.FOO} ) can access these values.

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build






--
Thank you.


Regards,
Kaleeswaran.S
  
Read More

Monday, April 8, 2013

Online Free Jenkins

No comments:
Use it and Enjoy.

Happy coding.

--
Thank you.


Regards,
Kaleeswaran.S
Read More