after I import my maven created struts2 project,when I try to add a Action,
the annotation is not auto complete,we need add struts2-codebehind-plugin-2.2.3.jar top build path,then
auto completion with annotation should work.the jar reside in strust2 lib folder.
or add following to project dependencies,otherwise will get a error when compile from command.
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-codebehind-plugin</artifactId>
<version>${struts2.version}</version>
</dependency>
when add annotation to action class,we also need change pom.xml to compile code with source= 1.5,add following plugin in build tag
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Tuesday, August 30, 2011
use mvn from terminal to deploy your mvn based struts2 application
while use netbean 6.5 for iceface based application with glassfish2
I need test my newly created mvn based struts2 application,I don't want use jetty ot tomcat,because I already have a server startup,if I use gjetty/tomcat,I need to change the port,there might be some other port confict.search from internet get another mvn library to help run asadmin command to deploy my strut2 application from command line
here is the jar file need registered in pom and put correct parameter for it,then invoke "mvn exec:exec" then it will deploy you war file to existed start up server,this exec goal will call asadmin command to deploy war file.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>/home/dttdev1/glassfish-2.1.1-ml/bin/asadmin
</executable>
<arguments>
<argument>deploy</argument>
<argument>--user=admin</argument>
<argument>--passwordfile=/home/dttdev1/.asadminpass
</argument>
<argument>--host=nppdev.rogers.com</argument>
<argument>--port=4848</argument>
<argument>target/${artifactId}.${packaging}</argument>
</arguments>
</configuration>
</plugin>
and remember to put this inside build/plugins
I need test my newly created mvn based struts2 application,I don't want use jetty ot tomcat,because I already have a server startup,if I use gjetty/tomcat,I need to change the port,there might be some other port confict.search from internet get another mvn library to help run asadmin command to deploy my strut2 application from command line
here is the jar file need registered in pom and put correct parameter for it,then invoke "mvn exec:exec" then it will deploy you war file to existed start up server,this exec goal will call asadmin command to deploy war file.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>/home/dttdev1/glassfish-2.1.1-ml/bin/asadmin
</executable>
<arguments>
<argument>deploy</argument>
<argument>--user=admin</argument>
<argument>--passwordfile=/home/dttdev1/.asadminpass
</argument>
<argument>--host=nppdev.rogers.com</argument>
<argument>--port=4848</argument>
<argument>target/${artifactId}.${packaging}</argument>
</arguments>
</configuration>
</plugin>
and remember to put this inside build/plugins
Friday, August 26, 2011
use latest jetty server with mvn
when we run jetty:run,mvn will add following plugin in your pom file
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
we can change this to following to use latest jetty,like jetty 7
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>3</scanIntervalSeconds>
</configuration>
</plugin>
we can change code and resource,jetty will detect that,it point to webapp in src folder,not target folder,so no need to run package
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.21</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
</configuration>
</plugin>
we can change this to following to use latest jetty,like jetty 7
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>3</scanIntervalSeconds>
</configuration>
</plugin>
we can change code and resource,jetty will detect that,it point to webapp in src folder,not target folder,so no need to run package
System.out.println shortcut both for netbeans and eclispe
in Netbeans type "sout" with tab,it will add System.out.println("").
in eclipse type "syso",than Ctrl-space,it will add System.out.println("") too.
jsut for remind myself
in eclipse type "syso",than Ctrl-space,it will add System.out.println("") too.
jsut for remind myself
Thursday, August 25, 2011
linux file search
search file based on filename
find -name "ABC*"
search file based on file content
grep -rl "test" *
find -name "ABC*"
search file based on file content
grep -rl "test" *
use jetty in eclipse for mvn struts2 web app
by use remote debug,we can use jetty as a web server and change code from eclipse,change will be effect immediately after save,we don't need to restart jetty,here is the step
set up a exteranl tools for current project,location is ${maven_exec},work directory is ${project_loc},${project_loc} is for argument,put environment variable for MAVEN_OPTS as "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n" without start and end quotation mark.
this means jvm used by jetty will use port 4000 for remote debug
then in elcipse setup a debug configuration unser Remote Java application,connection type is Standard (Socket Attach),host is localhost ,port is 4000.
then start jetty,then run debug remote debugger will attach to jetty server,enable build automatically
we can use breakpoint variable watch,
code change will automatically compiled
but things like adding static variables, new domain classes will not work sice they need aware of while class loadup
set up a exteranl tools for current project,location is ${maven_exec},work directory is ${project_loc},${project_loc} is for argument,put environment variable for MAVEN_OPTS as "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n" without start and end quotation mark.
this means jvm used by jetty will use port 4000 for remote debug
then in elcipse setup a debug configuration unser Remote Java application,connection type is Standard (Socket Attach),host is localhost ,port is 4000.
then start jetty,then run debug remote debugger will attach to jetty server,enable build automatically
we can use breakpoint variable watch,
code change will automatically compiled
but things like adding static variables, new domain classes will not work sice they need aware of while class loadup
see tomcat console like it was in windows
tomcat in windows has a console display message after it was started,but in linux,it doesn't
we need use "tail -f catalina.out" in log folder,then start,shutdown and deploy information will be displayed automatically in the console.
we need use "tail -f catalina.out" in log folder,then start,shutdown and deploy information will be displayed automatically in the console.
how to post XML in blogger
use following website to decode xml file,then copy and paste in blogger
http://centricle.com/tools/html-entities/
http://centricle.com/tools/html-entities/
Tuesday, August 23, 2011
read file from oracle PL/SQL
oracle provide a pckage UTF_FILE to read/write file from db server's directory
Monday, August 22, 2011
config tomcat to pint to application folder
change server.xml file to include following tag and content inside host tag
for tomcat6 property debug should be removed
<Context path="/cims" docBase="C:/workspace/cimsreport/web" debug="0"
reloadable="true" crossContext="true">
</Context>
for tomcat6 property debug should be removed
Tuesday, August 16, 2011
error while install Oracle Service bus
while install Oracle Service Bus in linux,get following error
You do not have sufficient permissions to access the inventory '/home/tom1/oraInventory'. Installation cannot continue. Make sure that you have read/write permissions to the inventory directory and restart the installer.: Permission denied
the solution is create your own oraInventory in your home
1) create a folder in your home: mkdir oraInventory
2) craete a file in your home: touch oraInst.loc
3) add following content to the file
inventory_loc=/home/dttdev/oraInventory
inst_group=nppdev
then call installer like this
You do not have sufficient permissions to access the inventory '/home/tom1/oraInventory'. Installation cannot continue. Make sure that you have read/write permissions to the inventory directory and restart the installer.: Permission denied
the solution is create your own oraInventory in your home
1) create a folder in your home: mkdir oraInventory
2) craete a file in your home: touch oraInst.loc
3) add following content to the file
inventory_loc=/home/dttdev/oraInventory
inst_group=nppdev
then call installer like this
./runInstall -invPtrLoc /home/bpub/oraInst.loc
Tuesday, August 9, 2011
how to back up Large files
the content is reference from http://www.electronic-equipments.co.uk/tutorial/linux/backup_large_files.html
BACKUP
1)tar -cz mydir | split -d -b 1000m - myarchive.tgz.(include last dot)
2)md5sum myarchive.tgz.* > myarchive.md5
RESTORE
1)md5sum -c myarchive.md5
2)cat myarchive.tgz.* | tar -xz
BACKUP
1)tar -cz mydir | split -d -b 1000m - myarchive.tgz.(include last dot)
2)md5sum myarchive.tgz.* > myarchive.md5
RESTORE
1)md5sum -c myarchive.md5
2)cat myarchive.tgz.* | tar -xz
6502: PL/SQL: numeric or value error
in PL/SQL if we iterate a table and use follwing syntax
FOR i IN v_mac_tbl.FIRST .. v_mac_tbl.LAST LOOP
blar... with v_mac_tbl(i)
end loop
v_mac_tbl is a table of some sequence type
the table is fill by a fetch bulk collect into.
if the source cursor is empty,then the table is empty,so reference of v_mac_tbl(i) will throw SQLException,it sames like for loop will execute at least one time even table is empty.
the solution is use a if before For loop by checl v_mac_tbl.count >0.
FOR i IN v_mac_tbl.FIRST .. v_mac_tbl.LAST LOOP
blar... with v_mac_tbl(i)
end loop
v_mac_tbl is a table of some sequence type
the table is fill by a fetch bulk collect into.
if the source cursor is empty,then the table is empty,so reference of v_mac_tbl(i) will throw SQLException,it sames like for loop will execute at least one time even table is empty.
the solution is use a if before For loop by checl v_mac_tbl.count >0.
Subscribe to:
Posts (Atom)