springmvc+tomcat7+jndi如何配置,我配置老报错用的oracle数据库 5C

我的配置如下:
1、首先在jdbc.properties.xml配置
jnidoracle=java:comp/env/jdbc/pumsdb
2、然后在applicationcontext.xml加载数据源
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">










3、然后定义tomcat7 jndi全局数据源,在tomcat7 server.xml中配置

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->

maxactive="50" maxidle="10" maxwait="600000" name="jdbc/pumsdb" password="exam"
type="javax.sql.DataSource" url="jdbc:oracle:thin:@192.168.8.247:1521/kszx"
username="exam" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory">

4、在tomcat7 context.xml中配置

然后运行程序报错报错代码如下
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourcejs' defined in class path resource [config/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/pumsdb] is not bound in this Context. Unable to find [jdbc].
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:377)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:278)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.naming.NameNotFoundException: Name [jdbc/pumsdb] is not bound in this Context. Unable to find [jdbc].
at org.apache.naming.NamingContext.lookup(NamingContext.java:819)
at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:92)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at org.apache.naming.NamingContext.lookup(NamingContext.java:842)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
at org.apache.naming.NamingContext.lookup(NamingContext.java:830)
at org.apache.naming.NamingContext.lookup(NamingContext.java:167)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 21 more

3个回答

不是在context.xml里面配置吗,你怎么在server里面配

chenchenchen8023
chenchenchen8023 我查的资料有的在context有的在server我都试过,都不行
大约 3 年之前 回复

我查的资料有的在context有的在server我都试过,都不行

你是不是把jndiOracle这里拼错了???图片说明

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
springmvc+tomcat7+jndi如何配置,我配置老报错用的oracle数据库
我的配置如下: 1、首先在jdbc.properties.xml配置 jnidoracle=java:comp/env/jdbc/pumsdb 2、然后在applicationcontext.xml加载数据源 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="order" value="1"></property> <property name="ignoreUnresolvablePlaceholders" value="true"></property> <property name="locations" value="/WEB-INF/classes/config/jdbc.properties"> </property> </bean> <!-- 数据源定义 --> <bean id="dataSourcejs" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="${jnidoracle}"/> </bean> <!-- 配置Jdbctemplate --> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSourcejs"> <ref bean="dataSourcejs" /> </property> </bean> 3、然后定义tomcat7 jndi全局数据源,在tomcat7 server.xml中配置 <GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/> <resource auth="Container" driverclassname="oracle.jdbc.OracleDriver" maxactive="50" maxidle="10" maxwait="600000" name="jdbc/pumsdb" password="exam" type="javax.sql.DataSource" url="jdbc:oracle:thin:@192.168.8.247:1521/kszx" username="exam" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"></resource> </GlobalNamingResources> 4、在tomcat7 context.xml中配置 <ResourceLink global="jdbc/pumsdb" name="jdbc/pumsdb" type="javax.sql.DataSource"/> 然后运行程序报错报错代码如下 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourcejs' defined in class path resource [config/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/pumsdb] is not bound in this Context. Unable to find [jdbc]. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:377) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:278) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: javax.naming.NameNotFoundException: Name [jdbc/pumsdb] is not bound in this Context. Unable to find [jdbc]. at org.apache.naming.NamingContext.lookup(NamingContext.java:819) at org.apache.naming.NamingContext.lookup(NamingContext.java:167) at org.apache.naming.factory.ResourceLinkFactory.getObjectInstance(ResourceLinkFactory.java:92) at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source) at org.apache.naming.NamingContext.lookup(NamingContext.java:842) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.NamingContext.lookup(NamingContext.java:830) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.NamingContext.lookup(NamingContext.java:830) at org.apache.naming.NamingContext.lookup(NamingContext.java:153) at org.apache.naming.NamingContext.lookup(NamingContext.java:830) at org.apache.naming.NamingContext.lookup(NamingContext.java:167) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:156) at javax.naming.InitialContext.lookup(Unknown Source) at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201) at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) ... 21 more
学习springmvc运行tomcat启动后报错
初学springmvc 自己练习一下最简单的实力 但是报错 下面是错误代码 type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:744) root cause org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/springmvc-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:341) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:744) root cause java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/springmvc-servlet.xml] org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:118) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:328) org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178) org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124) org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93) org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:744) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs. 这里是我的配置文件 web配置 <servlet> <servlet-name>springmvc</servlet-name> <servlet-class> org.springframework.web.servlet.DispatcherServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> springmvc配置 <bean id="testController" name="/hello.do" class="cn.springmvc.TestController"></bean> <!-- 配置视图解析器 ViewResoler --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <!-- 前缀 --> <property name="prefix" value="/WEB-INF/jsp/"></property> <!-- 后缀 --> <property name="suffix" value=".jsp"></property> </bean> 请问大神们 这是什么问题 怎么解决
springmvc中的OpenSessionInViewInterceptor如何配置拦截的路径
springmvc中的OpenSessionInViewInterceptor如何配置拦截的路径? <!-- 开启openSessionInView --> <bean class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor"> <property name="sessionFactory" ref="sessionFactory" /> </bean> 这个配置没有配置拦截的路径啊,我在页面上请求一个js的url,都会去opensession?
springmvc启动tomcat后访问404
配置了个简单的springmvc 以下是我的配置和项目结构。启动tomcat没有报错, 浏览器访问时404 ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495507941_148613.png) ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495507954_560633.png) ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495507964_675435.png) ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495507973_288647.png) ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495507987_409278.png) ![图片说明](https://img-ask.csdn.net/upload/201705/23/1495508003_643901.png) 奇怪的是web.xml我编辑的时候没有报错,编译完输出的部署在tomcat上的这个web.xml有报错,不是很明白求大神帮忙看看 ![报错文件](https://img-ask.csdn.net/upload/201705/23/1495508104_755432.png)
火狐跨域报错,springMVC已配置跨域
浏览器报错:SecurityError: Permission denied to access property "document" on cross-origin object springMVC已配置跨域
springMVC+maven,启动报报JNDI的错误,但我没有用到JNDI
要修改一个项目,用的技术有springMVC,maven等,部署到tomcat下,启动时报错。项目中使用的连接池连接数据库,没有使用JNDI,为什么启动时老是去查找JNDI? applicationContext.xml中定义了项目的环境: <!-- local development环境 --> <beans profile="development"> <context:property-placeholder ignore-resource-not-found="true" location="classpath*:/application.properties" /> <!-- Tomcat JDBC连接池 --> <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close"> <property name="driverClassName" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <property name="defaultAutoCommit" value="false" /> </bean> </beans> ``` ``` pom.xml中设置了spring.profiles.active ``` <!-- jetty插件, 设定context path与spring profile --> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.version}</version> <configuration> <systemProperties> <systemProperty> <name>spring.profiles.active</name> <value>development</value> </systemProperty> </systemProperties> <useTestClasspath>true</useTestClasspath> <webAppConfig> <contextPath>/${project.artifactId}</contextPath> </webAppConfig> </configuration> </plugin> ``` ==========启动日志========== 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletConfigInitParams] 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [servletContextInitParams] 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [jndiProperties] 13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/spring.profiles.active] 13:57:46.586 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/spring.profiles.active] not found - trying original name [spring.profiles.active]. javax.naming.NameNotFoundException: Name spring.profiles.active is not bound in this Context 13:57:46.586 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [spring.profiles.active] 13:57:46.586 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [spring.profiles.active] threw NamingException with message: Name spring.profiles.active is not bound in this Context. Returning null. 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemProperties] 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'spring.profiles.active' in [systemEnvironment] 13:57:46.586 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'spring.profiles.active' in any property source. Returning [null] ..... ...... 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [environmentProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletConfigInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [servletContextInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [jndiProperties] 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.driver] 13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.driver] not found - trying original name [jdbc.driver]. javax.naming.NameNotFoundException: Name jdbc.driver is not bound in this Context 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.driver] 13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.driver] threw NamingException with message: Name jdbc.driver is not bound in this Context. Returning null. 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [systemEnvironment] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.driver' in any property source. Returning [null] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.driver' in [localProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.driver' in [localProperties] with type [String] and value 'com.mysql.jdbc.Driver' 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [environmentProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletConfigInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [servletContextInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [jndiProperties] 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.url] 13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.url] not found - trying original name [jdbc.url]. javax.naming.NameNotFoundException: Name jdbc.url is not bound in this Context 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.url] 13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.url] threw NamingException with message: Name jdbc.url is not bound in this Context. Returning null. 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [systemEnvironment] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.url' in any property source. Returning [null] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.url' in [localProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.url' in [localProperties] with type [String] and value 'jdbc:mysql://127.0.0.1:3306/drolohq?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull' 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [environmentProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletConfigInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [servletContextInitParams] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [jndiProperties] 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/jdbc.username] 13:57:46.836 [main] DEBUG o.s.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/jdbc.username] not found - trying original name [jdbc.username]. javax.naming.NameNotFoundException: Name jdbc.username is not bound in this Context 13:57:46.836 [main] DEBUG o.springframework.jndi.JndiTemplate - Looking up JNDI object with name [jdbc.username] 13:57:46.836 [main] DEBUG o.s.jndi.JndiPropertySource - JNDI lookup for name [jdbc.username] threw NamingException with message: Name jdbc.username is not bound in this Context. Returning null. 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [systemEnvironment] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Could not find key 'jdbc.username' in any property source. Returning [null] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Searching for key 'jdbc.username' in [localProperties] 13:57:46.836 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver - Found key 'jdbc.username' in [localProperties] with type [String] and value 'root'
SpringMVC的web.xml配置
新手刚学会配置springMVC+Mybaties框架我一般就配置这两个web.xml和applicationContext.xml配置文件 数据源、事务、sqlsessionFactory和MVC注解、mybaties注解和视图转发控制器全配置在applicationContext.xml中了! 但是学习别人的项目发现都是一个applicationContext.xml和一个springMVC.xml两个配置文件!这两种配置方式有什么区别啊?配一个好还是配两个好啊?
springmvc项目,pom修改配置文件报错?
在maven的setting文件中配置了profile: ``` <profile> <id>dev</id> <properties> <jdbc.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.driver> <jdbc.url>jdbc:jtds:sqlserver://127.0.0.1:1433;DatabaseName=test</jdbc.url> <jdbc.username>admin</jdbc.username> <jdbc.password>admin123</jdbc.password> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> ``` 在pom的build节点下配置resources,用来将setting中的配置内容动态更新到项目中: ``` <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> <includes> <include>**/*.properties</include> </includes> </resource> </resources> ``` 在mybatis的配置文件中${}使用 ![图片说明](https://img-ask.csdn.net/upload/201902/25/1551084526_311583.png) 发现启动报错: ``` [2019-02-25 04:40:45,069] Artifact ssm:war exploded: Artifact is being deployed, please wait... 25-Feb-2019 16:40:46.745 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 2019-02-25 16:40:47 [INFO]-[org.springframework.web.servlet.DispatcherServlet] FrameworkServlet 'SpringMVC': initialization started 2019-02-25 16:40:47 [INFO]-[org.springframework.web.context.support.XmlWebApplicationContext] Refreshing WebApplicationContext for namespace 'SpringMVC-servlet': startup date [Mon Feb 25 16:40:47 CST 2019]; root of context hierarchy 2019-02-25 16:40:47 [INFO]-[org.springframework.web.servlet.DispatcherServlet] FrameworkServlet 'SpringMVC': initialization completed in 138 ms [2019-02-25 04:40:47,225] Artifact ssm:war exploded: Artifact is deployed successfully [2019-02-25 04:40:47,225] Artifact ssm:war exploded: Deploy took 2,156 milliseconds 2019-02-25 16:40:47 [WARN]-[org.springframework.web.servlet.PageNotFound] No mapping found for HTTP request with URI [/swagger/index.html] in DispatcherServlet with name 'SpringMVC' 2019-02-25 16:40:48 [WARN]-[org.springframework.web.servlet.PageNotFound] No mapping found for HTTP request with URI [/v2/api-docs.do] in DispatcherServlet with name 'SpringMVC' ``` 删除pom的resource配置,启动正常,求解! 该怎么配置?
springmvc配置问题,springmvc到底是怎么使用配置文件的?
``` <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean> <!--配置hander adapater --> <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"></bean> <!--配置渲染器 --> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </bean> <bean name="/hello.do" class="com.sxt.controller.HelloController"></bean> ``` 我知道springmvc要运行起来必须配置这几项,可是不明白springmvc到底是如何执行的,它是如何使用上面的配置,哪位大神能帮忙解释一下?
IDEA17启动SSM(SpringMVC+Spring+Mybatis)项目Tomcat启动报错
之前在运行一个网上下载的SSM(SpringMVC+Spring+Mybatis)论坛DEMO的时候然后就报了下面的错,搜索了很久也找不到原因,今天发现我以前一个整合好的SSM工程也打不开了,还是报同样的错误,我在想是不是Tomcat的配置被改变了还是啥,我重装Tomcat有用吗,或者说有其他的什么解决办法吗,求各位大神 七月 11, 2017 4:39:08 下午 org.apache.catalina.core.ContainerBase addChildInternal 严重: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] Caused by: org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 18 七月 11, 2017 4:39:08 下午 org.apache.tomcat.util.modeler.BaseModelMBean invoke 严重: Exception invoking method manageApp java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] [2017-07-11 04:39:08,888] Artifact SSMtest:war exploded: Error during artifact deployment. See server log for details. 七月 11, 2017 4:39:08 下午 org.apache.tomcat.util.modeler.BaseModelMBean invoke 严重: Exception invoking method createStandardContext javax.management.RuntimeOperationsException: Exception invoking method manageApp Caused by: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
使用SpringMVC 静态资源访问 报错ConversionFailedException
使用的spring 版本是 4.20 在springmvc配置<mvc:resources location="/js/" mapping="/js/**" /> 报错很奇怪。。
springmvc配置表单校验jar包依赖报错
我最近在配置springmvc校验的时候出现了问题,我猜测主要是依赖的问题希望大家帮帮忙。接下来我贴出我的配置 tomcat8+jdk8+spring版本4.3.3.RELEASE 最重要的部分引入校验依赖 ``` <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.2.2.Final</version> </dependency> <!-- 在校验文件中使用el表达式 --> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>2.2.4</version> <scope>provided</scope> </dependency> ``` ![图片说明](https://img-ask.csdn.net/upload/201612/18/1482041265_781261.png) 下面是springmvc.xml里面的配置(其实这个配置应该是没有错的,因为这个配置就算没有报的错也是一样的) ``` <!-- spring mvc验证开始 ,若不使用这种配置,需要将错误信息硬编码到代码里,不易修改--> <!-- 以下 validator ConversionService 在使用 mvc:annotation-driven 会 自动注册--> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"> <property name="providerClass" value="org.hibernate.validator.HibernateValidator"/> <!-- 如果不加默认到 使用classpath下的 ValidationMessages.properties --> <property name="validationMessageSource" ref="messageSource"/> </bean> <!-- 国际化的消息资源文件(本系统中主要用于显示/错误消息定制) --> <bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> <property name="basenames"> <list> <!-- 在web环境中一定要定位到classpath 否则默认到当前web应用下找 --> <value>classpath:validation.properties</value> <value>classpath:org/hibernate/validator/ValidationMessages</value> </list> </property> <property name="useCodeAsDefaultMessage" value="false"/> <property name="defaultEncoding" value="UTF-8"/> <property name="cacheSeconds" value="60"/> </bean> <!-- spring mvc验证结束 --> ``` 接下来是报错信息(我给剪切到一行了) 这里是主要信息 ``` Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#132070ce': Cannot resolve reference to bean 'validator' while setting bean property 'validator'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'validator' defined in URL [file:/E:/Workspaces/Web%20Templet/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/web_homework/WEB-INF/classes/springmvc.xml]: Invocation of init method failed; nested exception is java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence ``` 这里是详细的错误信息 ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Invocation of init method failed; nested exception is java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:751) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1027) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5038) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5348) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2558) at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:859) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.hibernate.validator.internal.util.privilegedactions.LoadClass.loadNonValidatorClass(LoadClass.java:103) at org.hibernate.validator.internal.util.privilegedactions.LoadClass.run(LoadClass.java:64) at org.hibernate.validator.internal.util.privilegedactions.LoadClass.run(LoadClass.java:29) at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.run(DefaultTraversableResolver.java:147) at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.detectJPA(DefaultTraversableResolver.java:67) at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.<init>(DefaultTraversableResolver.java:57) at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:126) at org.hibernate.validator.internal.engine.ConfigurationImpl.<init>(ConfigurationImpl.java:96) at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:31) at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:276) at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:248) at org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean.afterPropertiesSet(OptionalValidatorFactoryBean.java:40) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ... 28 more ``` 希望大家帮帮忙,查询了很多网上的解决办法但是我的配置都和他们说的是一样的但是就是存在这样的问题,自己的能力实在解决不了。只能猜测是jar包依赖的问题但是包又都是全的,所以没有拌饭解决了。
springmvc+mybatis时运行tomcat报错
不知道怎么了,导入maven的ssm项目报这个错,自己手敲一个简单的测试demo都tomcat运行不起来,一直报下面这个错误。求教大神 ``` 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssmNewsList]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ssmNewsList]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@141a76f5] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4992) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [org.apache.catalina.webresources.JarResourceSet@639219b1] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140) at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:721) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: error in opening zip file at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:113) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107) ... 12 more Caused by: java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.jar.JarFile.<init>(JarFile.java:166) at java.util.jar.JarFile.<init>(JarFile.java:103) at org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.initInternal(AbstractSingleArchiveResourceSet.java:110) ... 13 more 三月 15, 2018 3:11:54 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:656) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 三月 15, 2018 3:11:54 下午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.startup.Catalina.start(Catalina.java:656) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more ```
springmvc+mybatis 如何让tomcat启动时就加载所有的controller?
springmvc+mybatis 如何让tomcat启动时就加载所有的controller?
mybatis整合springMVC启动tomcat错误求助
你好在用您提供的代码mybatis和springMVC集成的时候启动tomcat报错不知什么原因![图片说明](https://img-ask.csdn.net/upload/201502/12/1423707486_582407.png) ![图片说明](https://img-ask.csdn.net/upload/201502/12/1423707502_448339.png) ![图片说明](https://img-ask.csdn.net/upload/201502/12/1423707473_282153.png) ![图片说明](https://img-ask.csdn.net/upload/201502/12/1423707485_243904.png) 以上是错误提示!还有一点不明白 mvc-dispatcher-servlet.xml是做什么的里面配置的内容有什么作用,如果方便请加qq603800857谢谢了
maven 管理的springMVC web项目 tomcat没有报错 网页无法显示
是springMVC官网上的hello word例子 pom.xml ``` <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework</groupId> <artifactId>gs-serving-web-content</artifactId> <version>0.1.0</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.0.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <properties> <java.version>1.8</java.version> </properties> <!-- <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> --> </project> ``` ``` package hello; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } } ``` ``` package hello; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @Controller public class GreetingController { @RequestMapping("/greeting") public String greeting(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) { model.addAttribute("name", name); return "greeting"; } } ``` 代码都是粘贴的,避免出错 mvn install success ,运行 tomcat7.0 浏览器输入:http://localhost:8080/greeting 显示404
myeclipse SpringMVC配置文件标签“context:component-scan”报错。
框架使用的是maven+springmvc,配置文件标签“context:component-scan”报错,不影响运行。错误如下: ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656349_538083.jpg) ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656376_439969.jpg) 以下是项目结构: ![图片说明](https://img-ask.csdn.net/upload/201911/25/1574656442_860333.jpg) 请问是我配置有问题还是myeclipse检查错误。有什么办法能解决这个错误,或者屏蔽这个错误。我基本尝试了网上的各种方法,只要项目clean了这个错误就会重新出现。
求助大佬们,springMVC运行启动Tomcat失败报错“子容器启动失败”怎么解决?
相应的版本是Tomcat9.0,jdk10.0,spring5.0。 jar包检查过应该都下载完毕了, 截取部分异常如下 ``` 严重: 子容器启动失败 java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: 初始化组件[org.apache.catalina.webresources.JarResourceSet@35beb15e]失败。 Caused by: org.apache.catalina.LifecycleException: 初始化组件[org.apache.catalina.webresources.JarResourceSet@35beb15e]失败。 Caused by: java.lang.IllegalArgumentException: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature) Caused by: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature) WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.apache.catalina.loader.WebappClassLoaderBase (file:/D:/apache-tomcat-9.0.27/lib/catalina.jar) to field java.io.ObjectStreamClass$Caches.localDescs WARNING: Please consider reporting this to the maintainers of org.apache.catalina.loader.WebappClassLoaderBase WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release ``` web.xml文件中 ``` <url-pattern>/</url-pattern> ``` 求助大神们帮忙,非常感谢!!!
自己写的一个springmvc例子,tomcat启动报错,页面不能跳转,报500错误
这是控制台输出的错误 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\Develop\workplace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\springmvc_1\WEB-INF\classes\com\zbw\springmvc\Handler\HelloWord.class]; nested exception is org.springframework.core.NestedIOException: ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [D:\Develop\workplace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\springmvc_1\WEB-INF\classes\com\zbw\springmvc\Handler\HelloWord.class]; nested exception is java.lang.IllegalArgumentException
springmvc拦截器静态资源配置问题
请问在web.xml配置静态资源的时候允不允许这样子的,我发现有的项目这样子是可以的,但是有些又是不幸的 <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>/resources/*</url-pattern> </servlet-mapping> 上面那种不行用下面的就什么情况都行 <servlet-mapping> <servlet-name>default</servlet-name> <url-pattern>*.css</url-pattern> </servlet-mapping> 其他的配置方式为也知道,也是能成功的,就是想搞明白上面第一种为什么有些可以有些不可以 感谢网友的解答,但是我知道其他的访问静态资源的方法的,我只是想知道为什么 下面的有些项目可以有些不可以,是springmvc的版本问题还是配置问题 servlet-mapping servlet-name default /servlet-name url-pattern /resources/* /url-pattern /servlet-mapping
推荐 130 个令你眼前一亮的网站,总有一个用得着
总结了大学生活两年来,发现的 130 余个黑科技网站,总有一个会让你眼前一亮,赶紧收藏!
在中国程序员是青春饭吗?
今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...
我在支付宝花了1分钟,查到了女朋友的开房记录!
在大数据时代下,不管你做什么都会留下蛛丝马迹,只要学会把各种软件运用到极致,捉奸简直轻而易举。今天就来给大家分享一下,什么叫大数据抓出轨。据史料证明,马爸爸年轻时曾被...
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
20道你必须要背会的微服务面试题,面试一定会被问到
写在前面: 在学习springcloud之前大家一定要先了解下,常见的面试题有那块,然后我们带着问题去学习这个微服务技术,那么就会更加理解springcloud技术。如果你已经学了springcloud,那么在准备面试的时候,一定要看看看这些面试题。 文章目录1、什么是微服务?2、微服务之间是如何通讯的?3、springcloud 与dubbo有哪些区别?4、请谈谈对SpringBoot 和S...
讲真,这两个IDE插件,可以让你写出质量杠杠的代码
周末躺在床上看《拯救大兵瑞恩》 周末在闲逛的时候,发现了两个优秀的 IDE 插件,据说可以提高代码的质量,我就安装了一下,试了试以后发现,确实很不错,就推荐给大家。 01、Alibaba Java 代码规范插件 《阿里巴巴 Java 开发手册》,相信大家都不会感到陌生,其 IDEA 插件的下载次数据说达到了 80 万次,我今天又贡献了一次。嘿嘿。 该项目的插件地址: https://github....
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
阿里面试,面试官没想到一个ArrayList,我都能跟他扯半小时
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
2020 年,大火的 Python 和 JavaScript 是否会被取而代之?
Python 和 JavaScript 是目前最火的两大编程语言,但是2020 年,什么编程语言将会取而代之呢? 作者 |Richard Kenneth Eng 译者 |明明如月,责编 | 郭芮 出品 | CSDN(ID:CSDNnews) 以下为译文: Python 和 JavaScript 是目前最火的两大编程语言。然而,他们不可能永远屹立不倒。最终,必将像其他编程语言一...
史上最全的IDEA快捷键总结
现在Idea成了主流开发工具,这篇博客对其使用的快捷键做了总结,希望对大家的开发工作有所帮助。
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
谁是华为扫地僧?
是的,华为也有扫地僧!2020年2月11-12日,“养在深闺人不知”的华为2012实验室扫地僧们,将在华为开发者大会2020(Cloud)上,和大家见面。到时,你可以和扫地僧们,吃一个洋...
Flutter 会不会被苹果限制其发展?
这个可能性是存在的,而且不止是 flutter、react-native 、weex 、uni-app 、taro 、Hippy等都存在这个风险,虽然有些框架对比起 flutter 其他框架存在时间稍长,但是这不可否认它们一直都存在这个风向。 只要不是平台自己的亲儿子,那么肯定存在被限制发展的风险,所以这件事上是风险和收益之间的博弈,这是一个“后妈和前任之间的太极。” 先说现状 如今各大平台,如:...
Idea 中最常用的10款插件(提高开发效率),一定要学会使用!
学习使用一些插件,可以提高开发效率。对于我们开发人员很有帮助。这篇博客介绍了开发中使用的插件。
AI 没让人类失业,搞 AI 的人先失业了
最近和几个 AI 领域的大佬闲聊 根据他们讲的消息和段子 改编出下面这个故事 如有雷同 都是巧合 1. 老王创业失败,被限制高消费 “这里写我跑路的消息实在太夸张了。” 王葱葱哼笑一下,把消息分享给群里。 阿杰也看了消息,笑了笑。在座几位也都笑了。 王葱葱是个有名的人物,21岁那年以全额奖学金进入 KMU 攻读人工智能博士,累计发表论文 40 余篇,个人技术博客更是成为深度学习领域内风向标。 ...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
最全最强!世界大学计算机专业排名总结!
我正在参与CSDN200进20,希望得到您的支持,扫码续投票5次。感谢您! (为表示感谢,您投票后私信我,我把我总结的人工智能手推笔记和思维导图发送给您,感谢!) 目录 泰晤士高等教育世界大学排名 QS 世界大学排名 US News 世界大学排名 世界大学学术排名(Academic Ranking of World Universities) 泰晤士高等教育世界大学排名 中国共...
作为一名大学生,如何在B站上快乐的学习?
B站是个宝,谁用谁知道???? 作为一名大学生,你必须掌握的一项能力就是自学能力,很多看起来很牛X的人,你可以了解下,人家私底下一定是花大量的时间自学的,你可能会说,我也想学习啊,可是嘞,该学习啥嘞,不怕告诉你,互联网时代,最不缺的就是学习资源,最宝贵的是啥? 你可能会说是时间,不,不是时间,而是你的注意力,懂了吧! 那么,你说学习资源多,我咋不知道,那今天我就告诉你一个你必须知道的学习的地方,人称...
那些年,我们信了课本里的那些鬼话
教材永远都是有错误的,从小学到大学,我们不断的学习了很多错误知识。 斑羚飞渡 在我们学习的很多小学课文里,有很多是错误文章,或者说是假课文。像《斑羚飞渡》: 随着镰刀头羊的那声吼叫,整个斑羚群迅速分成两拨,老年斑羚为一拨,年轻斑羚为一拨。 就在这时,我看见,从那拨老斑羚里走出一只公斑羚来。公斑羚朝那拨年轻斑羚示意性地咩了一声,一只半大的斑羚应声走了出来。一老一少走到伤心崖,后退了几步,突...
一个程序在计算机中是如何运行的?超级干货!!!
强烈声明:本文很干,请自备茶水!???? 开门见山,咱不说废话! 你有没有想过,你写的程序,是如何在计算机中运行的吗?比如我们搞Java的,肯定写过这段代码 public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } ...
【蘑菇街技术部年会】程序员与女神共舞,鼻血再次没止住。(文末内推)
蘑菇街技术部的年会,别开生面,一样全是美女。
Linux必懂知识大总结(补)
关机 1. 数据同步写入磁盘 sync 为了加快对磁盘上文件的读写速度,位于内存中的文件数据不会立即同步到磁盘上,因此关机之前需要先进行 sync 同步操作。 2. shutdown # /sbin/shutdown [-krhc] [时间] [警告讯息] -k : 不会关机,只是发送警告讯息,通知所有在线的用户 -r : 将系统的服务停掉后就重新启动 -h : 将系统的服务停掉后就...
立即提问