.net core如何解密.net framework System.Web.Security.MachineKey.Protect()加密的密文?

最近在做.net framework到.net core的代码重构,然后发现.net core里面已经没有System.Web.Security.MachineKey.Protect()这个方法了,取而代之的是IDataProtector

以前的.net framework的数据通过System.Web.Security.MachineKey.Protect()进行加密,
对应的web.config配置如下:

<!-- DEV & QA -->

加密后的密文如下:
QEfVpMPsSbAD6V3w5NnSWCi4uHnvHjvHtSJsuNYi+GqnYRT1R9TJSS5hxHFq3a+4NuR9UPjlBbgsoj7lRk08PajDLFM=

machineKey validationKey="xxxxx" decryptionKey="xxxxxxxx" validation="SHA1" decryption="3DES

validationKey,decryptionKey都有,如何能在.net core中通过相应的validationKey,decryptionKey把上述的密文正确解密出来~

求大神帮助~

1个回答

通过反编译.net的源码已经把问题解决了

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

CloseableHttpClient使用一段时间后报错无法继续运行 org.apache.http.conn.ConnectTimeoutException: Connect to *:443 [/222.211.64.93] failed: connect timed out at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:143) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220) Caused by: java.net.SocketTimeoutException: connect timed out at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:337) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) ... 12 more javax.net.ssl.SSLHandshakeException: server certificate change is restricted during renegotiation at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:220)

Spring boot在启动时报错Could not find class [org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration]?

Spring boot启动报错,如下: java.lang.IllegalArgumentException: Could not find class [org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:327) at org.springframework.core.annotation.TypeMappedAnnotation.adapt(TypeMappedAnnotation.java:483) at org.springframework.core.annotation.TypeMappedAnnotation.getValue(TypeMappedAnnotation.java:403) at org.springframework.core.annotation.TypeMappedAnnotation.asMap(TypeMappedAnnotation.java:288) at org.springframework.core.annotation.AbstractMergedAnnotation.asAnnotationAttributes(AbstractMergedAnnotation.java:193) at org.springframework.core.type.AnnotatedTypeMetadata.getAnnotationAttributes(AnnotatedTypeMetadata.java:106) at org.springframework.context.annotation.AnnotationConfigUtils.attributesFor(AnnotationConfigUtils.java:285) at org.springframework.context.annotation.AnnotationBeanNameGenerator.determineBeanNameFromAnnotation(AnnotationBeanNameGenerator.java:100) at org.springframework.context.annotation.AnnotationBeanNameGenerator.generateBeanName(AnnotationBeanNameGenerator.java:79) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.registerBeanDefinitionForImportedConfigurationClass(ConfigurationClassBeanDefinitionReader.java:160) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:337) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:152) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:132) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:92) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:172) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:743) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:719) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1720) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:287) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.ClassNotFoundException: org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1360) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.springframework.util.ClassUtils.forName(ClassUtils.java:277) at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:317) ... 69 common frames omitted 我的maven配置文件pom.xml部分内容是: ``` <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <!-- 移除嵌入式tomcat插件 --> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <!-- 添加servlet依赖--> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <!--<scope>provided</scope>--> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> <exclusions> <exclusion> <groupId>org.junit.vintage</groupId> <artifactId>junit-vintage-engine</artifactId> </exclusion> </exclusions> </dependency> ``` 请教大神们,为什么会出现这个错误?

tomcat启动报错有没有大佬啊

29-Oct-2018 13:25:42.084 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.startup.ContextConfig.beforeStart Exception fixing docBase for context [/SaleWeb] java.io.IOException: Unable to create the directory [C:\Program Files\Java\apache-tomcat-8.5.34-windows-x64\apache-tomcat-8.5.34\webapps\SaleWeb] at org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:115) at org.apache.catalina.startup.ContextConfig.fixDocBase(ContextConfig.java:605) at org.apache.catalina.startup.ContextConfig.beforeStart(ContextConfig.java:738) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:301) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:395) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:149) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1736) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 29-Oct-2018 13:25:49.114 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SaleWeb]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1736) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.SAXParserFactory cannot be created at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:311) at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:267) at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:127) at org.apache.tomcat.util.digester.Digester.getFactory(Digester.java:476) at org.apache.tomcat.util.digester.Digester.getParser(Digester.java:667) at org.apache.tomcat.util.descriptor.web.WebXmlParser.<init>(WebXmlParser.java:62) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1094) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:765) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 42 more Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.SAXParserFactory cannot be created at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:308) ... 53 more Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Error reading configuration file at java.util.ServiceLoader.fail(ServiceLoader.java:232) at java.util.ServiceLoader.parse(ServiceLoader.java:309) at java.util.ServiceLoader.access$200(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:357) at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393) at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474) at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293) at java.security.AccessController.doPrivileged(Native Method) at javax.xml.parsers.FactoryFinder.findServiceProvider(FactoryFinder.java:289) ... 53 more Caused by: java.nio.file.AccessDeniedException: C:\Program Files\Java\apache-tomcat-8.5.34-windows-x64\apache-tomcat-8.5.34\temp\jar_cache3970113899978455754.tmp at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230) at java.nio.file.Files.newByteChannel(Files.java:361) at java.nio.file.Files.createFile(Files.java:632) at java.nio.file.TempFileHelper.create(TempFileHelper.java:138) at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:161) at java.nio.file.Files.createTempFile(Files.java:897) at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:218) at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:216) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:215) at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:71) at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:109) at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:122) at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:152) at java.net.URL.openStream(URL.java:1045) at java.util.ServiceLoader.parse(ServiceLoader.java:304) ... 60 more 29-Oct-2018 13:25:49.124 严重 [RMI TCP Connection(2)-127.0.0.1] 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[/SaleWeb]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1736) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [2018-10-29 01:25:49,244] Artifact Gradle : SaleWeb.war: Error during artifact deployment. See server log for details. 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 29-Oct-2018 13:25:49.126 严重 [RMI TCP Connection(2)-127.0.0.1] org.apache.tomcat.util.modeler.BaseModelMBean.invoke Exception invoking method createStandardContext javax.management.RuntimeOperationsException: Exception invoking method manageApp at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:308) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:483) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:432) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829) 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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357) at sun.rmi.transport.Transport$1.run(Transport.java:200) at sun.rmi.transport.Transport$1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SaleWeb]] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:758) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1736) 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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) ... 33 more

spring security添加数据 小问题

2017-09-16 11:04:32.388 WARN 9344 --- [io-8085-exec-10] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: "save" spring boot security添加数据总是出现这个问题,太让人郁闷了! ![图片说明](https://img-ask.csdn.net/upload/201709/16/1505531597_207750.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/16/1505531651_658581.jpg) ![图片说明](https://img-ask.csdn.net/upload/201709/16/1505531667_733555.jpg) 加上spring boot security就出现这种错误,去掉spring boot security就可以正常运行,不知道错误到底出现在哪里,好郁闷啊,请高手指点一下

EJB3 编写 WebService 的返回列表的问题.

服务端的 EJB 代码如下: <br /> <br /> <br /><pre name="code" class="java">@WebService(name = "TravelAgent", serviceName = "TravelAgentService") @Stateless public class TravelAgentBean implements TravelAgentRemote { ...... @WebMethod @WebResult(name = "List") public List test(@WebParam(name = "name") String name) { System.out.println("name : ");System.out.println(name); Query query = manager.createQuery("from Cabin c"); List list = query.getResultList(); return list; } ...... } </pre> <br /> <br />客户端的 PHP 代码如下: <br /><pre name="code" class="php">$client = new SoapClient($wsdl_url); $username = $client-&gt;test(array('name'=&gt;'asdfhasldfjl')); var_dump($username); </pre> <br />如果服务端是 @Stateless . 使用 Java 客户端调用是没有问题的, <br /> <br />服务端是 @WebService 时, 使用 new ArrayList 实现返回也是没有问题. 唯有 query.getResultList(); 返回时, 出现 WebServiceException 异常. <br />那位高手有空, 请指点下小弟. 小弟是新手. 3 个月前刚买了几本 java 的书看看. <br /> <br />QQ : 280016524 <br />Email : degui.chen@qq.com <br /> <br />如下是服务器端抛出的异常: <br />22:44:45,127 INFO  [EJB3Deployer] Deployed: file:/C:/jboss-4.2.3.GA/server/defau <br />lt/deploy/WebServicesDemo.jar/ <br />22:44:45,228 INFO  [DefaultEndpointRegistry] register: jboss.ws:context=WebServi <br />cesDemo,endpoint=TravelAgentBean <br />22:44:51,086 INFO  [WSDLFilePublisher] WSDL published to: file:/C:/jboss-4.2.3.G <br />A/server/default/data/wsdl/WebServicesDemo.jar/TravelAgentService55191.wsdl <br />22:44:51,396 INFO  [TomcatDeployer] deploy, ctxPath=/WebServicesDemo, warUrl=... <br />/tmp/deploy/WebServicesDemo.jar55190.war/ <br />22:44:53,570 INFO  [STDOUT] name : <br />22:44:53,570 INFO  [STDOUT] asdfhasldfjl <br />22:44:54,691 INFO  [STDOUT] list : <br />22:44:54,691 INFO  [STDOUT] [chen.degui.domain.Cabin@1681460] <br />22:44:54,711 ERROR [RequestHandlerImpl] Error processing web service request <br />org.jboss.ws.WSException: javax.xml.ws.WebServiceException: javax.xml.bind.Marsh <br />alException <br /> - with linked exception: <br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe <br />r class is known to this context.] <br />        at org.jboss.ws.WSException.rethrow(WSException.java:68) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand <br />lerImpl.java:325) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl <br />.java:201) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request <br />HandlerImpl.java:134) <br />        at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java <br />:84) <br />        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) <br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl <br />icationFilterChain.java:290) <br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF <br />ilterChain.java:206) <br />        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi <br />lter.java:96) <br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl <br />icationFilterChain.java:235) <br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF <br />ilterChain.java:206) <br />        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV <br />alve.java:230) <br />        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV <br />alve.java:175) <br />        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit <br />yAssociationValve.java:182) <br />        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv <br />e.java:84) <br />        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j <br />ava:127) <br />        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j <br />ava:102) <br />        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC <br />onnectionValve.java:157) <br />        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal <br />ve.java:109) <br />        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav <br />a:262) <br />        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java <br />:844) <br />        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce <br />ss(Http11Protocol.java:583) <br />        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44 <br />6) <br />        at java.lang.Thread.run(Thread.java:619) <br />Caused by: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException <br /> - with linked exception: <br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe <br />r class is known to this context.] <br />        at org.jboss.ws.core.jaxws.JAXBSerializer.handleMarshallException(JAXBSe <br />rializer.java:124) <br />        at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java: <br />87) <br />        at org.jboss.ws.core.binding.SerializerSupport.serialize(SerializerSuppo <br />rt.java:57) <br />        at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectCon <br />tent.java:159) <br />        at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java: <br />72) <br />        at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentEle <br />ment.java:141) <br />        at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElemen <br />tDoc.java:85) <br />        at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentEle <br />ment.java:547) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen <br />tImpl.java:840) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j <br />ava:825) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen <br />tImpl.java:840) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j <br />ava:825) <br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPEle <br />mentWriter.java:149) <br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWrit <br />er.java:130) <br />        at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:3 <br />25) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.sendResponse(RequestHandl <br />erImpl.java:392) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand <br />lerImpl.java:321) <br />        ... 22 more <br />Caused by: javax.xml.bind.MarshalException <br /> - with linked exception: <br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe <br />r class is known to this context.] <br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java: <br />320) <br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.jav <br />a:246) <br />        at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java: <br />81) <br />        ... 37 more <br />Caused by: javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any o <br />f its super class is known to this context. <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.j <br />ava:240) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.j <br />ava:255) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerialize <br />r.java:647) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.seriali <br />zeItem(ArrayElementNodeProperty.java:65) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeLi <br />stBody(ArrayElementProperty.java:168) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(Ar <br />rayERProperty.java:152) <br />        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBean <br />InfoImpl.java:322) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerialize <br />r.java:679) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(Eleme <br />ntBeanInfoImpl.java:151) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(Eleme <br />ntBeanInfoImpl.java:185) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(Element <br />BeanInfoImpl.java:305) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(Element <br />BeanInfoImpl.java:312) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(Element <br />BeanInfoImpl.java:71) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.j <br />ava:488) <br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java: <br />317) <br />        ... 39 more <br />Caused by: javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any o <br />f its super class is known to this context. <br />        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextIm <br />pl.java:556) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerialize <br />r.java:642) <br />        ... 51 more <br />22:44:54,861 ERROR [[TravelAgentBean]] Servlet.service() for servlet TravelAgent <br />Bean threw exception <br />javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its super <br /> class is known to this context. <br />        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextIm <br />pl.java:556) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerialize <br />r.java:642) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.seriali <br />zeItem(ArrayElementNodeProperty.java:65) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeLi <br />stBody(ArrayElementProperty.java:168) <br />        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(Ar <br />rayERProperty.java:152) <br />        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBean <br />InfoImpl.java:322) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerialize <br />r.java:679) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(Eleme <br />ntBeanInfoImpl.java:151) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(Eleme <br />ntBeanInfoImpl.java:185) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(Element <br />BeanInfoImpl.java:305) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(Element <br />BeanInfoImpl.java:312) <br />        at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(Element <br />BeanInfoImpl.java:71) <br />        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.j <br />ava:488) <br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java: <br />317) <br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.jav <br />a:246) <br />        at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java: <br />81) <br />        at org.jboss.ws.core.binding.SerializerSupport.serialize(SerializerSuppo <br />rt.java:57) <br />        at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectCon <br />tent.java:159) <br />        at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java: <br />72) <br />        at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentEle <br />ment.java:141) <br />        at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElemen <br />tDoc.java:85) <br />        at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentEle <br />ment.java:547) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen <br />tImpl.java:840) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j <br />ava:825) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen <br />tImpl.java:840) <br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j <br />ava:825) <br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPEle <br />mentWriter.java:149) <br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWrit <br />er.java:130) <br />        at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:3 <br />25) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.sendResponse(RequestHandl <br />erImpl.java:392) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand <br />lerImpl.java:321) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl <br />.java:201) <br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request <br />HandlerImpl.java:134) <br />        at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java <br />:84) <br />        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) <br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl <br />icationFilterChain.java:290) <br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF <br />ilterChain.java:206) <br />        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi <br />lter.java:96) <br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl <br />icationFilterChain.java:235) <br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF <br />ilterChain.java:206) <br />        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV <br />alve.java:230) <br />        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV <br />alve.java:175) <br />        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit <br />yAssociationValve.java:182) <br />        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv <br />e.java:84) <br />        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j <br />ava:127) <br />        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j <br />ava:102) <br />        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC <br />onnectionValve.java:157) <br />        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal <br />ve.java:109) <br />        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav <br />a:262) <br />        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java <br />:844) <br />        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce <br />ss(Http11Protocol.java:583) <br />        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44 <br />6) <br />        at java.lang.Thread.run(Thread.java:619) <br /><br /><strong>问题补充</strong><br />多谢 Anatorian 的建议. :<br />下面是我添加的修改后的结果:<br /><br /><pre name="code" class="java">@Entity @XmlRootElement public class Cabin implements java.io.Serializable { private int id; private String name; private int deckLevel; private int shipId; private int bedCount; @Id @Column(name = "CABIN_ID") public int getId() { ............... </pre><br /><br />异常为:<br />23:59:14,985 INFO  [WSDLFilePublisher] WSDL published to: file:/C:/jboss-4.2.3.G<br />A/server/default/data/wsdl/WebServicesDemo.jar/TravelAgentService64072.wsdl<br />23:59:15,496 INFO  [TomcatDeployer] deploy, ctxPath=/WebServicesDemo, warUrl=...<br />/tmp/deploy/WebServicesDemo.jar64071.war/<br />23:59:43,506 INFO  [STDOUT] name :<br />23:59:43,506 INFO  [STDOUT] asdfhasldfjl<br />23:59:45,689 INFO  [STDOUT] list :<br />23:59:45,689 INFO  [STDOUT] [chen.degui.domain.Cabin@175beef]<br />23:59:45,729 ERROR [RequestHandlerImpl] Error processing web service request<br />org.jboss.ws.WSException: javax.xml.ws.WebServiceException: javax.xml.bind.Marsh<br />alException<br /> - with linked exception:<br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe<br />r class is known to this context.]<br />        at org.jboss.ws.WSException.rethrow(WSException.java:68)<br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand<br />lerImpl.java:325)<br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl<br />.java:201)<br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(Request<br />HandlerImpl.java:134)<br />        at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java<br />:84)<br />        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl<br />icationFilterChain.java:290)<br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF<br />ilterChain.java:206)<br />        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi<br />lter.java:96)<br />        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl<br />icationFilterChain.java:235)<br />        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF<br />ilterChain.java:206)<br />        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV<br />alve.java:230)<br />        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV<br />alve.java:175)<br />        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit<br />yAssociationValve.java:182)<br />        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv<br />e.java:84)<br />        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j<br />ava:127)<br />        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j<br />ava:102)<br />        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedC<br />onnectionValve.java:157)<br />        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal<br />ve.java:109)<br />        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav<br />a:262)<br />        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java<br />:844)<br />        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce<br />ss(Http11Protocol.java:583)<br />        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44<br />6)<br />        at java.lang.Thread.run(Thread.java:619)<br />Caused by: javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException<br /> - with linked exception:<br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe<br />r class is known to this context.]<br />        at org.jboss.ws.core.jaxws.JAXBSerializer.handleMarshallException(JAXBSe<br />rializer.java:124)<br />        at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java:<br />87)<br />        at org.jboss.ws.core.binding.SerializerSupport.serialize(SerializerSuppo<br />rt.java:57)<br />        at org.jboss.ws.core.soap.ObjectContent.marshallObjectContents(ObjectCon<br />tent.java:159)<br />        at org.jboss.ws.core.soap.ObjectContent.transitionTo(ObjectContent.java:<br />72)<br />        at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentEle<br />ment.java:141)<br />        at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElemen<br />tDoc.java:85)<br />        at org.jboss.ws.core.soap.SOAPContentElement.writeElement(SOAPContentEle<br />ment.java:547)<br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen<br />tImpl.java:840)<br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j<br />ava:825)<br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElementContent(SOAPElemen<br />tImpl.java:840)<br />        at org.jboss.ws.core.soap.SOAPElementImpl.writeElement(SOAPElementImpl.j<br />ava:825)<br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElementInternal(SOAPEle<br />mentWriter.java:149)<br />        at org.jboss.ws.core.soap.SOAPElementWriter.writeElement(SOAPElementWrit<br />er.java:130)<br />        at org.jboss.ws.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:3<br />25)<br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.sendResponse(RequestHandl<br />erImpl.java:392)<br />        at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHand<br />lerImpl.java:321)<br />        ... 22 more<br />Caused by: javax.xml.bind.MarshalException<br /> - with linked exception:<br />[javax.xml.bind.JAXBException: class chen.degui.domain.Cabin nor any of its supe<br />r class is known to this context.]<br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:<br />320)<br />        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.jav<br />a:246)<br />        at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java:<br />81)<br /><br /><strong>问题补充</strong><br />没有高手有空?

Spring Security 无法进入UserServiceDetails方法

项目启动不报错,直接在浏览器中输入/spitter/home也会直接跳转到spitter/login页面,但是一但提交表单,会直接进入到后台login方法,而不会进入到UserDetailsService方法中,而且也不会按照方法正常执行的那样跳转到home页面,而是返回到了login页面,求解。。。。。 ``` package cherry.config; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; // 配置DelegatingFilterProxy public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer{ } ``` ``` package cherry.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.core.userdetails.UserDetailsService; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UserDetailsService spitterUserDetailsService; @Override protected void configure(HttpSecurity http) throws Exception{ http.formLogin().loginPage("/spitter/login").permitAll() .and().rememberMe() .and().authorizeRequests().antMatchers("/spitter/home").hasRole("SPITTER") .anyRequest().permitAll(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception{ auth.userDetailsService(spitterUserDetailsService); } } ``` ``` package cherry.config.security; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import cherry.model.Spitter; import cherry.repository.SpitterRepository; @Service public class SpitterUserDetailsService implements UserDetailsService { @Autowired private SpitterRepository spitterRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { System.err.println("---------- User Details Service start -----------"); Spitter spitter = spitterRepository.findByUsername(username); if(spitter == null){ throw new UsernameNotFoundException(username + " not found "); } List<SimpleGrantedAuthority> authorities = new ArrayList<SimpleGrantedAuthority>(); authorities.add(new SimpleGrantedAuthority("ROLE_SPITTER")); System.out.println(spitter.getUsername() + " : ROLE_SPITTER"); return new User(spitter.getUsername(), spitter.getPassword(), authorities); } } ``` ``` package cherry.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import cherry.model.Spitter; import cherry.repository.SpitterRepository; @Controller @RequestMapping("/spitter") public class SpitterController { @Autowired private SpitterRepository spitterRepository; @RequestMapping(value= "/login", method = RequestMethod.GET) public String login(Model model){ model.addAttribute("spitter", new Spitter()); return "spitter/login"; } @RequestMapping(value= "/loginForm", method = RequestMethod.POST) public String login(@ModelAttribute("spitter") Spitter spitter){ System.out.println(spitter.getUsername() + " logined.."); return "redirect:home"; } @RequestMapping(value = "/register", method = RequestMethod.GET) public String showRegistrationForm(Model model){ model.addAttribute("spitter", new Spitter()); return "spitter/registerForm"; } @RequestMapping(value="/register", method = RequestMethod.POST) public String register(@ModelAttribute("spitter") Spitter spitter){ spitterRepository.addSpitter(spitter); return "spitter/registerSuccessfully"; } @RequestMapping("/home") public String hello(){ return "spitter/helloWorld"; } } ``` 附:https://github.com/CherryYu/SpringHibernate.git

pecl在mac上安装mongodb,致命错误:找不到'Security / Security.h'文件

<div class="post-text" itemprop="text"> <p>I used <code>pecl</code> to install MongoDB extension on mac, but it fails</p> <p>I get the following error:</p> <blockquote> <p>ERROR: 'make' failed</p> <p>/private/tmp/pear/install/mongodb/src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.c:25:10: fatal error: 'Security/Security.h' file not found</p> <p>1 error generated.</p> <p>make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-rand-common-crypto.lo] Error 1</p> <p>ERROR: `make' failed</p> </blockquote> <p>What is wrong?</p> </div>

关于Spring boot + SpringSecurity +jwt token失效的问题

比如我登abc的用户,然后我在另一个地点也登abc的用户,那前一个登陆的在刷新或者请求接口的时候要登出, 或者是我后台改了abc的密码,那abc这个账户在刷新请求接口的时候要登出。 框架我搭好了 代码如下: 生成token工具类: ``` public class JwtTokenUtil { private static InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("jwt.jks"); // 寻找证书文件 private static PrivateKey privateKey = null; private static PublicKey publicKey = null; static { // 将证书文件里边的私钥公钥拿出来 try { KeyStore keyStore = KeyStore.getInstance("JKS"); // java key store 固定常量 keyStore.load(inputStream, "123456".toCharArray()); privateKey = (PrivateKey) keyStore.getKey("jwt", "123456".toCharArray()); // jwt 为 命令生成整数文件时的别名 publicKey = keyStore.getCertificate("jwt").getPublicKey(); } catch (Exception e) { e.printStackTrace(); } } public static String generateToken(String subject, int expirationSeconds, String salt) { return Jwts.builder() .setClaims(null) .setSubject(subject) .setExpiration(new Date(System.currentTimeMillis() + expirationSeconds * 1000)) // .signWith(SignatureAlgorithm.HS512, salt) // 不使用公钥私钥 .signWith(SignatureAlgorithm.RS256, privateKey) .compact(); } public static String parseToken(String token, String salt) { String subject = null; try { Claims claims = Jwts.parser() // .setSigningKey(salt) // 不使用公钥私钥 .setSigningKey(publicKey) .parseClaimsJws(token).getBody(); subject = claims.getSubject(); } catch (Exception e) { } return subject; } } ``` 登陆成功后生成JTWtoken : ``` @Component public class AjaxAuthenticationSuccessHandler implements AuthenticationSuccessHandler { @Override public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { ResponseBase responseBase = new ResponseBase(); responseBase.setCode("200"); responseBase.setMassage("Login Success!"); String jwtToken = JwtTokenUtil.generateToken(String.valueOf(authentication.getPrincipal()), 300, "_secret"); responseBase.setJwtToken(jwtToken); httpServletResponse.getWriter().write(JSON.toJSONString(responseBase)); } } ``` 监听器: ``` @Component public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { @Autowired AdminSysUserSecurityService adminSysUserSecurityService; @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { String authHeader = request.getHeader("Authorization"); if (authHeader != null && authHeader.startsWith("Bearer ")) { final String authToken = authHeader.substring("Bearer ".length()); String username = JwtTokenUtil.parseToken(authToken, "_secret"); if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { UserDetails userDetails = adminSysUserSecurityService.loadUserByUsername(username); if (userDetails != null) { UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); SecurityContextHolder.getContext().setAuthentication(authentication); } } } chain.doFilter(request, response); } } ``` ``` @Component("rbacauthorityservice") public class RbacAuthorityService { public boolean hasPermission(HttpServletRequest request, Authentication authentication) { Object userInfo = authentication.getPrincipal(); boolean hasPermission = false; if (userInfo instanceof UserDetails) { String username = ((UserDetails) userInfo).getUsername(); //获取资源 Set<String> urls = new HashSet(); urls.add("/**/**"); // 这些 url 都是要登录后才能访问,且其他的 url 都不能访问! Set set2 = new HashSet(); Set set3 = new HashSet(); AntPathMatcher antPathMatcher = new AntPathMatcher(); for (String url : urls) { if (antPathMatcher.match(url, request.getRequestURI())) { hasPermission = true; break; } } return hasPermission; } else { return false; } } } ``` 配置: ``` @Configuration public class AdminWebSecurityConfig extends WebSecurityConfigurerAdapter { @Value("${pay.strength}") private int strength; @Autowired private AdminSysUserSecurityService adminSysUserSecurityService; @Bean public PasswordEncoder passwordEncoder(){ // return NoOpPasswordEncoder.getInstance();//不对密码加密 return new BCryptPasswordEncoder(strength);//秘钥迭代次数为 2^strength,strength取值在 4-31 之间,默认10 } @Autowired AjaxAuthenticationEntryPoint authenticationEntryPoint; // 未登陆时返回 JSON 格式的数据给前端(否则为 html) @Autowired AjaxAuthenticationSuccessHandler authenticationSuccessHandler; // 登录成功返回的 JSON 格式数据给前端(否则为 html) @Autowired AjaxAuthenticationFailureHandler authenticationFailureHandler; // 登录失败返回的 JSON 格式数据给前端(否则为 html) @Autowired AjaxLogoutSuccessHandler logoutSuccessHandler; // 注销成功返回的 JSON 格式数据给前端(否则为 登录时的 html) @Autowired AjaxAccessDeniedHandler accessDeniedHandler; // 无权访问返回的 JSON 格式数据给前端(否则为 403 html 页面) @Autowired JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter; // JWT 拦截器 @Autowired SelfAuthenticationProvider provider; // 自定义安全认证 @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // 加入自定义的安全认证 auth.authenticationProvider(provider); } @Override public void configure(HttpSecurity http)throws Exception{ //开启HttpSecurity配置 http.csrf().disable() .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) // 使用 JWT,关闭token .and() .httpBasic().authenticationEntryPoint(authenticationEntryPoint) .and() .authorizeRequests() // .antMatchers("/db/**").hasRole("DB") // .antMatchers("/user/**").hasRole("USER") // .antMatchers("/admin/**").hasRole("ADMIN") // .antMatchers("/user/**").access("hasAnyRole('ADMIN','ROOT')") // .antMatchers("/db/**").access("hasAnyRole('ADMIN') and hasRole('DBA')") //除了前面路径,用户访问其他URL都必须认证后访问 .anyRequest() .access("@rbacauthorityservice.hasPermission(request,authentication)") // RBAC 动态 url 认证 .and() //开启表单登录,同事配置了登入接口为/login .formLogin() /* //该接口主要方便ajax或者移动端登入 .loginProcessingUrl("/login") //设置登录成功跳转页面,error=true控制页面错误信息的展示 .successForwardUrl("/index").failureUrl("/login?error=true") */ //登入接口都不需要认证 .successHandler(authenticationSuccessHandler) // 登录成功 .failureHandler(authenticationFailureHandler) // 登录失败 .permitAll() .and() //开启注销登入配置 .logout() .logoutSuccessHandler(logoutSuccessHandler) .permitAll(); http.rememberMe().rememberMeParameter("remember-me") .userDetailsService(adminSysUserSecurityService).tokenValiditySeconds(300); http.exceptionHandling().accessDeniedHandler(accessDeniedHandler); // 无权访问 JSON 格式的数据 http.addFilterBefore(jwtAuthenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); // JWT Filter } ``` 登陆成功后获取token,postman测试: ![图片说明](https://img-ask.csdn.net/upload/201912/11/1576056718_177252.png) 可以 但是我重新调用新的登陆接口,相同用户名获取新的token后,原来的token依旧可以请求。 所以要在哪边配置 用户其它地方登陆,或者用户密码变更,jtwtoken失效

spring security 注入的时候一直报

![![图片说明](https://img-ask.csdn.net/upload/201509/27/1443348552_926035.png)图片说明](https://img-ask.csdn.net/upload/201509/27/1443348546_402797.png) 这个是什么问题了?求知啊···

求助ios上线的时候报的90037错误,一直没解决掉,在线等~

打包成功以后,上传的时候报错,ERROR ITMS-90037: "This bundle is invalid. The Info.plist file is missing or could not be parsed. Please check it for embedded control characters." 请大神帮忙~

Spring Security /j_spring_security_check 无法找到404错误

Spring Security /j_spring_security_check 无法找到404错误。在WAS7和JBoss上都试过了,一样的错误。在WAS上也试过加入com.ibm.ws.webcontainer.invokeFiltersCompatibility=true,都不成功。 <br /> <br />//-- web.xml --// <br /><pre name="code" class="java">&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; &lt;!-- load Spring configurations --&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/myApplicationContext.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;filter&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;springSecurityFilterChain&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;index.html&lt;/welcome-file&gt; &lt;welcome-file&gt;index.htm&lt;/welcome-file&gt; &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt; &lt;welcome-file&gt;default.html&lt;/welcome-file&gt; &lt;welcome-file&gt;default.htm&lt;/welcome-file&gt; &lt;welcome-file&gt;default.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;/web-app&gt; </pre> <br /> <br />//-- myApplicationContext.xml --// <br /><pre name="code" class="java">&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;security:http auto-config="true"&gt; &lt;security:form-login login-processing-url="/j_spring_security_check" login-page="/login.jsp" authentication-failure-url="/login.jsp" /&gt; &lt;security:intercept-url pattern="/secured/**" access="ROLE_ADMIN" /&gt; &lt;security:logout /&gt; &lt;/security:http&gt; &lt;security:user-service id="dummyUserRegistry"&gt; &lt;security:user name="jack" password="12345678" authorities="ROLE_ADMIN" /&gt; &lt;/security:user-service&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider user-service-ref="dummyUserRegistry" /&gt; &lt;/security:authentication-manager&gt; &lt;/beans&gt; </pre> <br /> <br />//-- JSP --// <br /><pre name="code" class="java"> &lt;form method="POST" action="/j_spring_security_check"&gt; &lt;label for="j_username"&gt;Username:&amp;nbsp;&amp;nbsp;&lt;/label&gt; &lt;input type="text" name="j_username" /&gt;&lt;br/&gt; &lt;label for="j_password"&gt;Password:&amp;nbsp;&amp;nbsp;&lt;/label&gt; &lt;input type="password" name="j_password" /&gt;&lt;br/&gt; &lt;input type="submit" value="Login" /&gt; &lt;/form&gt;</pre> <br /><br/><strong>问题补充</strong><br/>这个貌似是老生常谈的问题,但是我试了很多的方法,依然不行。<br /><br />在WAS7上加了invokeFiltersCompatibility=true,还是不行。换了JBoss 7.1,同样错误,应该和平台无关了,应该是我的配置出问题了。<br /><br />求指正

用了shiro后,再添加quartz出错的问题

项目中用了apache的shiro,spring的mvc.整个项目非常正常。 后来因业务需求加上了quartz,结果在quartz中保存数据时,出现如下异常 **org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.** 具体表现在quartz启动后,调用相关方法取得数据,然后调用save的时候就报错,未检查出问题,但是在去掉quartz后,整个项目一切正常。 所以,我想请问一下,在quartz中是否还有针对shiro的处理。

spring security3 自定义登录页面,无论输入什么,直接被拦截跳到错误页面

spring security 3,做数据库验证,启动没有问题,但每次点登录按钮的时候,不论输入正确或错误的用户名密码,都直接跳到错误页面,debug跟踪后发现,在InvocationSecurityMetadataSourceService中的getAttributes(Object object)方法传入的object的url值就是验证失败页面的url,感觉就是没有权限,被拦截了,请教各位,我的配置有什么问题吗?下面是代码 login.jsp [code="jsp"]<form method="post" action="${pageContext.request.contextPath}/j_spring_security_check"> <table> <td>用户名</td> <td><input type="text" name="j_username" value=""></td> <tr> <td>密码</td> <td><input type="password" name="j_password" value=""></td> </table> <input type="submit" name="button" value="登录" /> </form>[/code] security.xml [code="xml"] <http auto-config="true" access-denied-page="/jsp/home.jsp"> <intercept-url pattern="/css/**" filters="none" /> <intercept-url pattern="/style/**" filters="none" /> <intercept-url pattern="/images/**" filters="none" /> <intercept-url pattern="/js/**" filters="none" /> <intercept-url pattern="/jsp/login.jsp" filters="none" /> <!-- <intercept-url pattern="/jsp/admin.jsp" access="ROLE_ADMIN" /> <intercept-url pattern="/**" access="ROLE_USER" /> --> <form-login login-page="/jsp/login.jsp" authentication-failure-url="/jsp/error.jsp" default-target-url="/jsp/index.jsp" /> <logout logout-success-url="/jsp/login.jsp"/> <session-management> <concurrency-control max-sessions="1" error-if-maximum-exceeded="true" /> </session-management> <custom-filter ref="pawnFilter" before="FILTER_SECURITY_INTERCEPTOR" /> </http> <beans:bean id="pawnFilter" class="com.sywzsh.security.PawnFilterSecurityInterceptor"> <beans:property name="authenticationManager" ref="authenticationManager" /> <beans:property name="accessDecisionManager" ref="pawnAccessDecisionManagerService" /> <beans:property name="securityMetadataSource" ref="pawnSecurityDataSourceService" /> </beans:bean> <authentication-manager alias="authenticationManager"> <authentication-provider user-service-ref="userDetailsService"> </authentication-provider> </authentication-manager> <!-- 查询用户信息 --> <beans:bean id="userDetailsService" class="com.sywzsh.security.PawnUsersDetailsService" /> <!-- 决策访问器,判断是否有权限访问某个资源 --> <beans:bean id="pawnAccessDecisionManagerService" class="com.sywzsh.security.PawnAccessDecisionManagerService" /> <!-- 资源数据定义,资源与角色相关联,一个资源可被哪些角色访问 --> <beans:bean id="pawnSecurityDataSourceService" init-method="loadResourceDefine" class="com.sywzsh.security.PawnInvocationSecurityMetadataSourceService"> </beans:bean> [/code] 过滤器等代码与网上教程一致,如http://andy-ghg.iteye.com/blog/1081622 ,http://blog.csdn.net/remote_roamer/archive/2010/07/05/5713777.aspx 代码大同小异,不知道有哪位兄台遇到过这种情况。

spring-security 异常处理求助

研究spring-security两个月了,只是懂了个皮毛,现在碰到了一个棘手的问题,在统一异常处理时,用Spring MVC 拦截时,会把security 抛出的异常一同拦截,这样就导致了spring-security框架不能针对自己的异常进行处理,从而不能正常和合理的进行过认证过程 于是乎加了下面这几句过滤的代码 if(ex instanceof AuthenticationException || ex instanceof AccessDeniedException){ logger.debug("spring security拋出的异常,不做处理"); return super.doResolveException(request, response, handler, ex); } 新的问题又出现了,我在框架获取用户信息的方法内加了自己的认证,出现错误时抛出自己的异常进行处理,结果被spring-security框架拦截了,而自己的异常过滤器拦截不到,达不到效果,有没有大神出现过这个问题帮我解决下

spring security实现QQ授权登陆,默认请求 /auth/qq 被当成普通请求拦截了?

![图片说明](https://img-ask.csdn.net/upload/201904/22/1555922176_350254.png) securtyConfig中已经apply了这个配置,但是“auth/qq” 却没有进入springsocial的过滤器,而是被当成普通请求直接进入了springsecurity的过滤器, 请求大佬指导yi'xia

SpringSecurity登录的时候一直重定向,回到登录页面

springsecurity3.2 <br/>说起来,我这个原本前台是ANGULARJS+HTML写的 <br/>但是公司单点登录必须要JSP页面,因为是老系统,html不支持 <br/>所以没办法,就写了个JSP来登录 <br/>然后我登录上去会报302,而且response里面带location:login.jsp <br/>我确认过用户名密码,没问题,而且我也重写了UserDetailsService <br/>但是根本没有到UserDetailServic这一步,应该是授权的时候就不通过 <br/>说实话,对springsecurity不太了解,下面是配置文件,麻烦大神指点! <br/><br/>config-file <br/> ``` <!-- 以下页面不被拦截 --> <http pattern="/login_sso.jsp" security="none"></http> <http pattern="/css/**" security="none"></http> <http pattern="/fonts/**" security="none"></http> <http pattern="/images/**" security="none"></http> <http pattern="/js/**" security="none"></http> <http pattern="/lib/**" security="none"></http> <http pattern="/plugins/**" security="none"></http> <http use-expressions="false"> <!-- 拦截规则 --> <intercept-url pattern="/**" access="ROLE_USER" /> <!-- 登录配置 1登陆页面 2登陆成功跳转页面 3登录失败跳转页面 4总是使用默认跳转页面--> <form-login login-page="/login_sso.jsp" default-target-url="/index.html" login-processing-url="/j_spring_security_check" authentication-failure-url="/login.html" always-use-default-target="true"/> <csrf disabled="true"/> <!-- 由于使用了框架页面,所以要进行以下配置 --> <headers> <frame-options policy="SAMEORIGIN"/> </headers> <!-- 登出配置 --> <logout logout-url="/logout" logout-success-url="/login_sso.jsp"/> </http> ``` <br/> login.jsp ``` <form id="loginForm" name="loginForm" action="/modify/j_spring_security_check" method="post" > <input type="text" id="username" name="name" /> <input type="password" id="password" name="password" /> <input value="登录" style="width:100%;" type="button" onclick="document:loginForm.submit()"> </form> ``` <br/><br/> response信息,这个是向login-processing-url发起请求后的返回信息,直接被重定向回login.jsp了,而且都没到UserDetailService <br/> ![图片说明](https://img-ask.csdn.net/upload/201903/05/1551788138_54021.png)

Symfony:您的要求无法解析为可安装的软件包集

<div class="post-text" itemprop="text"> <p>today when I update my project with composer update I encountered this error</p> <p>Problem 1</p> <ul> <li>Conclusion: don't install symfony/symfony v3.4.23</li> <li>Conclusion: remove symfony/symfony v3.4.22</li> <li>Conclusion: don't install symfony/symfony v3.4.22</li> <li>Conclusion: don't install symfony/symfony v3.4.21</li> <li>Conclusion: don't install symfony/symfony v3.4.20</li> <li>Conclusion: don't install symfony/symfony v3.4.19</li> <li>Conclusion: don't install symfony/symfony v3.4.18</li> <li>Conclusion: don't install symfony/symfony v3.4.17</li> <li>Conclusion: don't install symfony/symfony v3.4.16</li> <li>Conclusion: don't install symfony/symfony v3.4.15</li> <li>Conclusion: don't install symfony/symfony v3.4.14</li> <li>Conclusion: don't install symfony/symfony v3.4.13</li> <li>Conclusion: don't install symfony/symfony v3.4.12</li> <li>Conclusion: don't install symfony/symfony v3.4.11</li> <li>Conclusion: don't install symfony/symfony v3.4.10</li> <li>Conclusion: don't install symfony/symfony v3.4.9</li> <li>Conclusion: don't install symfony/symfony v3.4.8</li> <li>Conclusion: don't install symfony/symfony v3.4.7</li> <li>Conclusion: don't install symfony/symfony v3.4.6</li> <li>Conclusion: don't install symfony/symfony v3.4.5</li> <li>Conclusion: don't install symfony/symfony v3.4.4</li> <li>Conclusion: don't install symfony/symfony v3.4.3</li> <li>Conclusion: don't install symfony/symfony v3.4.2</li> <li>Conclusion: don't install symfony/symfony v3.4.1</li> <li>don't install symfony/twig-bundle v4.0.0|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.1|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.10|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.11|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.12|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.13|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.14|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.15|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.2|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.3|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.4|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.5|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.6|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.7|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.8|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.0.9|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.0|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.1|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.10|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.11|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.2|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.3|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.4|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.5|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.6|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.7|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.8|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.1.9|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.2.0|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.2.1|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.2.2|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.2.3|don't install symfony/symfony v3.4.0</li> <li>don't install symfony/twig-bundle v4.2.4|don't install symfony/symfony v3.4.0</li> <li><p>don't install symfony/symfony v3.4.0|remove symfony/twig-bundle v4.1.0</p> <ul> <li><p>Installation request for symfony/symfony 3.4.* -&gt; satisfiable by symfony/symfony[v3.4.0, v3.4.1, v3.4.10, v3.4.11, v3.4.12, v3.4.13, v3.4.14, v3.4.15, v3.4.16, v3.4.17, v3.4.18, v3.4.19, v3.4.2, v3.4.20, v3.4.21, v3.4.22, v3.4.23, v3.4.3, v3.4.4, v3.4.5, v3.4.6, v3.4.7, v3.4.8, v3.4.9].</p></li> <li><p>Installation request for symfony/twig-bundle ^4.0 -&gt; satisfiable by symfony/twig-bundle[v4.0.0, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.1, v4.2.2, v4.2.3, v4.2.4].</p></li> </ul></li> </ul> <p>composer.json</p> <pre><code>{ "name": "eolic", "license": "proprietary", "type": "project", "autoload": { "psr-4": { "AppBundle\\": "src/AppBundle" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" }, "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ] }, "require": { "php": "&gt;=5.5.9", "beberlei/doctrineextensions": "^1.0", "doctrine/doctrine-bundle": "^1.6", "doctrine/orm": "^2.5", "friendsofsymfony/jsrouting-bundle": "^2.2", "friendsofsymfony/oauth-server-bundle": "dev-master", "friendsofsymfony/user-bundle": "~2.0", "incenteev/composer-parameter-handler": "^2.0", "sensio/distribution-bundle": "^5.0.19", "sensio/framework-extra-bundle": "^5.0.0", "symfony/apache-pack": "^1.0", "symfony/monolog-bundle": "^3.1.0", "symfony/polyfill-apcu": "^1.0", "symfony/swiftmailer-bundle": "^2.6.4", "symfony/symfony": "3.4.*", "symfony/templating": "^4.0", "symfony/twig-bundle": "^4.0", "twig/twig": "~1.34|~2.4" }, "require-dev": { "sensio/generator-bundle": "^3.0", "symfony/phpunit-bridge": "^3.0" }, "scripts": { "symfony-scripts": [ "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" ], "post-install-cmd": [ "@symfony-scripts" ], "post-update-cmd": [ "@symfony-scripts" ] }, "config": { "sort-packages": true }, "extra": { "symfony-app-dir": "app", "symfony-bin-dir": "bin", "symfony-var-dir": "var", "symfony-web-dir": "web", "symfony-tests-dir": "tests", "symfony-assets-install": "relative", "incenteev-parameters": { "file": "app/config/parameters.yml" }, "branch-alias": null } </code></pre> <p>Thanks a lot</p> </div>

Spring boot Security 多种登录方式混合?

我现在有一个这样的需求,使用spring boot 开发一个微信小程序。微信小程序使用spring boot 做 服务器后台,通过rest_api交互,用户小程序登录后可以利用jwt 来保护rest api 和一此网站资源。 另外也使用相同的spring boot 程序开发一个让管理员使用的后台,如管理微信用户在小程序中下的订单信息。后台管理员通过浏览器访问,使用form认证。 总结:如休让一个spring boot 程序 即可以rest api 的方法认证登录,也可以利用表单方式认证登录

spring security 和 shiro 和 jwt的区别?

spring security 和 shiro 和 jwt的区别?

SpringSecurity我开启了请求不需要认证为什么还是返回403jinz

服务器返回的信息: "timestamp": "2019-06-19 14:36:42", "status": 403, "error": "Forbidden", "message": "Forbidden", "path": "/login/login" configure(HttpSecurity)代码: protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/login/login").permitAll(); }

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

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

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

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

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

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

和黑客斗争的 6 天!

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

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

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

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

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

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

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

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

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

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

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

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

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

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

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

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

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

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

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

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

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

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中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多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

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

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

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

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

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

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

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

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

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

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

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

立即提问
相关内容推荐