{"id":65977,"date":"2021-07-18T10:54:08","date_gmt":"2021-07-18T14:54:08","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/writing-your-first-spring-application-java-short-notes\/"},"modified":"2022-05-10T20:12:12","modified_gmt":"2022-05-11T00:12:12","slug":"writing-your-first-spring-application-java-short-notes","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65977","title":{"rendered":"Writing your first Spring application #Java Short Notes"},"content":{"rendered":"<ul>\n<li>Requirements: JDK 1.4.2 (or above), Tomcat 5.0+, Ant 1.6.1+<\/li>\n<li>Also, you can use cygwin in windows to emulate linux like commands<\/li>\n<li>set JAVA_HOME, ANT_HOME, CATALINA_HOME environment variables &#8211; paths to the installed software<\/li>\n<li>Add to PATH: JAVA_HOME\/bin, ANT_HOME\/bin, CATALINA_HOME\/bin<\/li>\n<li>You can start with the minimal application like struts-blanke.war or webapp-minimal that contains the basic files for struts and spring frameworks respectively. Or start with a equinox download from https:\/\/equinox.dev.java.net\/files\/documents\/1901\/5728\/equinox-1.0.zip that will simplify strut-spring integration\/switching. Download and unzip<\/li>\n<li>Make sure that the environment variables are set properly. Take a look at build.xml file. Check different sections like compile, distribution, ant-tomcat, help, database<\/li>\n<li>run ant new -Dapp.name=users from windows\/linux\/cygwin command prompt. It will create a new application with name users.<\/li>\n<li>Check the directory structure. It should look like as follows:<\/li>\n<li>under newly created users directory run commands like ant and check output. In build.xml, change default=&#8221;help&#8221; to default=&#8221;compile&#8221;, run ant again, run ant deploy, play with different ant commands<\/li>\n<li>if ant command shows error messages then you may need to change build.xml file as indicated. With equinox, you may face path error like {&#8230;}\/common\/lib or {&#8230;} lib<\/li>\n<li>If things don&#8217;t work right, check build.properties and modify the options if required. Play again<\/li>\n<li>Also, check tomcatTasks.properties file to see what classes are used for different ant commands (used in the build.xml file)<\/li>\n<li>Run ant list to check the services running. if the command fails, check that build.properties file contains right information. Make sure tomcat-users.xml file under the Tomcat installation directory has an entry for users as provided in the build.properties file<\/li>\n<li>Make sure, you are under the users directory<\/li>\n<li>run: ant deploy : the users application will be deployed under Tomcat. Check target name=deploy section in your build.xml file. You will see what actually happens in deployment (mostly copy)<\/li>\n<li>Using your browser, go to: http:\/\/localhost:8080\/users\/, you will see the interface of the users application<\/li>\n<li><b>Unit Test Persistence Layer<\/b><\/li>\n<li>Hibernate for persistence<\/li>\n<li>Hibernate relates Java Objects to database tables, makes CRUD (Create, Read, Update, Delete) very easy<\/li>\n<li>Spring + Hibernate: 75% code reduction than Hibernate alone: [ref:Internet, sourcebeat.com]<\/li>\n<li>Spring + Hibernate: removal of a ServiceLocator, removal of several DAOFactory classes, replace Hibernate&#8217;s checked exceptions with Spring&#8217;s runtime exceptions<\/li>\n<li>Before proceeding further, you may want to open the application using Eclipse. You can also use any editor to create Java files.<\/li>\n<li>Eclipse 3.3.2: How to open the project: File-&gt;new-&gt;project-&gt;java-&gt;java project-&gt;create project from existing source-&gt;identify the location and provide project name as users-&gt;you may want to switch to java perspectives.<\/li>\n<li>Click on build.xml file. Right click -&gt; run as -&gt; 2 Ant Build. If compilation fails: change basedir to the application directory. If it fails again check, tomcat directories and the directories mentioned in the build.xml files are the same. [you may not need \/server in build.xml for tomcat 6.o]<\/li>\n<li>Check: build.xml -&gt; right click -&gt; Run As -&gt; 3. Ant Build -&gt; check that you selected the operation you want. If you want to deploy your application after compilation you need to select compile, deploy. Check what else apply. Or you can use the ant command [with options] from the command prompt<\/li>\n<li>Now Hibernate and Persistence again:<\/li>\n<\/ul>\n<p> From: http:\/\/sitestree.com\/?p=4924<br \/> Categories:Java Short Notes<br \/>Tags:<br \/> Post Data:2006-12-25 08:52:32<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirements: JDK 1.4.2 (or above), Tomcat 5.0+, Ant 1.6.1+ Also, you can use cygwin in windows to emulate linux like commands set JAVA_HOME, ANT_HOME, CATALINA_HOME environment variables &#8211; paths to the installed software Add to PATH: JAVA_HOME\/bin, ANT_HOME\/bin, CATALINA_HOME\/bin You can start with the minimal application like struts-blanke.war or webapp-minimal that contains the basic files &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65977\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917,1956],"tags":[],"class_list":["post-65977","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","category-java-spring","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":66344,"url":"http:\/\/bangla.sitestree.com\/?p=66344","url_meta":{"origin":65977,"position":0},"title":"Creating Java Development Environment with Struts for Your Home PC #Java Short Notes","author":"Sayed","date":"July 18, 2021","format":false,"excerpt":"Creating Java Development Environment with Struts for Your Home PC.......................... Why Struts? Just take a look at the web-sites using Struts J2EE does not meet all the requirements for web-applications. Struts addresses these requirements. Check this article for details Components Required J2SE 5\/6 or J2EE 5 - both JRE and\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":74781,"url":"http:\/\/bangla.sitestree.com\/?p=74781","url_meta":{"origin":65977,"position":1},"title":"Playlist: Anything Java","author":"Sayed","date":"May 31, 2022","format":false,"excerpt":"Playlist: Anything Java: https:\/\/www.youtube.com\/playlist... #SaLearningSchoolShopForSoulSitesTree, #SaLearningSchool, #ShopForSoul, #SitesTree Starting Java training basic file operations in java basic java language concepts bengali javascript debugging data conversion in jsf applications debugging javascript code Docker and Vagrant Optional Java and\/or PHP Platform ejb application with bea weblogic eclipse experiment eclipse ant how to\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68510,"url":"http:\/\/bangla.sitestree.com\/?p=68510","url_meta":{"origin":65977,"position":2},"title":"Installing Apache Tomcat 6.0: Windows #8","author":"Author-Check- Article-or-Video","date":"August 4, 2021","format":false,"excerpt":"Make sure you have installed J2SE 5 (both the jdk and the jre) or greater (for tomcat 6.0, j2se5 is required according to my experience) Set the JAVA_HOME environment variable to the path of the JDK Download Tomcat 6 from http:\/\/tomcat.apache.org\/download-60.cgi Click on the downloaded setup.exe file Select Core+service+examples i.e.\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23192,"url":"http:\/\/bangla.sitestree.com\/?p=23192","url_meta":{"origin":65977,"position":3},"title":"Installing Apache Tomcat 6.0: Windows #Root #By Sayed Ahmed","author":"Author-Check- Article-or-Video","date":"March 26, 2021","format":false,"excerpt":"Make sure you have installed J2SE 5 (both the jdk and the jre) or greater (for tomcat 6.0, j2se5 is required according to my experience) Set the JAVA_HOME environment variable to the path of the JDK Download Tomcat 6 from http:\/\/tomcat.apache.org\/download-60.cgi Click on the downloaded setup.exe file Select Core+service+examples i.e.\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67404,"url":"http:\/\/bangla.sitestree.com\/?p=67404","url_meta":{"origin":65977,"position":4},"title":"How to create apache axis based SOA application #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 21, 2021","format":false,"excerpt":"Tools required\/Used: J2SE6, Tomcat 6.0.16, Apache Axis 1.4, mailapi.jar and activation.jar. Tools can be downloaded from Apache Axis Based SOA Application Development DID NOT MENTION in the Video: You have to keep tools.jar from J2SE6 in the classpath or make it accessible from the application anyhow Set your CATALINA_HOME and\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":67444,"url":"http:\/\/bangla.sitestree.com\/?p=67444","url_meta":{"origin":65977,"position":5},"title":"Java\/J2EE:Important Resources: Struts, Spring, Hibernate, JPA #Java Short Notes","author":"Sayed","date":"July 22, 2021","format":false,"excerpt":"Java\/J2EE:Important Resources: Struts, Spring, Hibernate, JPA ...... .... ..... .... ... ... ... ... ... ... .. ..Struts Struts Developer and User Guides Struts API Struts TutorialsSpring, Hibernate, JPA Spring 2.5 API Spring 2.5 Reference Manual JPA APIJSF JSF 1.2 Java API JSF 1.2 Tag Library API JSF 1.1 Java\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65977"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65977\/revisions"}],"predecessor-version":[{"id":74588,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65977\/revisions\/74588"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65977"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}