Tomcat部署后报空指针异常!

java.lang.NullPointerException
at com.fh.util.Jurisdiction.readMenu(Jurisdiction.java:44)
at com.fh.util.Jurisdiction.hasJurisdiction(Jurisdiction.java:33)
at com.fh.interceptor.LoginHandlerInterceptor.preHandle(LoginHandlerInterceptor.java:31)
at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:134)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:954)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1452)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
之前部署好使过,后来把项目部署到另一个tomcat版本后就这样了。其他机器部署都没有问题。不知道原因在哪,求大神指点。

4个回答

修改了代码加了一个判断解决了,之前都好使,突然报错。一直没把重心放在代码上。

java.lang.NullPointerException
at com.fh.util.Jurisdiction.readMenu(Jurisdiction.java:44)
at com.fh.util.Jurisdiction.hasJurisdiction(Jurisdiction.java:33)
at com.fh.interceptor.LoginHandlerInterceptor.preHandle(LoginHandlerInterceptor.java:31)

LoginHandlerInterceptor应该是你的拦截器吧?找到相应代码,看一下,看是哪里报的空指针

目前的tomcat和之前好使的tomcat配置有什么不同吗?

com.fh.util.Jurisdiction.readMenu(Jurisdiction.java:44)看看你这个44行有什么问题

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
连接oracle时候报空指针异常

try { String className = "oracle.jdbc.driver.OracleDriver"; Class.forName(className); System.out.println("加载数据库驱动成功!"); } catch (ClassNotFoundException e) { System.out.println("加载数据库驱动失败!"); e.printStackTrace(); } try { System.out.println("开始连接数据库"); String user = "sys as sysdba"; String password = "123123"; String url = "jdbc:oracle:thin:@焱:1521:XE"; con = DriverManager.getConnection(url, user, password); System.out.print(con); System.out.println("创建数据库连接成功!"); } catch (SQLException e) { System.out.print(con); System.out.println("创建数据库连接失败!"); con = null; e.printStackTrace(); } 如果直接在类里面使用main函数 获取数据库能够连接成功,取出数据,但是在web页面的servlet中使用DBManager dbm = new DBManager(); 就会报空指针异常 java.lang.NullPointerException java.lang.String.<init>(String.java:166) oracle.sql.CharacterSet.AL32UTF8ToString(CharacterSet.java:1516) oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:588) oracle.jdbc.driver.DBConversion.CharBytesToString(DBConversion.java:541) oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:815) oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:361) oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:413) oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:164) oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:34) oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:752) java.sql.DriverManager.getConnection(DriverManager.java:664) java.sql.DriverManager.getConnection(DriverManager.java:247) util.DBManager.<init>(DBManager.java:33) service.StudentService.stu_Login(StudentService.java:21) MyServlet.LoginPageServlet.doPost(LoginPageServlet.java:35) javax.servlet.http.HttpServlet.service(HttpServlet.java:644) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 最后指向的就是 con = DriverManager.getConnection(url, user, password);这一句连接语句

Tomcat空指针异常,运行startup.up就这样,打不开localhost,没有小猫

![图片说明](https://img-ask.csdn.net/upload/201710/19/1508425385_353730.png)

每天第一次登陆出现空指针异常

<div class="iteye-blog-content-contain" style="font-size: 14px;"> <p>&lt;div class="iteye-blog-content-contain" style="font-size: 14px"&gt;&lt;/div&gt;</p> <p> 用到SPRING SECURITY3项目部署到tomcat下运行,登陆没有出问题,到第二天第一次登陆,出现空指针异常,返回后重新登陆,没问题;第三天第一次登陆问题又出现;发现只有没天第一次登陆会出现问题;错误如下</p> <p>type Exception report<br><br>message<br><br>description The server encountered an internal error () that prevented it from fulfilling this request.<br><br>exception<br><br>java.lang.NullPointerException<br>    org.pmp.dao.admin.BaseDAO.getInstance(BaseDAO.java:215)<br>    org.pmp.dao.impl.admin.UserDAO.getUserByUsername(UserDAO.java:83)<br>    org.pmp.security.MyUserDetailsService.loadUserByUsername(MyUserDetailsService.java:35)<br>    org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser<br><br>(DaoAuthenticationProvider.java:83)<br>    org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate<br><br>(AbstractUserDetailsAuthenticationProvider.java:125)<br>    org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:121)<br>    org.springframework.security.authentication.AbstractAuthenticationManager.authenticate<br><br>(AbstractAuthenticationManager.java:49)<br>    org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:139)<br>    org.springframework.security.authentication.AbstractAuthenticationManager.authenticate<br><br>(AbstractAuthenticationManager.java:49)<br>    org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication<br><br>(UsernamePasswordAuthenticationFilter.java:98)<br>    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter<br><br>(AbstractAuthenticationProcessingFilter.java:200)<br>    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)<br>    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106)<br>    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)<br>    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter<br><br>(SecurityContextPersistenceFilter.java:80)<br>    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356)<br>    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150)<br>    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)<br>    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)<br>    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)<br>    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)<br><br>note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.</p> </div>

tomcat访问项目出现异常

启动没有报错,在访问8080页面以及项目时出现异常。 8080界面报500异常![图片说明](https://img-ask.csdn.net/upload/201711/28/1511860172_593163.png) 访问自己的项目时,则报出404异常,项目已部署到tomcat中,之前也正常打开过。 百度上面找到的两个解决方法没有用,一个说catalina.jar的冲突,在项目的lib下没有找到所说的追加的catalina.jar;另一个说在context.xml中context元素下追加Loader delegate="true" 也没有效果。 把自己的项目删除在访问8080也失败。

spring boot 整合swagger项目放到tomcat的webapps目录下启动的时候报空指针警告有谁知道原因么.

spring boot 整合swagger项目放到tomcat的webapps目录下启动的时候报空指针警告有谁知道原因么 ``` 01-Mar-2019 17:14:11.104 信息 [localhost-startStop-2] 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. . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.0.RELEASE) 2019-03-01 17:14:12.638 INFO 5924 --- [ost-startStop-2] o.d.DaacApplication : Starting DaacApplication v1.0 on LAPTOP-KE1PBAT8 with PID 5924 (E:\tomcat\apache-tomcat-8.5.34\webapps\devicemgmtservice\WEB-INF\classes started by 93999 in E:\tomcat\apache-tomcat-8.5.34\bin) 2019-03-01 17:14:12.652 INFO 5924 --- [ost-startStop-2] o.d.DaacApplication : No active profile set, falling back to default profiles: default 2019-03-01 17:14:12.713 INFO 5924 --- [ost-startStop-2] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7f03a74a: startup date [Fri Mar 01 17:14:12 CST 2019]; root of context hierarchy 2019-03-01 17:14:14.779 INFO 5924 --- [ost-startStop-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2019-03-01 17:14:14.959 INFO 5924 --- [ost-startStop-2] o.s.w.c.ContextLoader : Root WebApplicationContext: initialization completed in 2246 ms 2019-03-01 17:14:15.342 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2019-03-01 17:14:15.344 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2019-03-01 17:14:15.345 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'errorPageFilter' to: [/*] 2019-03-01 17:14:15.345 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2019-03-01 17:14:15.345 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2019-03-01 17:14:15.345 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2019-03-01 17:14:15.345 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.FilterRegistrationBean : Mapping filter: 'crosLoginFilter' to: [/*] 2019-03-01 17:14:16.401 INFO 5924 --- [ost-startStop-2] o.m.d.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} 2019-03-01 17:14:16.551 INFO 5924 --- [localhost:27017] o.m.d.connection : Opened connection [connectionId{localValue:1, serverValue:9}] to localhost:27017 2019-03-01 17:14:16.560 INFO 5924 --- [localhost:27017] o.m.d.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 6, 9]}, minWireVersion=0, maxWireVersion=6, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=5620687} 2019-03-01 17:14:17.765 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/notify/{deviceId}/{swVersion}],methods=[GET]}" onto public org.daac.version.pojo.response.NotifyResponse org.daac.version.controller.DeviceController.notify(java.lang.String,java.lang.String) 2019-03-01 17:14:17.785 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/devices/{pageIndex}/{pageSize}],methods=[GET]}" onto public org.daac.version.pojo.response.DeviceResponse org.daac.version.controller.DeviceController.getDevices(java.lang.String,java.lang.String) 2019-03-01 17:14:17.785 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/update/{deviceId}],methods=[POST]}" onto public void org.daac.version.controller.DeviceController.opUpdate(java.lang.String,org.daac.version.pojo.request.UpdateRequest) 2019-03-01 17:14:17.786 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/target],methods=[POST]}" onto public void org.daac.version.controller.DeviceController.opUpdate(org.daac.version.pojo.request.TarGetRequest) 2019-03-01 17:14:17.787 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/devices/id/{pageIndex}/{pageSize}],methods=[GET]}" onto public org.daac.version.pojo.response.DevicesResponse org.daac.version.controller.DeviceController.findId(java.lang.String,java.lang.String) 2019-03-01 17:14:17.788 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/target],methods=[GET]}" onto public org.daac.version.pojo.response.TarGetResponse org.daac.version.controller.DeviceController.getUpdate() 2019-03-01 17:14:17.789 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/reset/{deviceId}],methods=[POST]}" onto public void org.daac.version.controller.DeviceController.opReset(java.lang.String) 2019-03-01 17:14:17.789 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/cfgUpdate/{deviceId}],methods=[GET]}" onto public org.daac.version.pojo.response.CfgUpdateResponse org.daac.version.controller.DeviceController.cfgUpdate(java.lang.String) 2019-03-01 17:14:17.790 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/device/heartBeat],methods=[POST]}" onto public void org.daac.version.controller.DeviceController.heartBeat(org.daac.version.pojo.request.FeedBackRequest) 2019-03-01 17:14:17.799 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/ui]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.UiConfiguration> springfox.documentation.swagger.web.ApiResourceController.uiConfiguration() 2019-03-01 17:14:17.802 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources]}" onto public org.springframework.http.ResponseEntity<java.util.List<springfox.documentation.swagger.web.SwaggerResource>> springfox.documentation.swagger.web.ApiResourceController.swaggerResources() 2019-03-01 17:14:17.807 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/swagger-resources/configuration/security]}" onto public org.springframework.http.ResponseEntity<springfox.documentation.swagger.web.SecurityConfiguration> springfox.documentation.swagger.web.ApiResourceController.securityConfiguration() 2019-03-01 17:14:17.816 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-03-01 17:14:17.820 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2019-03-01 17:14:18.136 INFO 5924 --- [ost-startStop-2] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)] 2019-03-01 17:14:18.793 INFO 5924 --- [ost-startStop-2] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7f03a74a: startup date [Fri Mar 01 17:14:12 CST 2019]; root of context hierarchy 2019-03-01 17:14:18.956 INFO 5924 --- [ost-startStop-2] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-03-01 17:14:18.956 INFO 5924 --- [ost-startStop-2] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-03-01 17:14:19.054 INFO 5924 --- [ost-startStop-2] o.s.w.s.h.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-03-01 17:14:19.125 WARN 5924 --- [ost-startStop-2] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration) 2019-03-01 17:14:19.529 INFO 5924 --- [ost-startStop-2] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-03-01 17:14:19.544 INFO 5924 --- [ost-startStop-2] o.s.c.s.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2019-03-01 17:14:19.544 INFO 5924 --- [ost-startStop-2] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed 2019-03-01 17:14:19.621 INFO 5924 --- [ost-startStop-2] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) 2019-03-01 17:14:19.709 INFO 5924 --- [ost-startStop-2] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references 2019-03-01 17:14:20.035 INFO 5924 --- [ost-startStop-2] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: opUpdateUsingPOST_1 2019-03-01 17:14:20.105 INFO 5924 --- [ost-startStop-2] o.d.DaacApplication : Started DaacApplication in 8.215 seconds (JVM running for 360.081) 2019-03-01 17:14:20.123 INFO 5924 --- [ost-startStop-2] o.d.ServletInitializer : Root context already created (using as parent). . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.0.RELEASE) 2019-03-01 17:14:20.209 INFO 5924 --- [ost-startStop-2] o.d.ServletInitializer : No active profile set, falling back to default profiles: default 2019-03-01 17:14:20.216 INFO 5924 --- [ost-startStop-2] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@39e599cc: startup date [Fri Mar 01 17:14:20 CST 2019]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7f03a74a 2019-03-01 17:14:21.031 INFO 5924 --- [ost-startStop-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2019-03-01 17:14:21.103 INFO 5924 --- [ost-startStop-2] o.s.w.c.ContextLoader : Root WebApplicationContext: initialization completed in 887 ms 2019-03-01 17:14:21.149 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.RegistrationBean : Filter errorPageFilter was not registered (possibly already registered?) 2019-03-01 17:14:21.149 INFO 5924 --- [ost-startStop-2] o.s.b.w.s.RegistrationBean : Filter crosLoginFilter was not registered (possibly already registered?) 2019-03-01 17:14:21.764 INFO 5924 --- [ost-startStop-2] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)] 2019-03-01 17:14:22.182 INFO 5924 --- [ost-startStop-2] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-03-01 17:14:22.186 INFO 5924 --- [ost-startStop-2] o.s.c.s.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2019-03-01 17:14:22.191 INFO 5924 --- [ost-startStop-2] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed 2019-03-01 17:14:22.192 INFO 5924 --- [ost-startStop-2] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) 2019-03-01 17:14:22.215 INFO 5924 --- [ost-startStop-2] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references 2019-03-01 17:14:22.224 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.CfgUpdateResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.CfgUpdateResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.227 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.CfgUpdateResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.CfgUpdateResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.233 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.DevicesResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.DevicesResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.234 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.DevicesResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.DevicesResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.243 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.DeviceResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.DeviceResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.248 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.DeviceResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.DeviceResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.252 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.TarGetResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.TarGetResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.253 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.TarGetResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.TarGetResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.261 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.FeedBackRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.FeedBackRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.263 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.FeedBackRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.FeedBackRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.296 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.NotifyResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.NotifyResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.297 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.response.NotifyResponse) -> ModelContext{groupName=default, type=org.daac.version.pojo.response.NotifyResponse, isReturnType=true}. java.lang.NullPointerException 2019-03-01 17:14:22.306 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.TarGetRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.TarGetRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.308 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.TarGetRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.TarGetRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.313 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.UpdateRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.UpdateRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.317 WARN 5924 --- [ost-startStop-2] s.d.s.p.CachingModelPropertiesProvider : Exception calculating properties for model(org.daac.version.pojo.request.UpdateRequest) -> ModelContext{groupName=default, type=org.daac.version.pojo.request.UpdateRequest, isReturnType=false}. java.lang.NullPointerException 2019-03-01 17:14:22.322 INFO 5924 --- [ost-startStop-2] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: opUpdateUsingPOST_1 2019-03-01 17:14:22.334 INFO 5924 --- [ost-startStop-2] o.d.ServletInitializer : Started ServletInitializer in 2.209 seconds (JVM running for 362.311) 01-Mar-2019 17:14:22.353 信息 [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [E:\tomcat\apache-tomcat-8.5.34\webapps\devicemgmtservice] has finished in [19,539] ms ```

大哥们来帮忙看下空指针异常的问题

相信大哥们这样的高手都知道有个系统叫跑步社区,就是在线交友的社区,我弄到一个这样的系统 用myeclipse部署tomcat运行后 之前我在数据库中插入了一个用户,然后进入登陆页面进行登陆,点击登陆之后报空指针异常:是在memberServiceImple.loginMemberinfo里的面报错 还有memberAction.login处 然后我打开注册页面按要求进行填写注册用户,但是在点击注册之后又报空指针异常java.lang.NullPointerException com.briup.run.service.impl.MemberServiceImpl.registerMemberinfo(MemberServiceImpl.java:156) com.briup.run.web.action.MemberAction.register(MemberAction.java:375) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 然后我把之前的数据库删除 重新建的数据库 建表 然后又插入memberinfo表一条记录 这一次进行登陆 都提示我“没有这个用户”。。然后我进入注册页面注册 依然报空指针异常 java.lang.NullPointerException com.briup.run.service.impl.MemberServiceImpl.registerMemberinfo(MemberServiceImpl.java:156) com.briup.run.web.action.MemberAction.register(MemberAction.java:375) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 看了网上的关于空指针异常的解决办法 但是自己还是不会(确实比较笨) 有谁知道接下来我该怎么调 教教小弟 感激不尽 要是这样不方便解决可以加求求指导我更好了

javamail api接收文件main方法可以,部署到tomcat后,异常

自己写了javamail的收邮件程序,且通过收邮件类的main方法测试成功,能收到所有邮件,但是将此类加入到web应用中后,部署到tomcat,然后通过页面请求后,也能获得message的条数,但是在转化成Part后,就java.lang.NullPointerException,异常了。 Properties props = System.getProperties(); props.put("mail.store.protocol","imap"); props.put("mail.imap.host","imap.163.com"); props.put("mail.imap.auth.plain.disable","true"); try { Session mailsession=Session.getInstance(props,null); mailsession.setDebug(false); //是否启用debug模式 IMAPFolder folder= null; IMAPStore store=null; store=(IMAPStore)mailsession.getStore("imap"); // 使用imap会话机制,连接服务器 store.connect("mail.163.com","azc118116@163.com","azc1181161"); folder=(IMAPFolder)store.getFolder("INBOX"); //收件箱 folder.open(Folder.READ_WRITE); Message message[] = folder.getMessages(); int unreadcount=folder.getUnreadMessageCount(); int newmailcount=folder.getNewMessageCount(); int total=folder.getMessageCount(); int p=0; MailRecive pmm = null; for(int i=0;i<total;i++) { pmm = new MailRecive((MimeMessage) message[i]); // 获得邮件内容=============== pmm.getMailContent((Part) message[i]); pmm.setAttachPath("d:/bossinmail"); pmm.saveAttachMent((Part) message[i]); } 以上代码在类的main函数中独立运行无问题,但是部署到tomcat后,就在 pmm.getMailContent((Part) message[i]); 这句话报空指针异常了。请各位大侠帮忙解决!~谢谢 详细代码请参考 https://code.csdn.net/snippets/221501 https://code.csdn.net/snippets/221516 备注:web框架使用的是struts2

tomcat启动异常

我在MyEclipse里面部署一个项目时,启动tomcat正常,当在流浪器里访问这个项目时,然后MyEclipse控制台上就打印出下面的句子: [color=red]信息: Server startup in 1096 ms 2012-8-11 23:28:52 org.apache.catalina.core.ApplicationContext log 信息: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost' 2012-8-11 23:28:52 org.apache.catalina.core.ApplicationContext log 信息: HTMLManager: init: Global resources are available 2012-8-11 23:28:52 org.apache.catalina.core.ApplicationContext log 信息: HTMLManager: list: Listing contexts for virtual host 'localhost'[/color] 奇怪的时,项目也能正常访问。我后来把所有的项目都delete,tomcat的webapps下面就只有自带的几个资料夹,访问tomcat的manager页面时还是打印出那些信息。 这是什么问题啊。 我的tomact是解压版的,环境变量都配好了,MyEclipse都能正常使用。求指点迷津,非常感谢

部署到websphere6.1,自定义500页面输出的异常信息与tomcat不同?

环境是spring3.2.4,分别部署在tomcat6和websphere6.1 500.jsp,打印异常堆栈内容代码如下: Java代码 收藏代码 [code="java"] <div> 错误堆栈信息:<br/> <c:forEach var="trace" items="${pageContext.exception.stackTrace}"> <p>${trace}</p> </c:forEach> </div> [/code] 我在action故意制造了一个空指针异常 在tomcat中自动进入到了500.jsp并显示错误信息如下: [code="java"] 错误堆栈信息: com.cmcc.foura.login.action.LoginAction.registUser(LoginAction.java:68) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64) ...... [/code] 但是在websphere6.1中错误信息变成了这样: Java代码 收藏代码 [code="java"] 错误堆栈信息: org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) javax.servlet.http.HttpServlet.service(HttpServlet.java:763) ..... [/code] 不知道为什么,请遇到过的朋友帮忙解答,谢谢了

java里面poi导出excel报404

![图片说明](https://img-ask.csdn.net/upload/201706/10/1497075781_428695.png) 我在我的电脑上运行可以导出,但是我上传到服务器以后我的同事是没法导出的,就我自己可以正常使用,这是我同事报的错,求大神帮帮忙!!!!!

spring获取不到在线用户数,列表为空,getAllPrincipals()获取不到

XML是照着文档编写的,启动也没报错![图片说明](https://img-ask.csdn.net/upload/201510/21/1445393044_736599.png) ``` <custom-filter position="CONCURRENT_SESSION_FILTER" ref="concurrencyFilter" /> <!-- 增加一个自定义的filter,放在FILTER_SECURITY_INTERCEPTOR之前, 实现用户、角色、权限、资源的数据库管理。 --> <custom-filter ref="myFilter" before="FILTER_SECURITY_INTERCEPTOR"/> <session-management invalid-session-url="/jsp/common/sessionTimeout.jsp" session-authentication-strategy-ref="sas"/> <beans:bean id="concurrencyFilter" class="org.springframework.security.web.session.ConcurrentSessionFilter"> <beans:property name="sessionRegistry" ref="sessionRegistry" /> <beans:property name="expiredUrl" value="/jsp/common/session-expired.jsp" /> <beans:property name="logoutHandlers"> <beans:list> <beans:ref local="logoutHandler"/> </beans:list> </beans:property> </beans:bean> <!-- 注销监听器 --> <beans:bean id="logoutHandler" class="org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler"> <beans:property name="InvalidateHttpSession" value="true" /> </beans:bean> <beans:bean id="sas" class="org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy"> <beans:constructor-arg name="sessionRegistry" ref="sessionRegistry" /> <beans:property name="maximumSessions" value="1" /> </beans:bean> <beans:bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/> ``` 然后写了一个controller,方法如下 ``` @Autowired PermissionService permissionService; @Autowired @Qualifier("sessionRegistry") SessionRegistry sessionRegistry; //@Resource(name="sessionRegistry") ///private SessionRegistryImpl sessionRegistry; /** * 强制让用户下线 * @throws Exception */ @RequestMapping("/shotOff") @ResponseBody public Map<String, Object> shotOff(String username) throws Exception{ Map<String, Object> map = new HashMap<String, Object>(); SysUsersCustom sysUsersCustom = new SysUsersCustom(); sysUsersCustom.setUserAccount(username); SysUsersCustom users = permissionService.selectLoginerInfoByUserAccount(sysUsersCustom, username); //用户列表 List<Object> userList=sessionRegistry.getAllPrincipals(); for(int i=0; i<userList.size(); i++){ User userTemp=(User) userList.get(i); if(userTemp.getUsername().equals(username)) { List<SessionInformation> sessionInformationList = sessionRegistry.getAllSessions(userTemp, false); if (sessionInformationList!=null) { for (SessionInformation sis : sessionInformationList) { sis.expireNow(); sessionRegistry.removeSessionInformation(sis.getSessionId()); String remark=userTemp.getUsername()+"被管理员"+Common.findAuthenticatedUsername()+"踢出"; //loginLogService.logoutLog(userTemp, sessionId, remark); //记录注销日志和减少在线用户1个 //logger.info(userTemp.getId()+" "+userTemp.getName()+"用户会话销毁," + remark); System.out.print(remark); } map.put("status", "y"); map.put("info", "强制下线成功!"); }else{ map.put("status", "n"); map.put("info", "用户会话信息不存在!"); } }else{ map.put("status", "n"); map.put("info", "记录表中不存在当前用户!"); } } return map; } ``` 但sessionRegistry.getAllPrincipals()一直获取不到在线用户数,不知道问题出在哪里

我用eclipse写的web项目,为什么自己打开就报500异常,用别人的电脑打开就能正常打开?

都是用eclipse,用的tomcat的都是一样的版本,同样的代码,我给别人导入项目之后在发给我又可以打开了,不会报500,这要怎么解决

ideaWeb项目页面向控制器传值时报404

错误翻译成中文是:原始服务器没有找到目标资源的当前表示,或者不愿意透露该目录存在

java web项目本地运行正常发布到阿里云服务器上之后出错

``` <%@ page language="java" import="java.util.*,db.DBLink,java.sql.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% DBLink db=new DBLink("my_test_db"); Connection con=db.getDefaultCon(); Statement sta=con.createStatement(); ResultSet rs=sta.executeQuery("select * from users"); if(rs.next()){ out.print(rs.getString(1)+" "+rs.getString(2)); } %> </body> </html> //数据库连接 DBLink.java package db; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; public class DBLink { Connection con; Statement sta; ResultSet rs; PreparedStatement psta; ResultSetMetaData rsm; //119.23.240.242 private String user = null, pwd = null, dataBaseName = "my_test_db", id = "localhost", port = "3306"; public DBLink(String dataBaseName) { this.user = "root"; this.pwd = "abc"; this.dataBaseName = dataBaseName; try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { } } public Connection getDefaultCon() { String uri = "jdbc:mysql://localhost:3306/" + dataBaseName+"?useUnicode=true&characterEncoding=utf-8&useSSL=false"; setUser("root"); setPwd("lfy"); try { con = DriverManager.getConnection(uri, "root", "abc"); return con; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } } ``` java web在本地可以正常运行 ![图片说明](https://img-ask.csdn.net/upload/201706/30/1498784601_196563.png) 但是发布到阿里云服务器上就不能运行 ![图片说明](https://img-ask.csdn.net/upload/201706/30/1498784682_119043.png) 错误信息: HTTP Status 500 - An exception occurred processing JSP page /index.jsp at line 27 type Exception report message An exception occurred processing JSP page /index.jsp at line 27 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 27 24: <% 25: DBLink db=new DBLink("my_test_db"); 26: Connection con=db.getDefaultCon(); 27: Statement sta=con.createStatement(); 28: ResultSet rs=sta.executeQuery("select * from users"); 29: if(rs.next()){ 30: out.print(rs.getString(1)+" "+rs.getString(2)); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:567) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:469) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NullPointerException org.apache.jsp.index_jsp._jspService(index_jsp.java:126) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.18 logs.

使用SpringMVC+Mybatis时,无法注入service

spring-mvc.xml中如下: <context:component-scan base-package="com.lyj" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" /> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" /> </context:component-scan> 我明明扫描了所有的包为什么还是找不到,出现如下异常: 九月 03, 2017 4:41:52 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Allocate exception for servlet spring org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.lyj.bookmanage.service.IUserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)} ![这是service](https://img-ask.csdn.net/upload/201709/03/1504428188_856272.png) ![这是controller](https://img-ask.csdn.net/upload/201709/03/1504428266_436346.png)

利用十一假期做了两个J2EE小项目,遇到了个小问题,向大家询问!

&nbsp; 利用十一20多天的BT假期,做了两个小项目。开发环境是myeclipse+sqlserver2000+tomcat6.0,利用的jdbc odbc桥连接数据库,账号sa,密码admin.第一个项目myshopping完全独立做的,第二个项目mybbs静态代码是从清华大学出版的《JSP动态开发实录》书拷贝的,这里声明下并没有进行任何商业用途从而或得利益数据库也是书上的,动态代码完全自己独立编写。 <br />&nbsp; 说下我出现的问题,我的项目是用myeclipse编写的,程序方面应该没问题,如果用在myeclipse下部署的外部或者内部tomcat都可以对其页面进行正常访问,但是如果项目离开myeclipse的话,直接使用tomcat进行访问,就会发生错误,观察下错误都是是javabean的返回值出现了空值现象,也就是说,可以调用javabean,也可以找到其中的方法,但是问题发生在,只要方法里面的程序有返回值,结果总是返回空值。 <br />&nbsp;&nbsp; 希望对这个问题有兴趣的朋友们能够帮助我下,本人新手,这学期才开的JSP和数据库,算下学习时间不到一个半月,所以代码写的也是很差,希望高手多批评指教! <br />&nbsp;&nbsp;&nbsp; 我把项目正常运行和出现错误的图像都贴出来,麻烦有时间的高手请指教下!<br /><strong>问题补充:</strong><br />&nbsp;&nbsp;&nbsp;&nbsp; 先解释下,我的数据库链接应该没问题,使用的是“过时”的JDBC-ODBC链接的,昨晚我也使用了JDBC直接访问数据库,把其jar包放在了lib文件夹中,其结果和JDBC-ODBC方式是一样的。至于目录结构,我直接使用了myeclipse打包成的war包,放在tomcat中,如果直接在myeclipse中启动tomcat,可以正常访问页面,但如果离开了myeclipse,结果就会出现空指针异常,至于刚才蔡华江前辈说的JDK不一致问题。我的电脑里面就一个JDK1.6额。 <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对于treblesoftware前辈说的我贬低了J2EE问题,以后我会注意的。像这样的问题应该说成是JSP+JAVAbean? <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wendal前辈质疑我没有利用框架的问题---我这学期才开的JSP和数据库,算下才接触了一个多月,因此没来得及学习SSH,现在正在学SERVLET。等寒假的时候会自学下SSH。然后做个项目出来的! <br /> <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 可能我的问题是比较幼稚的错误,但我想这些都是我编程到来上面的必修课吧!&nbsp;&nbsp; <br /><strong>问题补充:</strong><br />&nbsp;&nbsp;&nbsp;&nbsp; sunlightcs 的要求---出来JAVAeye貌似我把帖子发错去了论坛,在那里面我已经把错误图片贴了出来,等我正常访问的图片和出错的贴出来的。 <br />&nbsp;&nbsp; <br /><strong>问题补充:</strong><br />&nbsp;&nbsp; <span style="color: red">---myeclipse启动的tomcat可不是1.6的JDK,试着在将tomcat的启动jdk改为myeclipse的jdk。---</span> <br />&nbsp;&nbsp; 我感觉好像应该是像您所说的这个问题,但是我没找到把tomcat中的JDK改成Myeclipse的JDK方法额,是在tomcat目录下conf目录中的web.xml文件作修改么?<br /><strong>问题补充:</strong><br /><span style="color: red">---你这应该是没有连接上数据库了。---</span> <br /> <br />&nbsp;&nbsp;&nbsp; 但是为什么同样的代码同样的目录在myeclipse中启动tomcat就可以了?而离开myeclipse就出现那个错误?我用的是JDBC-ODBC连接方式,是不是不需要JDBCSQLSERVER jar包?<br /><strong>问题补充:</strong><br />&nbsp;&nbsp; 多谢这么多前辈的热心回答。虽然我还没有调试出来,但是感觉离问题的答案越来越近了,谢谢!!

用ssm框架做的项目,用浏览器登录后点击目录,点一次没有错,点第二次就报错。

求教大神帮忙看看,感激不尽!!!! 严重: Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is com.google.gson.JsonSyntaxException: java.lang.NumberFormatException: empty String] with root cause java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source) at sun.misc.FloatingDecimal.parseDouble(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at com.google.gson.stream.JsonReader.nextInt(JsonReader.java:1201) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:225) at com.google.gson.internal.bind.TypeAdapters$7.read(TypeAdapters.java:217) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:129) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:220) at com.google.gson.Gson.fromJson(Gson.java:887) at com.google.gson.Gson.fromJson(Gson.java:852) at com.google.gson.Gson.fromJson(Gson.java:801) at com.google.gson.Gson.fromJson(Gson.java:773) at com.edu.controller.SyllabusController.queryList(SyllabusController.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)

项目做成jar包给另一个项目使用,但是另一个项目引用该jar的时候出现问题

一个web项目做成jar包给另一个web项目使用,但是另一个项目引用该jar的时候出现问题,tomcat可以启动,但是网页访问报404,如果把jar去掉,项目是正常的,做成jar包的项目本身没有问题,现在是做成jar的时候有问题还是引用的时候有问题,我使用eclipse中的export将项目制作成jar包的,选择的也是默认的设置选择项,求大神解

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

立即提问
相关内容推荐