java ee - Spring Example using STS 3.6.4 -
from spring tool suite 3.6.4 trying develop spring project have done every thing adding jars present in sts lib folder , apache common-logging 1.1.3 , 1.2.
sts showing error in main class @ new classpathxmlapplicationcontext("beans.xml");
while trying solve it, sts showing configure buildpath have added jars watching tutorials in youtube.
i using java 1.6 version, os ubuntu, sts 3.6.4 below listed jars have added buildpath
/home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/aws-java-sdk-1.7.5.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.beanutils-1.8.3.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.cli-1.2.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.codec-1.5.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.collections-3.2.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.configuration-1.8.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.digester-1.8.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.jxpath-1.3.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.lang-2.6.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.apache.commons.logging-1.1.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.bouncycastle.jce-1.46.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.bouncycastle.mail-1.46.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/com.springsource.org.jdom-1.0.0.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/commons-codec-1.6.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/commons-logging-1.1.3.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/httpclient-4.3.3.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/httpcore-4.3.2.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/jackson-annotations-2.1.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/jackson-core-2.1.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/jackson-databind-2.1.1.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/joda-time-2.7.jar /home/axxera/sts-bundle/pivotal-tc-server-developer-3.1.0.release/lib/tc-runtime-instance-3.1.0.release.jar /home/axxera/venkat/libraries/org-apache-commons-logging.jar /home/axxera/venkat/libraries/org.springframework.context-3.0.4.release.jar /home/axxera/venkat/libraries/spring-context-4.1.5.release.jar /home/axxera/venkat/libraries/jbehave-spring-3.6.4.jar /home/axxera/venkat/libraries/commons-logging-1.2/commons-logging-1.2.jar /home/axxera/venkat/libraries/commons-logging-1.2/commons-logging-1.2-javadoc.jar
below code
main class
package com.spring; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; public class main { public static void main(string[] args) { classpathxmlapplicationcontext appcontext = new classpathxmlapplicationcontext("beans.xml"); } } package com.spring; public class springsample { void printmessage() { system.out.println("hello world"); } }
beans.xml:
<?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.xsd"> <bean id="samplebean" class="com.spring.springsample"></bean> </beans>
looks miss spring-beans-<version>.jar
. download , add classpath.
Comments
Post a Comment