Question: java spring simple application

Ads

 
 
 

Share on Google+Share on Google+

mazeed
java spring simple application
2 Answer(s)      5 years and 11 months ago
Posted in : Spring

hai I have design a simple application in this I always found class not found exception. I am sendig code as follows please resolve this and send me.my directory structure is as follows

Project:Student/src/com.mazeed/StudentComponet.java/TestClient.java/springConfig.xml for this I have added lib files also

StudentComponent.java:

package com.mazeed;

public class StudentComponent {
    private String sname;
    public String getSname() {
        return sname;
    }
    public void setSname(String sname) {
        this.sname = sname;
    }
    public String getFname() {
        return fname;
    }
    public void setFname(String fname) {
        this.fname = fname;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    private String fname;
    private String city;
    public StudentComponent() {


    }

}

TestClient.java

package com.mazeed;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.*;

public class TestClient {
public static void main(String[] args)
{
    Resource res=new ClassPathResource("springConfig.xml");
    BeanFactory container=new XmlBeanFactory(res);
    System.out.println("container created");
    Object o=container.getBean("studbean");
    StudentComponent sc=(StudentComponent)o;
    System.out.println(sc.getCity());
    System.out.println(sc.getFname());
    System.out.println(sc.getSname());

}
}

Beans configuration:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="studbean" class="StudentComponent" 
    abstract="false" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="sname">
    <value>mazeed</value></property>
     <property name="fname">
     <value>Raheem</value>
     </property>
  <property name="city">
  <value>Hyderabad</value>
  </property>
Ads
View Answers

June 2, 2011 at 12:33 PM


Please visit the following link:

Spring Tutorials



June 2, 2011 at 12:33 PM


Please visit the following link:

Spring Tutorials


Ads









Related Tutorials/Questions & Answers:
java spring simple application
java spring simple application  hai I have design a simple application in this I always found class not found exception. I am sendig code as follows.../beans/spring-beans-2.5.xsd"> <bean id="studbean" class="StudentComponent
Simple IO Application - Java Beginners
Simple IO Application  Hi, please help me Write a simple Java application that prompts the user for their first name and then their last name. The application should then respond with 'Hello first & last name, what
Advertisements
Java Spring Desktop application
Java Spring Desktop application  Hi i am developing a desktop java spring application..It has many Jframes forms and classes...How to close one Jframe from another..Please tell... First jframe package desktopapplication2
Simple Java Desktop Upload application
Simple Java Desktop Upload application  I try do simple example for upload applicationtake file from c:\ put to d:\ :) PLEASE HELP
Hibernate Simple Program Using Java Application with Eclipse
Hibernate Simple Program Using Java Application with Eclipse  How to write Hibernate Simple Program Using Java Application with Eclipse? I wish to learn Hibernate using very popular Eclipse IDE. Share me the best tutorial link
Java Spring Desktop application with multiple classes and jframe
Java Spring Desktop application with multiple classes and jframe  Hi i am developing a desktop java spring application..It has many Jframes forms and classes...How to close one Jframe from another..Please tell... First jframe
JSF Simple Login Application - Java Server Faces Questions
JSF Simple Login Application  Hi there, I have implemented all the things which you mentioned in " JSF Simple Login Application " . but as i insert USER_ID and PASSWORD then it is showing an exception which
Spring application in RSA 7.0.0.3
Spring application in RSA 7.0.0.3  how to build a sample spring application using RSA 7.0.0.3
Simple application using hibernate
Simple application using hibernate  Hi, How to write a simple application using hibernate in Eclipse IDE? I would like to to learn: Process... of the tutorial you will like to learn for creating the simple application using
How a simple "Hello World" can be displayed using Spring 3.2 MVC?
How a simple "Hello World" can be displayed using Spring 3.2 MVC?  Hi, How a simple "Hello World" can be displayed using Spring 3.2 MVC? Thanks... application of framework based on Java Platform. For creating a small program of Hello
Spring login form application
Spring login form application  Hi Please give me the Spring login form application so that i can understand its flow ?   Hi please find the link of the tutorial Spring Applications
How to add a bean in spring application?
How to add a bean in spring application?  Hi, How to add a bean in spring application? Thanks
Simple Calculator Application In Java Script
Simple Calculator Application In Java Script  ... the basics of JavaScript and create your first JavaScript program. What is simple Calculator The objective of this project is  learn how to write a simple
Web application - Spring
Web application  I need one simple complete web application example using springs with database connection,i saw ur demo but it is not succfient.can u send to [email protected] am a beginner
For CRUD application - Spring
For CRUD application  Hi, Can i have Crud(create ,edit,update,delete the data in database ) code & search the eployee using "id or name" using Spring ,Hibernate and Mysql Thanks Raghavendra
simple bank application - JSP-Servlet
simple bank application  hi i got ur codings...But if we register a new user it is not updating in the database...so plz snd me the database also.... Thank you
Spring, Hibernate login and registration application
Spring, Hibernate login and registration application Spring, Hibernate login... fully function login and registration application in Spring and Hibernate... experience of Web application development Well versed with the Core Java
what is diffrence between the spring and ejb which is better for small application - Spring
appplication.what is diffrence between the struts with spring application and struts without... is an open source application for the Java platform whereas EJB is a server-side...what is diffrence between the spring and ejb which is better for small
Simple Bank Application in JSP
Simple Bank Application in JSP       In this section, we have developed a simple bank application in jsp . In this application user can Update the User Profile, Cash
java - Spring
java  hi deepak, can u send simple program on spring with alkl jar files ,same as how u put in struts in the sites..plse help i am in trouble ...i am new 2 spring
ClassNotFound Exception:DispatcherServlet in spring application?
ClassNotFound Exception:DispatcherServlet in spring application?  **I... environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.001\bin... org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'dispatcher
How to make Simple form in Spring web?
. In this tutorial we are creating a simple form in Spring MVC which displays two... to run the example program. How to develop simple form in Spring MVC... a simple form in Spring MVC: 1. Form Class (User.java) The form class contains
Simple Web Application using Servlet
Simple Web Application using Servlet       In this section, we have developed a simple web application in Servlet . In this application user can add, update and delete all
Simple FTP upload in Java
Simple FTP upload in Java  How to write a program for Simple FTP upload in Java? Any code example of Simple FTP upload in Java will be very helpful for me. Thanks
JAVA - Spring
spring concept, i want a small program in spring. what are the requirements... information,Examples and Tutorials on Spring visit to : http://www.roseindia.net/spring/ Thanks
Simple Java Projects
Simple Java Projects  Hi, I am beginner in Java and trying to find Simple Java Projects to learn the different concepts on Java. Can anyone tell me where to get it? Thanks
How to use css in simple HTML application
How to use css in simple HTML application   Please give simple example for understanding purpose
Building a Simple EJB Application Tutorial
Building a Simple EJB Application - A Tutorial   ... in and XDoclet. This application,    while simple, provides a good.... This application, while simple, provides a good introduction to EJB development and some
java - Spring
java  if we want to execute spring program what are the basic files we need? how to write the spring program?i want small example with code. what is loosely coupled and titlly coupled? what is constructor injection? what
Java - Spring
Java  Hi Roseindia, Can you provide code for searching based on Id and name using Spring,Hibernate & Struts. MAny Thanks Ragahvendra  .../struts/hibernate-spring/index.shtml Hope that it will be helpful for you
simple calculator - Java Beginners
simple calculator  how can i create a simple calculator using java codes?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/swing/calculator-in-swing.shtml Thanks
Tutorials   
Java Spring Hibernate Struts Training How to validate form using Spring MVC? Spring Framework Tutorials 2017 Is Spring Framework dead? spring inteview question You Spring Project is not running java lang incompatibleclasschangeerror quartz spring - Error resolved exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined The import javax.validation cannot be resolved java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence Solving java.lang.ClassNotFoundException: org.springframework.orm.hibernate4.LocalSessionFactoryBean issue What is the maven dependency for spring batch? Hibernate Session Attribute java.lang.ClassNotFoundException: org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource Testing spring with junit and mock testing in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats. java.lang.NoClassDefFoundError: org/hibernate/engine/FilterDefinition error package org.springframework.scheduling.quartz does not exist jquery dependency dropdown box in spring hibernate my sql Server side validation on dynamically generated fields from more than one table on spring framework. What are the new features of Spring 4.1? Append Arguments to the URL quartz schedular in spring mvc Where to download spring framework zip file? Integrating spring 4 with hibernate 4 Learn spring Multiple files upload code using spring mvc 2.0 with xml configuration without using annotations Spring 4 features I need Spring 2.5 example. Please point me towards a good Spring transactional tutorial Could anyone point me towards some good Spring tutorials, Please? What is Spring framework? Spring and hibernate based Online Shopping project with source code How to populate collection like map with annotation in mybatis? Spring Abstraction with Redis Spring framework How to insert and retreive an image in mysql database using spring mvc framework??? CRUD operations in spring mvc 2.5 meenakshi Meenakshi how many scenarios is having to developing web based application by using spring mvc. getting voucherPin parent and child dropdown Spring 3 Spring 3 MVC Login Form Example with Database MySql What is Spring Integration? How to configure Spring using Annotation What is Spring IOC Container ?

Ads

 
Advertisement null

Ads