spring整合websocket出错,Unexpected response code: 404
  1. 下面是代码:
    public class MarcoHandler extends AbstractWebSocketHandler {

    @Override
    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
    System.out.println("Received message:"+message.getPayload());
    Thread.sleep(2000);
    session.sendMessage(new TextMessage("Polo!"));
    }

}
websocket的xml配置

<websocket:handlers>
    <websocket:mapping handler="marcoHandler" path="/marco"/>
</websocket:handlers>
<bean id="marcoHandler" class="com.camle.entity.MarcoHandler"/>

web.xml的配置


  <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
  <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:websocket.xml</param-value>
    </context-param>

javascript代码

var url = 'ws://'+window.location.host+'/mvcAndWebsocket/marco'; var sock = new WebSocket(url); sock.onopen = function(){ console.log('Opening'); sayMarco(); }; sock.onmessage = function(e){ console.log('Received message:',e.data); setTimeout(function(){sayMarco()},2000); }; sock.onclose = function(){ alert(window.location.host); console.log('Closing'); }; function sayMarco(){ console.log('Sending Marco!'); sock.send('Marco!'); }
0

3个回答

0

图片说明

0

参考:

[Error during WebSocket handshake: Unexpected response code: 404错误的解决](https://blog.csdn.net/clever101/article/details/97617044 "")
0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Unexpected response code 500 for
android通信,登录和注销都可以正常了,但是其他请求返回信息[img=https://img-bbs.csdn.net/upload/201411/04/1415092005_17669.png][/img],服务器端也找不到原因,手机端参数也没有错,求大神指点
求助:Spring + WebSocket 握手失败 Unexpected response code: 400
求助各位大神,现在我的WebSocket是这么配置的:rn注册类:rn[code=java]rn/**rn * WebSocket注册类rn *rn * @author zhangdanjirn * rn */rn@Configurationrn@EnableWebMvcrn@EnableWebSocketrnpublic class DataPresentationWebSocketConfig extends WebMvcConfigurerAdapter implements WebSocketConfigurerrnrn private Logger logger = LoggerFactory.getLogger(DataPresentationWebSocketConfig.class);rn rn /**rn * 注册WebSocketHandlerrn *rn * @author zhangdanjirn * @param registryrn * rn */rn @Overridern public void registerWebSocketHandlers(WebSocketHandlerRegistry registry)rn rn logger.info("---Begin Invoke:DataPresentationWebSocketConfig.registerWebSocketHandlers---");rn registry.addHandler(dataPresentationWebSocketHandler(), "/dataPresentationWebSocketServer.do").addInterceptors(new DataPresentationWebSocketInterceptor());rn rn rn @Beanrn public WebSocketHandler dataPresentationWebSocketHandler()rn return new DataPresentationWebSocketHandler();rn rnrnrn[/code]rnhandler:rn[code=java]rn/**rn * WebSocketHandler类rn *rn * @author zhangdanjirn * rn */rnpublic class DataPresentationWebSocketHandler extends TextWebSocketHandlerrnrnrn private Logger logger = LoggerFactory.getLogger(DataPresentationWebSocketHandler.class);rn public static final List LOGIN_USERS = Collections.synchronizedList(new ArrayList()); rn rn @Autowiredrn private DataPresentationService dataPresentationService;rn rn /**rn * WebSocket连接创建rn *rn * @author zhangdanjirn * @param sessionrn * rn */rn @Overridern public void afterConnectionEstablished(WebSocketSession session) throws Exceptionrn rn logger.info("---Begin Invoke:DataPresentationWebSocketHandler.afterConnectionEstablished---");rn LOGIN_USERS.add(session); //将登录的WebSocketSession放入缓存中rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket连接已建立---");rn rnrn /**rn * WebSocket接受消息并发送rn *rn * @author zhangdanjirn * @param sessionrn * messagern * rn */rn @Overridern protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exceptionrn rn logger.info("---Begin Invoke:DataPresentationWebSocketHandler.handleTextMessagemessage:" + message.getPayload() + "---");rn //根据页面消息设置工作标识rn if("WEBSOCKET_IS_WORK".equals(message.getPayload()))rn //WebSocket启动工作rn WebSocketUtil.setWebSocketWorkFlag(session, true);rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket开始工作---");rn else if("WEBSOCKET_STOP_WORK".equals(message.getPayload()))rn //WebSocket停止工作rn WebSocketUtil.setWebSocketWorkFlag(session, false);rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket停止工作---");rn else if(message.getPayload().startsWith("WEBSOCKET_BIND_USER"))rn //绑定WebSocketSession用户rn String bindUserId = message.getPayload().substring(message.getPayload().indexOf(":") + 1);rn if(StringUtils.isEmpty(bindUserId) || !StringUtils.isInteger(bindUserId))rn throw new RuntimeException("绑定的用户ID不存在或不是整数类型");rn rn WebSocketUtil.setWebSocketBindUser(session, Integer.parseInt(bindUserId));rn rn else if(message.getPayload().startsWith("WEBSOCKET_REFRESH_ALL_DATA"))rn //刷新所有数据rn String updateUserId = message.getPayload().substring(message.getPayload().indexOf(":") + 1);rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "刷新用户" + updateUserId + "所有数据---");rn if(StringUtils.isEmpty(updateUserId) || !StringUtils.isInteger(updateUserId))rn throw new RuntimeException("更新数据的用户ID不存在或不是整数类型");rn rn SysUser updateUser = new SysUser(Integer.parseInt(updateUserId));rn dataPresentationService.updateDataPresentation(updateUser, 0);rn elsern //WebSocket设置是否启用标识,若启用则发送消息rn Boolean isWork = WebSocketUtil.getWebSocketWorkFlag(session);rn if(isWork)rn session.sendMessage(new TextMessage(message.getPayload()));rn elsern logger.info("---INFO:用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket未启用工作---");rn rn rn rnrn /**rn * WebSocket处理异常rn *rn * @author zhangdanjirn * @param sessionrn * exceptionrn * rn */rn @Overridern public void handleTransportError(WebSocketSession session, Throwable exception) throws Exceptionrn rn logger.info("---Begin Invoke:DataPresentationWebSocketHandler.handleTransportErrorexception:" + exception.getMessage() + "---");rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket因异常关闭---");rn if(session.isOpen()) rn session.close(); rn rn LOGIN_USERS.remove(session); rn rnrn /**rn * WebSocket关闭连接rn *rn * @author zhangdanjirn * @param sessionrn * closeStatusrn * rn */rn @Overridern public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exceptionrn rn logger.info("---Begin Invoke:DataPresentationWebSocketHandler.afterConnectionClosedcloseStatus:" + closeStatus + "---");rn logger.info("---用户" + WebSocketUtil.getSysUserFromWebSocketSession(session).getName() + "WebSocket关闭---");rn LOGIN_USERS.remove(session); rn rnrn /**rn * WebSocket局部消息rn *rn * @author zhangdanjirn * rn */rn @Overridern public boolean supportsPartialMessages()rn rn return false;rn rnrnrn[/code]rninterceptor:rn[code=java]rn/**rn * WebSocket拦截器rn *rn * @author zhangdanjirn * rn */rnpublic class DataPresentationWebSocketInterceptor extends HttpSessionHandshakeInterceptorrnrn private Logger logger = LoggerFactory.getLogger(DataPresentationWebSocketInterceptor.class);rnrn @Overridern public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler,rn Map attributes) throws Exceptionrn rn logger.info("---Begin Invoke:DataPresentationWebSocketInterceptor.beforeHandshake---");rn if (request instanceof ServletServerHttpRequest) rn //从request中获取user信息放入WebSocketSession中rn ServletServerHttpRequest servletRequest = (ServletServerHttpRequest) request;rn HttpServletRequest req = servletRequest.getServletRequest();rn SysUser user = UserUtil.getUser(req);rn attributes.put("LOGIN_USER", user);rn rn return super.beforeHandshake(request, response, wsHandler, attributes);rn rn rnrn[/code]rnjs:rn[code=javascript]rn// WebSocket对象rnvar url = crmUrl.replace("http://","ws://") + "/dataPresentationWebSocketServer.do";rnvar _webSocket = rn socket : null, // WebSocket连接对象 rn host : '', // WebSocket连接 url rn connect : function() // 连接服务器 rn window.WebSocket = window.WebSocket || window.MozWebSocket; rn if (!window.WebSocket) // 检测浏览器支持 rn top.showMsg("", "当前浏览器不支持WebSocket,无法更新数据", true, "warning");rn return; rn rn this.socket = new WebSocket(this.host); // 创建连接并注册响应函数 rn this.socket.onopen = onOpenCallBack; rn this.socket.onmessage = onMessageCallBack; rn this.socket.onclose = function() rn _webSocket.socket = null; // 清理 rn ; rn , rn send : function(message) // 发送消息方法 rn if (this.socket) rn this.socket.send(message); rn return true; rn rn top.showMsg("", "WebSocket未连接!", true, "warning");rn return false; rn rn; rn// 初始化WebSocket连接 url rn_webSocket.host = url; rnrnif(!_webSocket.socket)rn //建立WebSocket连接rn _webSocket.connect();rnrn[/code]rnrn以上是代码,我在本机和sit环境测试的都没有问题,但是转测得时候由于域名格式不一样就有WebSocket connection to 'ws://crm.to3.mychebao.com/dataPresentationWebSocketServer.do' failed: Error during WebSocket handshake: Unexpected response code: 400这个问题rn本机WebSocket地址是http://127.0.0.1:8080/crm-web/dataPresentationWebSocketServer.dornsit环境地址是http://boss.sit2.mychebao.com:8080/crm-web/dataPresentationWebSocketServer.dorn转测之后地址是http://boss.to3.mychebao.com/dataPresentationWebSocketServer.dorn转测之后的环境是把端口号、项目名全部集成在一个域名下,这个环境就会报这个错,求大神帮忙看一下!!
Error during WebSocket handshake: Unexpected response code: 501
程序在tomcat7上运行没有问题,放到weblogic12c上浏览器端就报错。求各位大神看看,给点建议和思路。rnWebSocket connection to 'ws://10.230.0.85:7001/platform/chat/default?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.11-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json&X-atmo-protocol=true' failed: Error during WebSocket handshake: Unexpected response code: 501
Error during WebSocket handshake: Unexpected response code: 200
我做的 WebSockets 是用C# ashx文件做的服务器,但是前端访问的时候就报200的错,求大神告知!!!rn[img=https://img-bbs.csdn.net/upload/201712/21/1513854106_196662.png][/img]
spring整合websocket需求代码
spring整合websocket需求代码 包含所需POM配置以及前端和后台部分代码,复制到自己项目稍做更改即可
spring整合websocket完整代码
spring整合websocket完整代码,资源转载至网络
response 的一个404问题!
判断用户是否已登陆rnUser u = (User)session.getAttribute("user");rn if(u == null)rn response.sendRedirect("userLogin.jsp");rn return;rn rnrn总报404 找不到userLogin.jsp页面rn不知为什么!
Zencart页面打开正常 HTTP Server Response Code:404!!!!!
各位兄弟姐妹:rnrn大家好,本人在做一个Zencart(V1.39) 站点.在所有工作已接近尾声的时候我却晕了,这两天忽然发现一个问题.即:所有动态页面在浏览器里打开时是正常的,可以浏览.可是用HTTP Server Response Code Checker(这里有:http://www.searchenginepromotionhelp.com/m/http-server-response/code-checker.php) 检查Response Code时,却得到的是404.开始是怀疑.htaccess里由于rewrite rules 的影响(因装了个Ultimate Seo URLs 插件,为了转伪静态),可即使把RewriteEngine 设为Off以后问题依然存在.这是为何呢.哪位兄弟姐妹有碰到类似的问题吗,如何修正此错呢? 补充一点:手动做了一个简单test.php页面并上传到服务器,在检查此页面的Response Code时 是正常的:200 .小弟在此先谢大家了.
Spring整合websocket实现即时通讯聊天室
Spring-websocket 传统的HTTP协议,一般通过向服务器发送请求,拉取数据实现半双工通信,缺点是服务器难以直接向浏览器下发消息,因此,websocket协议应运而生,可用于向建立连接的浏览器主动下发任意数据(PUSH)。本项目基于Spring平台,整合websocket协议,实现一个简易web聊天室的功能。主要特性如下: 1.包含聊天室登录、退出的功能。登录时,浏览器自动向服务器发起websocket连接,退出时自动切断。 2.登录后,用户可查看到聊天室在线的用户列表,我们在服务器上通过一个hashmap始终记录了当前在线的用户列表; 3.登录的用户可以点击一个在线的其他用户,并给他发送消息,消息先提交给服务器,在通过服务器转发给另一端用户; 4.支持群发消息的功能,使用时,服务器会将收到的消息群发给当前在线的所有用户; 5.添加好友上线提醒和下线提醒的功能,当有好友上线或下线时自动通知所有其他在线人,不要刷新页面可看到实时在线用户列表。
Spring整合Netty、WebSocket的互联网聊天系统
0.前言 最近一段时间在学习Netty网络框架,又趁着计算机网络的课程设计,决定以Netty为核心,以WebSocket为应用层通信协议做一个互联网聊天系统,整体而言就像微信网页版一样,但考虑到这个聊天系统的功能非常多,因此只打算实现核心的聊天功能,包括单发、群发、文件发送,然后把项目与Spring整合做成开源、可拓展的方式,给大家参考、...
<日常学习篇>spring整合webSocket
今天在配置spring-websocket时,打开页面,老是出现错误,提示404路径错误,发现是因为sockjs总是在我的路径后面加上它自己的一些路径 我的配置: 实际显示的路径: 而我的tomcat配置的是.do路径请求,这样子永远找不到配置的websocket。没办法将tomcat的配置改成了/*; 然后又悲哀的发现了一个问题,静态资源路径请求404错误,查了半天是
WCF WebSocket Test Code
在Web应用中,HTTP协议决定了客户端和服务端连接是“短连接”,即客户端Request,服务端Response,连接断开。要想实现客户端和服务端实时通信,只能通过客户端轮询来实现。“服务端推送数据”也并不是字面上意思上的“直接推”,其实还是客户端“自己取”。在HTML5标准中新的Websocket协议可以在客户端和服务器之间无限制的连接,WebSocket 不仅更快,也更廉价,更简单。利用WebSocket,可以取代之前的ajax客户端轮询,真正实现从服务端到客户端的推送。
关于websocket链接404问题
1:核实自己链接到底对不对。 2:是否配置了代理转发的问题;比如https用Nginx代理转发配置玩是不需要加端口;而http没对应代理转发是需要加上端口号进行链接 3:以tomcat web服务器为例;查看对应的Lib包是否缺少websocket-api.jar的包;缺少的话请加上 4:防火墙问题;关闭即可...
WebSocket连接404(一种情况)
第一种情况 原因:这里是因为url的路径写错了,请仔细检查是否路径写错了(楼主这里忘了在端口号后面加上项目发布名了) 第二种情况 上一种情况,我使用的是SSM框架,后来想用Spring Boot来尝试一下,结果发现按照原来的写法无法连接。如果你使用的是Spring Boot请检查如下配置 声明将@ServerEndPoint的注解交由Spring管理 package com.yunx...
Spring整合redis出错
2016-04-28 18:50:16 ERROR [org.springframework.web.context.ContextLoader] Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.crazycake.shiro.RedisCacheManager' to required type 'org.springframework.cache.CacheManager' for property 'cacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)rn at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)rn at java.util.concurrent.FutureTask.run(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn at java.lang.Thread.run(Unknown Source)rnCaused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.crazycake.shiro.RedisCacheManager' to required type 'org.springframework.cache.CacheManager' for property 'cacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:474)rn at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511)rn at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn ... 20 common frames omittedrnCaused by: java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)rn at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459)rn ... 26 common frames omittedrn四月 28, 2016 6:50:16 下午 org.apache.catalina.core.StandardContext listenerStartrn严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.crazycake.shiro.RedisCacheManager' to required type 'org.springframework.cache.CacheManager' for property 'cacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:700)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)rn at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)rn at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)rn at java.util.concurrent.FutureTask.run(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)rn at java.lang.Thread.run(Unknown Source)rnCaused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.crazycake.shiro.RedisCacheManager' to required type 'org.springframework.cache.CacheManager' for property 'cacheManager'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:474)rn at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511)rn at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:505)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1502)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1461)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn ... 20 morernCaused by: java.lang.IllegalStateException: Cannot convert value of type [org.crazycake.shiro.RedisCacheManager] to required type [org.springframework.cache.CacheManager] for property 'cacheManager': no matching editors or conversion strategy foundrn at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)rn at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:459)rn ... 26 more
spring整合jpa出错
[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/32.gif][/img]请各位帮忙看看啊rnrn[code=text]log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment).rnlog4j:WARN Please initialize the log4j system properly.rn2013-9-29 20:30:15 org.hibernate.validator.util.Version rn信息: Hibernate Validator bean-validator-3.0-JBoss-4.0.2rnException in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.LocalValidatorFactoryBean#0': Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to instantiate Configuration.rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)rn at zzh.test.SchemeExport.main(SchemeExport.java:13)rnCaused by: javax.validation.ValidationException: Unable to instantiate Configuration.rn at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:272)rn at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:184)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)rn ... 12 morernCaused by: java.lang.NullPointerExceptionrn at java.util.ResourceBundle.getBundle(ResourceBundle.java:960)rn at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.loadBundle(ResourceBundleMessageInterpolator.java:202)rn at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.getFileBasedResourceBundle(ResourceBundleMessageInterpolator.java:182)rn at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.(ResourceBundleMessageInterpolator.java:81)rn at org.hibernate.validator.engine.ResourceBundleMessageInterpolator.(ResourceBundleMessageInterpolator.java:73)rn at org.hibernate.validator.engine.ConfigurationImpl.(ConfigurationImpl.java:57)rn at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43)rn at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)rn ... 15 morern[/code]
struts2 hibernate spring整合(出错的)
struts2 hibernate spring整合开发
Response 出错!!------------------在线等待
IIS+Resin2.12rn运行JSP程序没有问题rn<% Response.setHeader("Refresh","5");%>时出现: Undefined variable or class name: Response???rnrn请问如何解决?rn
spring整合websocket注入service失败问题
-
Spring整合dwr出现404找不到工程
rn 只要一在Spring 配置文件里配置 就报错 我都检查了,没发现我语法错误,真无语了啊rn[code="java"]rnrnrn rn rn rnrnrn rn rn rn rn rn rn rnrnrnrn rnrn[/code]rnrnrnrnDWR.xml配置rn[code="java"]rnrnrn rnrn rn rn rn rn rnrnrn[/code]rnrnrnweb.xml配置rn[code="java"]rnrnrn rn actionrn rn org.apache.struts.action.ActionServletrn rn rn configrn /WEB-INF/struts-config.xmlrn rn rn debugrn 3rn rn rn detailrn 3rn rn 0rn rnrn rn rn dwr-invokerrn uk.ltd.getahead.dwr.DWRServletrn rn debugrn truern rn rnrn rn rn actionrn *.dorn rn rn rn dwr-invokerrn /dwr/*rn rn rnrn rn index.jsprn rn rn rn rn contextConfigLocationrn rn /WEB-INF/classes/applicationContext.xmlrn rn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rnrnrnrnrnrnrn[/code]rnrnrnrnjava代码rn[code="java"]rnpublic class TestDwr rnrn private Services services;rnrn public Services getServices() rn return services;rn rnrn public void setServices(Services services) rn this.services = services;rn rnrn public String hehe(String ha)rn return ha+"嘿嘿";rn rn rnrnrn[/code]rnrnrnrnrnrnn[b]问题补充:[/b]n 工程就404错误啊,没异常哦n[b]问题补充:[/b]n 现在的问题是,根本找不到工程 如果去掉Spring的那个配置 可以找到工程rnrn/dwr 也是404 无法测试啊
404出错页面
404出错页面,下载可直接使用,直接用记事本打开即可使用
页面打不开404提示requested response is not available
页面问题:n1. ![图片说明](https://img-ask.csdn.net/upload/201604/04/1459773508_80000.png)n2. ![图片说明](https://img-ask.csdn.net/upload/201604/04/1459773530_74582.png)n3. ![图片说明](https://img-ask.csdn.net/upload/201604/04/1459773547_646903.png)n4. ![图片说明](https://img-ask.csdn.net/upload/201604/04/1459773561_569216.png)n5. ![图片说明](https://img-ask.csdn.net/upload/201604/04/1459773576_794523.png)
关于websocket连接报404的问题
问题描述及解决方法 Q&amp;amp;amp;amp;A 问题描述及解决方法 项目中遇到websocket连接报404的问题。解决方法如下: * 由于项目是有nginx的,首先检查nginx是否开启了websocket穿透,如下面代码展示: location / { proxy_pass http://entertain.sbc.com/xpe-products-sbc-entertai...
关于HTML5请求WebSocket,404的问题
最近在写服务器端主动推送到页面的内容 首先依赖环境是 WebSocket是HTML5才支持的 Java EE 7.0以后的版本才支持 Tomcat7以后的版本才支持 其他的服务容器则应该是有对应的自己支持的包 具体的如何请求和接受就不做记录了,主要似乎404的问题 而Oracle 自己的WebSocket包在目前为止最新的是 WebSocket-api1.0 releas...
websocket连接tomcat8服务器出现404
利用javax扩展包下的websocket API开发的websocket服务部署正常,代码如下: 构建maven工程,引入项目依赖jar包: &amp;lt;dependency&amp;gt;        &amp;lt;groupId&amp;gt;javax.websocket&amp;lt;/groupId&amp;gt;        &amp;lt;artifactId&amp;gt;javax.websocket-api&amp;lt;/arti...
SSM websocket 404问题如何解决?
如题,Struts Sping MyBatis框架,增加WebSocket功能ws请求出现404问题,可能是什么原因导致的?rn[img=https://img-bbs.csdn.net/upload/201703/19/1489910889_25892.png][/img]
Spring整合JSF服务器启动时出错....
严重: rnCant instantiate class: org.springframework.web.jsf.DelegatingVariableResolver.rnjava.lang.reflect.InvocationTargetExceptionrnrnrnSpring整合JSF的资料实在太少了。。囧啊。。rnrn[color=#FF0000]faces-config.xml[/color]rnrn rn rn rn org.springframework.web.jsf.DelegatingVariableResolver rn rn rn rn userrn com.mild.UserBeanrn requestrn rn rn iusrn #UserService rn rn rn umrn #UserModel rn rn rn rn rn /MyJsp.jsprn rn welcomern /welcome.jsprn rn rnrn rnrn[color=#FF0000]Web.xml[/color]rnrnrn rn rn contextConfigLocationrn /WEB-INF/classes/applicationContext.xmlrn rn rn rn rn org.springframework.web.context.ContextLoaderListenerrn rn rn rn rn javax.faces.CONFIG_FILESrn /WEB-INF/faces-config.xmlrn rn rn rn Faces Servletrn javax.faces.webapp.FacesServletrn 0rn rn rn rn Faces Servletrn *.facesrn rnrn
struts与spring整合出错,求大侠
为什么启动tomcat的时候会提示:rn2013-3-28 18:35:36 org.apache.catalina.startup.HostConfig checkResourcesrn信息: Reloading context [/SSHIntegeration]rn2013-3-28 18:35:36 org.apache.catalina.core.StandardContext stoprn信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/SSHIntegeration] has not been startedrn2013-3-28 18:35:39 org.apache.catalina.core.StandardContext filterStartrn严重: Exception starting filter struts2rnUnable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/ApacheSoftware/Tomcat6.0/webapps/SSHIntegeration/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)rn at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:131)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)rn at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)rn at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1116)rn at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1214)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)rn at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)rn at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)rn at java.lang.Thread.run(Thread.java:619)rnCaused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/D:/ApacheSoftware/Tomcat6.0/webapps/SSHIntegeration/WEB-INF/lib/struts2-core-2.0.14.jar!/struts-default.xml:30:72 - bean - jar:file:/D:/ApacheSoftware/Tomcat6.0/webapps/SSHIntegeration/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72rn at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)rn ... 21 morern2013-3-28 18:35:39 org.apache.catalina.core.StandardContext startrn严重: Error filterStartrn2013-3-28 18:35:39 org.apache.catalina.core.StandardContext startrn严重: Context [/SSHIntegeration] startup failed due to previous errorsrnrnrnrn求大侠指点
web开发 response PrintWriter.flush出错,求解!
rn一个WEB程序,用的是spring MVC 框架,用的是ajax,当多个浏览器同时访问该网页时,就会出错,代码段为:rn@RequestMapping(params="cmd=read")rn public void materialTypeRead(HttpServletRequest request,HttpServletResponse response,final Map model)rn isFinished = false;rn isSucceed = false;rn rn DefaultCallerHandler hdl = new DefaultCallerHandler()rn @Overridern public void errorDo(CallerEvent event) rn // TODO Auto-generated method stubrn jss.clear();rn jss.setSuccess(false);rn jss.wrapEventObject(event);rn rn model.put("result", jss.toMap());rn HttpServletResponse rsp = (HttpServletResponse)this.attribute("httpresponse");rn if(rsp==null) return;rn PrintWriter writer=null;rn tryrn rn writer = rsp.getWriter();rn writer.print(jss.toJSON());rn rn writer.flush();rn rn catch(Exception ex)rn rn rn rn finallyrn tryrn if(writer!=null) rn rn writer.close();rn rn rn catch(Exception ex)rn rn rn isFinished = true;rn isSucceed = false;rn rnrn @Overridern public void holdProcess() rn // TODO Auto-generated method stubrn jss.clear();rn jss.setSuccess(true);rn jss.setResult(this.getResultMap());rn model.put("result", jss.toMap());rn rn HttpServletResponse rsp = (HttpServletResponse)this.attribute("httpresponse");rn if(rsp==null) return;rn PrintWriter writer=null;rn tryrn writer = rsp.getWriter(); rn writer.print(jss.toJSON());rn writer.flush(); //这里出错,flush就出错,rn rn rn catch(Exception ex)rn System.out.println("error flush :"+this.toString()+" writer:"+writer);rn ex.printStackTrace();rn rn rn finallyrn tryrn if(writer!=null) rn writer.close();rn rn rn rn catch(Exception ex)rn System.out.println("error close :"+this.toString());rn ex.printStackTrace();rn rn rn rn rn isFinished = true;rn isSucceed = true;rn rn ;rnSystem.out.println("hdl:"+hdl); rn hdl.attributeValue("httpresponse", response);rn Executor exe = new Executor();rn Map npm = new WebUtil().copyRequestMapCompress(request);rn int pagesize=0;rn String ps = (String)npm.get("pageSize");rn if(ps!=null ) rn tryrn pagesize = Integer.valueOf(ps).intValue();rn catch(Exception e)rn rn rn if(pagesize>0)rn npm.put("rowsperpage", pagesize);rn npm.remove("pageSize");rn rn rn ps = (String)npm.get("start");rn rn if(ps!=null) rn int start=0;rn tryrn start = Integer.valueOf(ps).intValue();rn catch(Exception e)rn if(pagesize>0) rn npm.put("curpage", (start/pagesize) +1);rn rn rn ISessionFrom sf = new SessionFromHttpSession();rn try rn sf.make(request.getSession());rn catch (Exception e) rn // TODO Auto-generated catch blockrn jss.clear();rn jss.setSuccess(false);rn Map obj = new HashMap();rn obj.put("error", e.getMessage());rn obj.put("errorcode", 3001);rn jss.setResult(obj);rn try rn response.getWriter().write(jss.toJSON());rn response.getWriter().flush();rn catch (IOException e1) rn // TODO Auto-generated catch blockrn rn rn finallyrn isSucceed=false;rn isFinished = true;rn rn return;rn rn rnrn if(npm.containsKey("link"))rn String _v = String.valueOf(npm.get("link"));rn if( _v.equalsIgnoreCase("and") ) npm.remove("link");rn rn exe.request("logistics.materialtype.select", null, npm, hdl);rn rn while(!isFinished)rn try rn Thread.currentThread().sleep(50);rn catch (InterruptedException e) rn // TODO Auto-generated catch blockrn rn rn rn错误提示如下:rnerror flush :com.qt.eis.web.bz.material.MaterialTypeParentCRUD$1@1cb9b56 writer:org.apache.catalina.connector.CoyoteWriter@93deccrnorg.apache.tomcat.jni.Error: APR does not understand this error codern at org.apache.tomcat.jni.Socket.sendbb(Native Method)rn at org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:694)rn at org.apache.coyote.http11.InternalAprOutputBuffer.flush(InternalAprOutputBuffer.java:284)rn at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:1007)rn at org.apache.coyote.Response.action(Response.java:183)rn at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:314)rn at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:288)rn at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:95)rn at com.qt.eis.web.bz.material.MaterialTypeParentCRUD$1.holdProcess(MaterialTypeParentCRUD.java:107)rn at com.qt.eis.rcp.remote.DefaultCallerHandler.process(DefaultCallerHandler.java:71)rn at com.qt.eis.rcp.remote.DefaultCallerHandler.run(DefaultCallerHandler.java:91)rn at java.lang.Thread.run(Thread.java:619)rnrn按理每个浏览器进程式都有一个独立的访问通道,有一个独立的response和PrintWriter,从出错的原理看,好像是在同时访问,把buffer或是writer给消失了!rn不知真正的原因是什么,请教高手帮解决,找出问题!
stub客户端Response保存出错
用Axis2 创建一个webservice stub端。当调用stub.reponse的保存方法时,出错。rnorg.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'; nested exception is: rn org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'; nested exception is: rn org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'; nested exception is: rn org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)rn at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:670)rn at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:365)rn at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:295)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:514)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)rn at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)rn at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)rn at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)rn at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)rn at java.lang.Thread.run(Thread.java:595)rnCaused by: org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'; nested exception is: rn org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:340)rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:205)rn ... 28 morernCaused by: org.apache.axis2.AxisFault: HTTP Transport error : '404' - '/plugin/services/ServiceMgmtService'rn at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:144)rn at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:334)rn ... 29 morern可能提供的信息比较少。rn大家有遇到类似的情况望提供下信息。rn回复都有分
c#出错。。Response is not available in this context
using System;rnusing System.Data;rnusing System.Configuration;rnusing System.Web;rnusing System.Web.Security;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing System.Web.UI.WebControls.WebParts;rnusing System.Web.UI.HtmlControls;rnrn/// rn/// Summary description for globalfuncrn/// rn/// rnnamespace globalfuncrnrn public class globalfuncc : System.Web.UI.Pagern rn public void globalfuncf(ref int mm)rn rn mm = mm + 1;rn rn Response.Write(" ");////这句出现错误。出错如下。。rn rnrn rnrnrn这是我自定义的一个命名空间。我的本意是将其做为全局的函数来调用。rn可是程序一到response.write...这句时就会报错,:Response is not available in this context.这是为何呢?如果在外面定义为一个函数则没有任何问题。我将上面所写的代码放在app_code中。请高手指教。rn
多线程下载时HTTP response code: 416 解决方案
今天用java写的多线程下载报错,找了很久,发现是第一次请求服务器时响应码正常,开启多线程部分的响应码为416,响应码对应的意思可以去这里看看点击打开链接。主要意思就是public void setRequestProperty (String field, String newValue)出现了错误,设置的下载字节范围和访问文件大小有出入,要么就是上面确认各个线程的下载范围出现问题,要么
Server returned HTTP response code: 502 for URL
我用下面这种请求方式获得卓越网的网页内容,以前还正常,但现在出现Server returned HTTP response code: 502 for URL:http://www.amazon.cn/mn/searchApp?keywords=java&searchKind=keyword这个异常,,难道是卓越网因为我访问比较频繁,拒绝了我的访问,它应该是通过头信息知道的吧?我可以隐藏一些头信息去访问吗?或者有其它的好方法吗,可以怎么处理啊? rn URL u = new URL("http://www.amazon.cn/mn/searchApp?keywords=java&searchKind=keyword");rnrn URLConnection urlconn = u.openConnection();rn urlconn.connect();rn BufferedReader in = new BufferedReader(new InputStreamReader(urlconnrn .getInputStream(), "UTF-8"));
Server returned HTTP response code: 403 for URL:
出现这种问题很头痛,不知道是不是访问不到对端服务,还是有其它问题n2017-3-21 9:05:03 com.sun.xml.ws.server.sei.TieHandler createResponsen严重: 无法访问位于以下位置的 WSDL: http://xxxxxxx?wsdl。该操作失败并显示:nServer returned HTTP response code: 403 for URL: http://xxxxxx?wsdl。njavax.xml.ws.WebServiceException: 无法访问位于以下位置的 WSDL: http:xxxxxxxx?wsdl。该操作失败并显示:nServer returned HTTP response code: 403 for URL: xxxx
Server returned HTTP response code: 503 for URL:
请教rn使用SAX 在解析的时候报 Server returned HTTP response code: 503 for URL:rn代码如下:rnimport javax.xml.parsers.ParserConfigurationException;rnimport javax.xml.parsers.SAXParser;rnimport javax.xml.parsers.SAXParserFactory;rnrnimport org.xml.sax.Attributes;rnimport org.xml.sax.SAXException;rnimport org.xml.sax.helpers.DefaultHandler;rnrnimport java.io.InputStream;rnimport java.net.URL;rnpublic class SaxTest rn public static void main(String []args)rn String url = null;rn if (args.length == 0 )rn url = "http://www.w3c.org";rn System.out.println("Using "+url);rn else rn url = args[0];rn rn DefaultHandler handle = new DefaultHandler()rn public void startElement (String uri, String localName,rn String qName, Attributes attributes) throws SAXExceptionrn if(localName.equalsIgnoreCase("a") && attributes != null)rn for (int i = 0 ;i
Server returned HTTP response code: 500 for URL
[code=java]import java.io.*;rn import java.net.MalformedURLException;rnimport java.net.URL;rn rnpublic class writeFile rnrn public static void main(String[] args) rn // TODO Auto-generated method stubrn writeFile test = new writeFile();rn test.writeFile("http://avatar.csdn.net/E/0/B/1_maggiehexu.jpg", "001.jpg");rn test.writeFile("http://w13.myzcm.com/2010/04/赵红旗/6/01.jpg", "002.jpg");rn rnrn rnrn public static void writeFile(String strUrl,String fileName)rn URL url = null;rn try rn url = new URL(strUrl);rn catch (MalformedURLException e2) rn e2.printStackTrace();rn rn InputStream is = null;rn try rn is = url.openStream();rn catch (IOException e1) rn e1.printStackTrace();rn rn OutputStream os = null;rn File f = new File("d:\\Webimg\\");rn f.mkdirs();rn tryrn os = new FileOutputStream("d:\\webimg\\"+fileName);rn int bytesRead = 0;rn byte[] buffer = new byte[8192];rn rn while((bytesRead = is.read(buffer,0,8192))!=-1)rn os.write(buffer,0,bytesRead);rn rn catch(FileNotFoundException e)rn rn catch (IOException e) rn e.printStackTrace();rn rn rnrnrn[/code]rn第一个网址就能获得图片,第二个网址就不能。rn
Server returned HTTP response code: 505 for URL
HttpURLConnection conn =null;rnBufferedReader br = null;rnString strLine = "";rnURL urlObj = new URL(url);rnconn = (HttpURLConnection)urlObj.openConnection();rnconn.setUseCaches(false);rnconn.setDoInput(true); rnconn.setRequestMethod("POST"); rnInputStream in = conn.getInputStream(); rnbr = new BufferedReader(new InputStreamReader(in));rnwhile ((strLine = br.readLine()) != null) rn returnContent += strLine;rnrnin.close();rn我用这种方式去传递参数,post方式.我的URL地址如果很长的话,当我运行到InputStream in = conn.getInputStream(); 这一步就报如题的错误.短的话就不会.而且我用这种方式在别人电脑上运行,却不会出现这种错误,然道是我自己电脑设置不对,求解决.求各位大神帮帮忙,急啊!
Server returned HTTP response code: 405 for URL
java.io.IOException: Server returned HTTP response code: 405 for URL: http://s.web2.qq.com/api/get_user_friends2rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)rn at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)rn at biz.QQClient.httpURLConnectionConnect(QQClient.java:319)rn at biz.QQClient.loginWebIM(QQClient.java:234)rn at biz.QQClient.main(QQClient.java:384)rnCaused by: java.io.IOException: Server returned HTTP response code: 405 for URL: http://s.web2.qq.com/api/get_user_friends2rn at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)rn at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(Unknown Source)rn at biz.QQClient.httpURLConnectionConnect(QQClient.java:312)rn ... 2 morernException in thread "main" java.lang.NullPointerExceptionrn at biz.QQClient.httpURLConnectionConnect(QQClient.java:366)rn at biz.QQClient.loginWebIM(QQClient.java:234)rn at biz.QQClient.main(QQClient.java:384)rnrnrnrn求给力。
org.apache.thrift.transport.TTransportException:http response code 400如何解决
在数据上传时执行一段时间后,出现org.apache.thrift.transport.TTransportException:http response code 400,数据停止上传,再重新执行上传数据的方法,又是执行一段时间报同样的错误,出现这种错误的原因是什么,怎么解决。
Server returned HTTP response code: 502 for URL:????
用Java写爬虫爬取网页返回java.io.IOException: Server returned HTTP response code: 502 for URL: ???rn我已设置代理 conn.setRequestProperty("User-Agent",rn"Mozilla/5.0 (Windows NT 6.2; " +rn"WOW64; rv:20.0) ");rn还是无法访问rn求各位大神是怎么解决?
相关热词 c#异步发送kafka c#窗体编号 c# 操作二进制文件 c# 反射 机制 c#线程 窗体失去响应 c#角度转弧度 c# 解析gps数据 c# vs设置 语法版本 c# json含回车 c#多线程demo