我正在使用Tomcat 7.0.67,Spring 4.2.0。我使用Spring-JPA,Hibernate或JPA 不,但是当我尝试启动Spring应用程序时,它失败并显示错误,指出找不到23:39:43.836 ERROR org.springframework.web.context.ContextLoader[] - Context initialization failed
java.lang.NoClassDefFoundError: javax/persistence/EntityManagerFactory
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_66]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_66]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_66]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:606) ~[spring-core-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:518) ~[spring-core-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:504) ~[spring-core-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834) ~[spring-context-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) ~[spring-context-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446) ~[spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328) ~[spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) [spring-web-4.2.0.RELEASE.jar:4.2.0.RELEASE]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077) [catalina.jar:7.0.67]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591) [catalina.jar:7.0.67]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.67]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574) [catalina.jar:7.0.67]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564) [catalina.jar:7.0.67]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_66]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_66]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_66]
Caused by: java.lang.ClassNotFoundException: javax.persistence.EntityManagerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_66]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_66]
类:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
我尝试将下面的内容添加到我的pom.xml中以包含持久性jar,但它没有什么区别。
mvn dependency:tree
这是/** Days to be disabled as an array */
var badDates = ["02-06-2015", "02-07-2014"];
function DisableSpecificDates(date) {
var string = $.datepicker.formatDate('mm-dd-yy', date);
return [badDates.indexOf(string) == -1];
}
$(function() {
$("#datepicker").datepicker({
minDate: 0,
beforeShowDay: DisableSpecificDates
});
});
:https://gist.github.com/eytanbiala/492d9af46f8990917e45
答案 0 :(得分:0)
请手动复制你的hibernate-jpa jar文件tomcat lib文件夹。