javax/servlet/ServletContext : Unsupported major.minor version 51.0

code:
package com.freesun.weijia.generate.service;

import com.freesun.weijia.generate.base.BaseTest;
import com.freesun.weijia.generate.dataobject.GenerateUserIdDO;
import com.freesun.weijia.generate.service.generateuserid.GenerateUserIdService;
import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

/**

•User: yangfei
•Date: 2014/11/12
•Time: 13:53
•Desc:请描述该类实现功能
*/
@ContextConfiguration(locations={"classpath:springbeans-weijia-generate-dao.xml", "classpath:springbeans-weijia-generate-datasource.xml","classpath:springbeans-weijia-generate-service.xml","classpath:springbeans-weijia-generate-remote.xml"})
@Transactional
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
public class GenerateUserIdServiceTest extends AbstractTransactionalJUnit4SpringContextTests {

private Logger log = LoggerFactory.getLogger(this.getClass().getName());

@Autowired
private GenerateUserIdService generateUserIdService;

public void setGenerateUserIdService(GenerateUserIdService generateUserIdService) {
this.generateUserIdService = generateUserIdService;
}

@Test
public void insertGetUserGenerateIdTest(){
GenerateUserIdDO generateUserIdDO = new GenerateUserIdDO();
generateUserIdDO.setContent("u");
int uid =generateUserIdService.insertGetUserGenerateId(generateUserIdDO);
log.debug("insertGetUserGenerateIdTest",uid);
Assert.assertNotNull(uid);
}
}

error:
提示jdk版本不符合对,引入jar只有junit springmvc框架,why?

2014-11-12 15:01:08.408 [main] DEBUG o.s.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.freesun.weijia.generate.service.GenerateUserIdServiceTest]

java.lang.UnsupportedClassVersionError: javax/servlet/ServletContext : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398)
at java.lang.Class.getConstructor0(Class.java:2708)
at java.lang.Class.getDeclaredConstructor(Class.java:1987)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.instantiateListeners(AbstractTestContextBootstrapper.java:191)
at org.springframework.test.context.support.AbstractTestContextBootstrapper.getTestExecutionListeners(AbstractTestContextBootstrapper.java:173)
at org.springframework.test.context.TestContextManager.(TestContextManager.java:104)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTestContextManager(SpringJUnit4ClassRunner.java:123)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.(SpringJUnit4ClassRunner.java:114)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:33)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

你可能感兴趣的:(servletContext)