我的项目结构是下面的屏幕截图。实际上,虽然文件存在但我找不到文件错误,我将在下面添加错误。我是Intellej的新手,这是我的第一个项目,我试图通过使用mysql连接到数据库来建立音乐商店。我的applicaiton-context.xml在下面,dispatcher和web.xml是正确的。
我的日志文件是
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
引起:java.io.FileNotFoundException:类路径资源[com / emusicstore / Dao / ProductDao.class]无法打开,因为它不存在 在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 在org.springframework.core.type.classreading.SimpleMetadataReader。(SimpleMetadataReader.java:50) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) 在org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) 在org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:621) 在org.springframework.context.annotation.ConfigurationClassParser $ SourceClass.getInterfaces(ConfigurationClassParser.java:797) 在org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) 在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:168) ......还有32个
2016年3月18日10:37:15.310严重[http-nio-8080-exec-1] org.apache.catalina.core.StandardWrapperValve.invoke为servlet调度程序分配异常 java.io.FileNotFoundException:类路径资源[com / emusicstore / Dao / ProductDao.class]无法打开,因为它不存在 在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 在org.springframework.core.type.classreading.SimpleMetadataReader。(SimpleMetadataReader.java:50) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) 在org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) 在org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:621) 在org.springframework.context.annotation.ConfigurationClassParser $ SourceClass.getInterfaces(ConfigurationClassParser.java:797) 在org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) 在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:168) 在org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) 在org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) 在org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) 在org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667) 在org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633) 在org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681) 在org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552) 在org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493) 在org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 在javax.servlet.GenericServlet.init(GenericServlet.java:158) 在org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 在org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 在org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 在org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) 在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:672) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1500) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1456) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61) 在java.lang.Thread.run(Thread.java:745)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
引起:java.io.FileNotFoundException:类路径资源[com / emusicstore / Dao / ProductDao.class]无法打开,因为它不存在 在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 在org.springframework.core.type.classreading.SimpleMetadataReader。(SimpleMetadataReader.java:50) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) 在org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) 在org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:621) 在org.springframework.context.annotation.ConfigurationClassParser $ SourceClass.getInterfaces(ConfigurationClassParser.java:797) 在org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) 在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:168) ......还有32个
2016年3月18日10:37:16.340 SEVERE [http-nio-8080-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke为servlet调度程序分配异常 java.io.FileNotFoundException:类路径资源[com / emusicstore / Dao / ProductDao.class]无法打开,因为它不存在 在org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) 在org.springframework.core.type.classreading.SimpleMetadataReader。(SimpleMetadataReader.java:50) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:98) 在org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102) 在org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:93) 在org.springframework.context.annotation.ConfigurationClassParser.asSourceClass(ConfigurationClassParser.java:621) 在org.springframework.context.annotation.ConfigurationClassParser $ SourceClass.getInterfaces(ConfigurationClassParser.java:797) 在org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:298) 在org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:232) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:199) 在org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:168) 在org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:321) 在org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243) 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273) 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98) 在org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520) 在org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667) 在org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633) 在org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681) 在org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552) 在org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493) 在org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) 在javax.servlet.GenericServlet.init(GenericServlet.java:158) 在org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238) 在org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151) 在org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:828) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 在org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) 在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) at org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:672) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1500) 在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1456) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61) 在java.lang.Thread.run(Thread.java:745)
答案 0 :(得分:0)
检查目标文件夹并查看ProductDao.class是否存在于那里,如果不是它没有编译它,我认为你有时在Intellij中使用Intellij,目标文件夹自动被排除右键单击目标文件夹并选择取消排除。并确保该类存在于dao包下,并且该类的名称相同。还请检查bean是否配置正确。
我看到您的Target文件夹已被排除,因为它是RED,因此请尝试取消应该有效的排除项,如果没有请说明ProductDao如何配置为bean。