我将spring数据用于gradle。但我犯了一个错误:
java.lang.NoClassDefFoundError: org/springframework/context/event/EventListenerFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:609)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:521)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:534)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:507)
at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:567)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:683)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:627)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:597)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1445)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:445)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:415)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:97)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:610)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:440)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.event.EventListenerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:401)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
... 54 more
我的Gradle文件:
compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
compile 'org.springframework:spring-core:3.2.3.RELEASE'
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
compile 'org.springframework.data:spring-data-jpa:1.9.4.RELEASE'
compile 'org.springframework:spring-orm:4.2.5.RELEASE'
compile 'org.springframework.data:spring-data-jpa:1.9.4.RELEASE'
compile 'org.springframework:spring-tx:4.2.5.RELEASE'
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final'
compile 'org.hibernate:hibernate-entitymanager:5.1.0.Final'
compile 'javax.servlet:jstl:1.2'
compile 'com.sun.jersey:jersey-client:1.18.1'
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
compile 'mysql:mysql-connector-java:5.1.35'
providedCompile 'javax.servlet.jsp:jsp-api:2.1'
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-all:1.9.5'
compile 'org.slf4j:slf4j-api:1.7.5'
compile 'org.slf4j:slf4j-log4j12:1.7.5'
compile 'org.slf4j:jcl-over-slf4j:1.7.5'
compile 'log4j:log4j:1.2.17'
compile 'org.codehaus.jackson:jackson-jaxrs:1.9.2'
compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.12'
compile 'com.fasterxml.jackson.core:jackson-core:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
testCompile 'org.mockito:mockito-all:1.9.5'
Webconfig:@Configuration@EnableWebMvc@EnableTransactionManagement@Properties tySource("classpath:application.properties")@EnableJpaRepository("com.decorpot.datasource.repository")@ComponentScan(BasPackages = { " com.decorpot.spring.config"、"com.decorpot.spring.controller"、"com.decorpot. *" }) 公共类WebConfig扩展WebMvcConfigrerAdapter{
private static final String PROPERTY_NAME_DATABASE_DRIVER = "db.driver";
private static final String PROPERTY_NAME_DATABASE_PASSWORD = "db.password";
private static final String PROPERTY_NAME_DATABASE_URL = "db.url";
private static final String PROPERTY_NAME_DATABASE_USERNAME = "db.username";
private static final String PROPERTY_NAME_HIBERNATE_DIALECT = "hibernate.dialect";
private static final String PROPERTY_NAME_HIBERNATE_SHOW_SQL = "hibernate.show_sql";
@Resource
private Environment env;
@Bean(name = "decorpotDataSource")
@Primary
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(env.getRequiredProperty(PROPERTY_NAME_DATABASE_DRIVER));
dataSource.setUrl(env.getRequiredProperty(PROPERTY_NAME_DATABASE_URL));
dataSource.setUsername(env.getRequiredProperty(PROPERTY_NAME_DATABASE_USERNAME));
dataSource.setPassword(env.getRequiredProperty(PROPERTY_NAME_DATABASE_PASSWORD));
return dataSource;
}
@Bean(name = "decorpotEntityManager")
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(false);
entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
entityManagerFactoryBean.setPackagesToScan("com.decorpot.datasource.models");
entityManagerFactoryBean.setJpaProperties(hibProperties());
return entityManagerFactoryBean;
}
private Properties hibProperties() {
Properties properties = new Properties();
properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
return properties;
}
@Bean(name = "decorpotTransactionManager")
@Primary
public JpaTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
}
@Bean
public InternalResourceViewResolver jspViewResolver() {
System.out.println("WebConfig:InternalResourceViewResolver");
InternalResourceViewResolver bean = new InternalResourceViewResolver();
bean.setPrefix("/WEB-INF/views/");
bean.setSuffix(".jsp");
return bean;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
System.out.println("WebConfig:addResourceHandlers");
registry.addResourceHandler("/resources/**")
.addResourceLocations("/resources/")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/views/**").addResourceLocations("/views/**");
}
我哪里做错了,为什么会出现这种错误。请帮忙。
您的gradle文件中似乎缺少以下依赖项:
'org.springframework:spring-context:3.2.3.RELEASE'
我正在尝试从我创建的一个简单的联系人表单中插入数据。我正在使用phpMyAdmin 下面是PHP(出于安全考虑,我删除了define语句,但我可以毫无问题地建立到数据库的链接。) 当有人点击论坛上的submit按钮后,代码就会运行,据我所知,这是正常工作的。 该错误发生在php代码的末尾。正在输出“SLQ Insert Statement FAILD”,但未发布mysql错误。 我的数据库/表的设
当我将hbase-site.xml中的hbase.rootdir配置设置为本地文件系统(如file:/hbase_root_dir_path)时,hbase工作正常,但当我将其更改为hdfs:/localhost:9000/hbase时,hbase开始时也正常。但过了一小段时间(通常是几秒钟),它就不起作用了。我发现HMaster用jps命令停止了。当然,我无法打开localhost:60010网
我的任务是完成以下两个Oracle函数: 将CLOB作为输入,并使用AES-256对其进行加密,然后返回加密的CLOB 将加密的CLOB作为输入,使用AES-256对其解密并返回解密的CLOB 它抛出的错误是: ORA-06502:PL/SQL:数值或值错误:十六进制到原始转换错误 ORA-06512:在“sn_pre_stage_415.f_decrypt_clob”,第33行 06502。00
我在用Hibernate。如何配置我的persistence.xml以拥有一个H2内存数据库? 我的坚持。xml是: 但是当我运行我的应用程序时,我收到以下错误:
目标:我尝试使用Java数据库连接器(JDBC)教程。我目前正处于这一步。 错误:在我有JDBC教程的目录中使用shell,我输入,并得到以下错误: buildfile:/users/adam/desktop/jdbctutorial/build.xml 再次感谢!
然而我却遇到了错误。我无法确定错误发生的确切位置,但我从结果树中获得了如下错误消息: 对于JSR223采样器 响应消息:javax.script.scriptException:源文件:内联计算:import org.apache.poi.xssf.usermodel.xssfworkbook;导入org.apache.poi.xssf.us。..“:INTEGER.parseint(vars.g