请教图片验证码在本地测试没问题,放到服务器报空指针,请求帮助

图片验证码在本地测试一切正常,放到服务器,画布的时候报空指针。下面还有代码
java.lang.NullPointerException: null
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
at sun.awt.FontConfiguration.init(FontConfiguration.java:107)
at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:774)
at sun.font.SunFontManager$2.run(SunFontManager.java:431)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.(SunFontManager.java:376)
at sun.awt.FcFontManager.(FcFontManager.java:35)
at sun.awt.X11FontManager.(X11FontManager.java:57)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.awt.Font.getFont2D(Font.java:491)
at java.awt.Font.access$000(Font.java:224)
at java.awt.Font$FontAccessImpl.getFont2D(Font.java:228)
at sun.font.FontUtilities.getFont2D(FontUtilities.java:180)
at sun.java2d.SunGraphics2D.checkFontInfo(SunGraphics2D.java:669)
at sun.java2d.SunGraphics2D.getFontInfo(SunGraphics2D.java:830)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:50)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2928)
at com.lanmei.common.ImageUtil.createimage(ImageUtil.java:77)
at com.lanmei.controller.WeChatUserInfoController.Random(WeChatUserInfoController.java:604)
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.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:591)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

public class ImageUtil {

//1.定义变量保存生成后的验证码字符串
static String code = "";
//创建一个不带透明色的BufferedImage对象,TYPE_INT_ARGB为带透明色

// private static BufferedImage bi = new BufferedImage(130, 50, BufferedImage.TYPE_INT_RGB);

//2.生成验证码
public static String createcode() {
    String a = "0123456789";//随机生成的字符范围(0-9,a-z,A-Z)

//生成验证码的位数(这里是4位)
for (int i = 0; i < 4; i++) {
int index = (int) (Math.random() * 10);//会产生一个[0,62)的数,不包含小数
char b = a.charAt(index);
code = code + b;
}
return code;
}

//查看已经生成的验证码
public static String getCode() {
    return code;
}

//3.生成图片
public static BufferedImage createimage() {

// 前2个参数为:width, height.后面是图像类型
BufferedImage bi = new BufferedImage(130, 50, BufferedImage.TYPE_INT_RGB);

//1.得到一个画布
Graphics g = bi.createGraphics();
//2.添加背景颜色
if (g != null) {

        g.setColor(Color.WHITE);
        g.fillRect(0, 0, 130, 50);

//3.添加干扰线
for (int i = 0; i < 10; i++) {
Random r = new Random();
int red = r.nextInt(256);
int green = r.nextInt(256);
int blue = r.nextInt(256);
Color c = new Color(red, green, blue);
g.setColor(c);
int x1 = r.nextInt(131);
int y1 = r.nextInt(51);
int x2 = r.nextInt(131);
int y2 = r.nextInt(51);
g.drawLine(x1, y1, x2, y2);//画线
//g.drawOval(x1, y1, x2, y2);//画曲线
}

//3.添加文字

        g.setColor(Color.BLACK);
        g.setFont(new Font("宋体", Font.BOLD, 50));

        String str = createcode();
        //4.将文字填充到画板中

        g.drawString(str, 15, 40);
       //getDrawString(str, 15, 40);

//5.关闭画布
g.dispose();
}
return bi;
}

1个回答

不贴错误,鬼知道。猜测是文件路径的问题

Telunsu01
回复Telunsu01: 在第五个框 中的 g.drawString(str, 15, 40); 是77行
7 个月之前 回复
Telunsu01
回复真-酸辣土豆丝: g.drawString(str, 15, 40); 这里是77行 在关闭画布上面一点 我用了很多工具类都是这里报空指针。
7 个月之前 回复
Telunsu01
回复真-酸辣土豆丝: 全部代码已贴,不知道对不对,新手一枚,请多见谅。
7 个月之前 回复
qq_18630487
真-酸辣土豆丝 回复Telunsu01: ImageUtil.java:77前后代码贴出来
7 个月之前 回复
Telunsu01
你好 请帮忙看下 已贴错误
7 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
大虾帮助阿!!!我在本地测试好好的,但放到服务器就崩溃了,还有空指针错误
我在本地开了2天,并且天天测试,可是放到服务器上几个小时就崩溃了rn现在没办法了,我也问好几次了,该修改的我也修改了,帮我想想还有什么地方会错误那rn谢谢给位
本地测试没问题的项目。服务器显示异常。
求助各位大神n以前生产没问题。这次更新后报表主体不显示了。n生产上的项目拿到本地也正常显示。n服务器是websphere 在linux上。n有哪些可能性?
水晶报表在本地没问题,放到服务器提示:错误,数据库登陆失败!
我的水晶报表在服务器正常运行,今天需求要多显示一个字段,我改了之后在本地运行完全没有错误,但放到服务器上后提示:错误,数据库登陆失败!我确定用户名和密码没错,不知是什么原因,求解决?
web项目本地启动没问题,放到服务器启动无法加载类异常
web项目,在本地跑起来是没有问题的,放到服务器,启动tomcat提示java.lang.ClassNotFoundException: Could not load requested class : cn.rongcloud.crm.domain.CustDeploymentDocument
本地测试没问题,在线测试出问题
You have an error in your SQL syntax near 'javas cript' > alert("< %=yourvar% >") < /s cript > 11.有没有办法保护自? at line 1rnrn===========================================================rn不知道什么意思?找不出原因
图片验证码本地测试没有问题,发到服务器上就...
图片验证码本地测试没有问题,发到服务器上.明明是对的,就是显示验证码错误!找不到理由...代码如下;rn生成图片的PHP页rn[code=PHP][/code]rn----------rn验证页面代码rn[code=PHP][/code]
传到服务器出错?在本地没问题
[color=#FF0000]如题[/color]rn传到服务器后,会有这个错误“在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接) rn”rnrn在本地没有任何问题,本地中的数据库也是链接的服务器的,但一传到服务器就出错rnrn请问大家这会是什么原因啊
HashMap报空指针,求帮助啊!!!
public static void main(String[] args) rn StudentService studentService = new StudentService();rn Student student=null;rn for (int i=1; i<=10;i++)rn if(i<5)rn student = new Student(i,"student"+i,"s100"+i);rn rn elsern student = new Student(i,"studnet"+i,"s200"+i);rn rn studentService.addStudent(student);//执行到这边的时候报错了。rn rnrnpublic class StudentService rn public HashMap students = null ;rn public void StudnetService()rn students = new HashMap();rn rn public void addStudent(Student student) rn if(student==null)rn System.out.println("error!!!!!!!!!!");rn elsern System.out.println(student);rn rn if(student.getStuName()==null)rn System.out.println("error2222!!!!!!!!!!");rn elsern System.out.println(student.getStuName());rn rn rn students.put(student.getStuName(), student);rn rnrnrn rnrn定义了一个Student类rnpublic class Student rn private String StuName;rn private int stuNo;rn private String ClassName;rn public Student(int stuNo, String stuName, String ClassName ) rn super();rn this.StuName = stuName;rn this.stuNo = stuNo;rn this.ClassName = ClassName;rn rn public String getStuName() rn return StuName;rn rn还有有其他参数的get和set就没贴了。rnrnrn调用add方法的时候打印出来的两个参数都不为空啊,rn值分别是student [StuName=student1, stuNo=1, ClassName=s1001]和rnstudent1,但是为啥put的时候就出错了呢rn
在本地运行没问题,到服务器上就报错了,tomcat报错
30-Jul-2018 16:17:11.693 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger fo...
ASP本地服务器--本地测试
ASP本地服务器--本地测试--一直在用,挺好的,简单实用
本地运行没问题,上传linux报404
修改Tomcat的server.xml,在&amp;lt;Host&amp;gt;标签里添加&amp;lt;Context path=&quot;&quot; docBase=&quot;&quot; /&amp;gt;问题解决
请求地址没问题,但报400
总结:前端参数与后台参数数据类型不一致导致。 详见下: 实体类中: private Integer gameId; controller: gameId又作为参数  为了将前端传过来的参数直接封装进实体类,前端参数名需要与参数命名保持一致,但前端传过来的参数都是String类型。故报400,解决可以将pojo中属性命名为String即可。...
测试请求,报415的解决方法
在进行测试时,发现请求返回415 解决方法: 把headers中Content-Type写为application/json 然后这个post请求中的参数是要放到URL中去的,而不是放到body里 原因 Query String Parameters里面的参数要放到URL里,不能放到body里,不然服务器识别不出来。 问题解决 ...
本地测试jmail没问题,放服务器就有问题了
在服务器上提示错误The message was undeliverable. All servers failed to receive the messagern但本地测试是没有问题的.搞了我一个上午,好纠结啊rnrn我的代码rn[code=C#]rn public void sendmail(string str)rn rn jmail.MessageClass Jmail = new jmail.MessageClass();rn Jmail.Silent = false;rn Jmail.Logging = true;rn Jmail.Charset = "UTF-8";rn Jmail.AddRecipient("book@okhotel.com", "", "");rn Jmail.From = "book@okhotel.com";rn Jmail.MailServerPassWord = "";rn Jmail.Subject = "";rn Jmail.Body = "";rn Jmail.Send("mail.okhotelcn.com", false);rn Jmail.Close();rn rn[/code]rnrn同时,用同事给我的asp代码测试没有问题rn[code=C#]rn<%rnrnCall Jmail(Uname,uemail,mailsubject,mess)rnrnrnSub Jmail(Uname,Email,Topic,Mailbody)rn On Error Resume Nextrn Dim JMailrn Set JMail = Server.CreateObject("JMail.Message")rn JMail.silent=truern JMail.Logging = Truern JMail.Charset = "utf-8"rn rn JMail.MailServerUserName = "book@okhotel.com" rn JMail.MailServerPassword = "" '密码rn rn JMail.ContentType = "text/html" rn JMail.Priority = 1rn JMail.From = "book@okhotel.com" '邮件服务器 rn JMail.FromName = "发件人姓名" 'rn JMail.AddRecipient "book@okhotelcn.com" '收件人邮箱rn JMail.Subject = "邮件主题" 'rn JMail.Body = "邮件正文" 'rn JMail.Send ("mail.okhotel.com") 'smtp服务器地址rn Set JMail = Nothingrn SendMail = "OK"rn Response.Write "发送成功"rnEnd Subrn%>rn[/code]
本地测试没问题,上传到服务器错误了
asp.net的程序,里面套了一个留言板,不知道为什么,在本地测试没问题,传到服务器就出现rn“/”应用程序中的服务器错误。rn--------------------------------------------------------------------------------rnrn运行时错误 rn说明: 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。但可以通过在本地服务器计算机上运行的浏览器查看。 rnrn详细信息: 若要使他人能够在远程计算机上查看此特定错误信息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 标记。然后应将此 标记的“mode”属性设置为“Off”。rnrn...rn请问怎么能解决呢
本地样式测试没问题,部署到服务器上就出现问题
本地用的是IE9浏览器测试,部署到服务器上也是用IE9浏览器测试,但是样式出了问题rnCSS路径是绝对没错的!rn求大神帮忙找下原因,为什么本地没问题,部署到服务器就有问题!rn网址:http://test.idnoo.com/index.htmlrn这是服务器样式:rn[img=https://img-bbs.csdn.net/upload/201404/07/1396806712_403913.jpg][/img]rn这是本地样式:rn[img=https://img-bbs.csdn.net/upload/201404/07/1396806680_892158.jpg][/img]rn
本地测试没问题,传服务器就出问题,望高人指点。
js部分:rn rnrn我现在弄的就是一个图片切换src显示的:rnrn<%for i=1 to ubound(pic)%>rn rn rn rn <%rn nextrn %>rn这是小图部分rnrn显示部分:rnrnrnrn我在本地测试的都没问题rn可是上传到服务器,发现只有最后一张小图点击会切换,而点其他的都不会切换rnrn这是什么问题啊,小弟菜鸟,望高人指点,谢谢
本地测试没问题,传到服务器上出现乱码?
个人网站,在本地址测试没问题。rn传到服务器上去后,网站地址:http://www.jhsybin.com/flash/ ,点"博客日志"(用的PJBlog3程序)后,主页就出乱码,关闭浏览器,再重新打开又正常了,但一点点"博客日志"又出来乱码。rnrn如“站点日志”asp页面:http://www.jhsybin.com/flash/webNews.asp 点"博客日志"后,这个页面就有乱码。rn“站点日志”asp代码如下,是不是这里代码有问题?rn[code=VBScript]rn<%@ Language=VBScript %>rnrn<%rnDim PageSizerndim rsrnrnPageSize=15rnrnDim i rnDim intPageCountrnDim intRecordCountrnDim pagernif isempty(Request("Page")) thenrn Page=1rnelsern if isnumeric(request("page")) thenrn on error resume nextrn Page=clng(abs(Request("Page")))rn if err.number<>0 thenrn Page=1rn err.clearrn end ifrn on error goto 0rn elsern Page=1rn end ifrnend ifrnrnResponse.ContentType = "text/xml"rnResponse.Expires = -1rnResponse.Write ""rnResponse.Write "intPageCount thenrn page=intPageCountrn end ifrn rs.AbsolutePage=Pagern rn Response.Write "PageCount="""&intPageCount&""" RecordCount="""&intRecordCount&""" AdminLog="""&AdminLogFlag&""">"rn rn for i=1 to pagesizern if rs.EOF thenrn exit forrn end ifrn Response.Write ""rn rn Response.Write ""rn Response.Write rs("id")rn Response.Write ""rn rn Response.Write ""rn Response.Write rs("date")rn Response.Write ""rnrn Response.Write ""rn Response.Write rs("content")rn Response.Write ""rnrn Response.Write ""rn rs.MoveNextrn NEXTrn END IF rnrn rs.Closern Set rs=nothingrnResponse.Write ""rn%>rn[/code]
项目部署到服务器后,上传文件出现空指针异常(本地测试没问题)
前言: 项目上线,本地测试工作已经完美结束,不料,当部署到网络服务器时却出现 文件上传 空指针异常 吓了个半死,赶紧加班加点修复,但一直没找到问题所在。因为本地测试没有问题啊!!! 问题描述: 项目中有文件上传功能,本地测试没有问题,但正式部署后上传出现空指针异常(异常代码如下)。反复检测,代码没有问题。但服务器获取项目名为空。经过多次测试,发现,上传小文件(200kb以内)可以上传成功。 ...
无组件上传的问题-本地测试没问题-服务器运行出错
strFileName = Request.Form("file")rnrnrn rn Set objStream=Server.CreateObject("ADODB.Stream")rn objStream.Type=1rn objStream.Openrn objStream.LoadFromFile strFileNamern objStream.SaveToFile Server.MapPath("\jp\" & StrF),2 rn objStream.Close rn rnrnrnrnrnADODB.Stream 错误 '800a0bba' rnrn文件无法被打开。 rnrn/admin/Manage-Style.asp,行 136 rnrnrnrnrnrn我本地测试上传是没有问题的,为什么在服务器上就不行rn
网站在本地测试没问题,发布到服务器上出问题……
网站在本地测试没问题,发布到服务器上出问题……有的时候可以访问,有的时候就报下边的错误,还有的时候出现数据库连接池达到最大。很是郁闷。rnrnrn错误如下:rnServer Error in '/' Application.rn--------------------------------------------------------------------------------rnrnObject reference not set to an instance of an object. rnDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. rnrnException Details: System.NullReferenceException: Object reference not set to an instance of an object.rnrnSource Error: rnrnrnLine 19: rnLine 20: CorporateCultureSystem system = new CorporateCultureSystem();rnLine 21: CorporateCulture culture = system.Get_CorporateCulture();rnLine 22: this.lblCulture.Text = culture.CorporateCulture1;rnLine 23: rn rnrnSource File: d:\clientweb\libing003\wwwroot\CorporateCultureUI.aspx.cs Line: 21 rnrnStack Trace: rnrnrn[NullReferenceException: Object reference not set to an instance of an object.]rn DAL.CorporateCultureSQL.Get_CorporateCulture() in F:\HaiRong\DAL\CorporateCultureSQL.cs:44rn BLL.CorporateCultureSystem.Get_CorporateCulture() in F:\HaiRong\BLL\CorporateCultureSystem.cs:19rn CorporateCultureUI.BinData() in d:\clientweb\libing003\wwwroot\CorporateCultureUI.aspx.cs:21rn CorporateCultureUI.Page_Load(Object sender, EventArgs e) in d:\clientweb\libing003\wwwroot\CorporateCultureUI.aspx.cs:15rn System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14rn System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35rn System.Web.UI.Control.OnLoad(EventArgs e) +99rn System.Web.UI.Control.LoadRecursive() +50rn System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627rnrn
本地测试没问题,到服务器ajax调用后台方法就不行
[img=https://img-bbs.csdn.net/upload/201703/27/1490580285_897761.png][/img][img=https://img-bbs.csdn.net/upload/201703/27/1490580290_870803.png][/img]rn我是web应用程序,本地发布之后传到服务器.后台方法调用不到.提示[img=https://img-bbs.csdn.net/upload/201703/27/1490580404_408689.png][/img]
图片验证码是请求服务器的,如何实现局部刷新
局部刷新,只需在后面加一个随机数,即可改变他的地址,或者随便加个参数src="www.xxx.com?id="+Math.random();   function refresh(){ document.getElementById("yzm").src="www.xxx.com?"+Math.random(); }
[xmlhttp问题] 为什么我的这段程序在本地测试没问题,放到服务器就无限等待没反应呢?
Dim objXMLHTTP, xmlrn Set xml = Server.CreateObject("Microsoft.XMLHTTP")rn rn xml.Open "GET", ServerURL, Falsern ' Pull the data from the web pagern xml.Sendrnrn strPageData = xml.ResponseBodyrn strPageData = BytesToBstr(strPageData,"GB2312")rn Set xml = Nothingrnrn为什么呢???rn有人遇到过么?
http本地测试服务器
轻便的http服务端/不用装IIS可以开网站哦.无壳无毒.绝对安全请放心
APMServ--PHP本地测试服务器
本地测试服务器,APMServ--PHP本地测试服务器。
Android请求服务器报错了
java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequestrn at test.TestNet.testHttp(TestNet.java:14)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at junit.framework.TestCase.runTest(TestCase.java:168)rn at junit.framework.TestCase.runBare(TestCase.java:134)rn at junit.framework.TestResult$1.protect(TestResult.java:110)rn at junit.framework.TestResult.runProtected(TestResult.java:128)rn at junit.framework.TestResult.run(TestResult.java:113)rn at junit.framework.TestCase.run(TestCase.java:124)rn at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequestrn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClassInternal(Unknown Source)rn ... 17 morernrn这是测试代码啊rnpublic void testHttp()rn HttpClientAdapter adapter = new HttpClientAdapter();rn Map params = new HashMap();rn params.put("test", "1");rn String result = adapter.sendPost("http://127.0.0.1/Mytest", params);rn Log.i(TAG, result);rn rnrn导进去好几个包最后报了这个错rn
.net服务器报请求出错
最近在用.net做excel导入到数据库,在本地上运行正常,但在服务器就提示服务器请求出错,也没有提示任何代码提示。在网上找了好久才慢慢发现原因。 1.首先在web.config中的<system.web></system.web>中添加<customErrors mode="Off"/> ,添加后重新上传到服务器就会有代码错误提示。 上传后,提示的错误为: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local mach
ajaxpro2本地测试正常,但是放到服务器就错
服务器方法返回的是DATATABLE,本地测试正常,但是放到服务器,返回的datatable为NULL,肯定是有数据的!WEB.CONFIG配置正常,还有服务器.ashx也按收索的文章配置了,搞了一下午了,能用的方法全用了!都不行,关键是昨天早上ajaxpro2用的好好的能读出数据(数据库没有发生任何变化!),但是昨天下午不行了,提示DATATABLE为NULL或不是对象,但是同样的东西在VS2005调试的时候全部正常,重新发布网站,吧新编译的东西重新放服务器也没有用(老文件我是全部删除之后才放新文件的。ajaxpro.2.dll,WEB.CONFIG等改放的都放了甚至连几个.ASHX文件都放上去了)还是不行!崩溃了
browser文件本地测试有效,放到服务器上无效!!!
小弟为了解决url重写postback问题写了个browser文件,在本地测试有效,可放到服务器上无效啊!求解!!!rnrn[b]browser文件内容如下:[/b]rn[code=HTML]rnrn rn rn rn rn rnrn[/code]rnrn[b]browser调用的内容如下:[/b]rn[code=C#]rnnamespace Sample.Web.UI.Adaptersrnrn public class ControlAdaptorrn rn public ControlAdaptor()rn rn //rn // TODO: 在此处添加构造函数逻辑rn //rn rn rnrn public class FormRewriterControlAdapter : System.Web.UI.Adapters.ControlAdapterrn rn protected override void Render(HtmlTextWriter writer)rn rn base.Render(new RewriteFormHtmlTextWriter(writer));rn rn rnrn public class RewriteFormHtmlTextWriter : HtmlTextWriterrn rn public RewriteFormHtmlTextWriter(HtmlTextWriter writer)rn : base(writer)rn rn this.InnerWriter = writer.InnerWriter;rn rnrn public RewriteFormHtmlTextWriter(TextWriter writer)rn : base(writer)rn rn this.InnerWriter = writer;rn rnrn public override void WriteAttribute(string name, string value, bool fEncode)rn rn if (name == "action")rn rn HttpContext context = HttpContext.Current;rnrn if (context.Items["ActionAlreadyWritten"] == null)rn rn value = context.Request.ServerVariables["HTTP_X_REWRITE_URL"] ?? context.Request.RawUrl;rn context.Items["ActionAlreadyWritten"] = true;rn rn rnrn base.WriteAttribute(name, value, fEncode);rn rn rnrn[/code]
本地测试修改可以,放到服务器上就报错
报错代码:rnrnUPDATE `goods` SET `freight_payer`="buyer", `detail_url`="http://item.taobao.com/item.htm?id=35141486991&spm=2014.21609800.0.0", `title`="实拍秋冬新款 百搭扣千格鸟修身 小脚长裤", `pic_url`="http://img02.taobaocdn.com/bao/uploaded/i2/14141028695665324/T16kGOFapeXXXXXXXX_!!0-item_pic.jpg", `price`="59.00", `coupon_price`="59.00", `begin_time`="1382976000", `end_time`="1384704000", `promote_id`="6", `category_id`="0", `num`="3000", `pindao_id`="6", `description`="" WHERE `id`=""rnrn[code=php]query($sql) as $row)rnrn $id = $row['id'];rn $detail_url = $row['detail_url'];rn $title = $row['title'];rn $pic_url = $row['pic_url'];rn $price = $row['price'];rn $coupon_price = $row['coupon_price'];rn $begin_time = $row['begin_time'];rn $end_time = $row['end_time'];rn $title = str_replace("<", "[", $title);rn $title = str_replace(">", "]", $title);rn $promote_id= $row['promote_id'];rn $pindao_id= $row['promote_id'];rn $category_id = $row['category_id'];rn $num=$row['num'];rn $nick=$row['nick'];rn $description=$row['description'];rn $freight_payer = $row['freight_payer'];rnrnrn$updateMessage='';rn$dopost = isset($_POST['dopost'])?$_POST['dopost']:'';rnif ($dopost == 'update')rnrn $freight_payer =$_POST['freight_payer'];rn $id = $_POST['id'];rn $detail_url = $_POST["detail_url"];rn $title = $_POST["title"];rn $pic_url = $_POST["pic_url"];rn $price = $_POST["price"];rn $coupon_price = $_POST["coupon_price"];rn $begin_time = strtotime($_POST["begin_time"]);rn $end_time = strtotime($_POST["end_time"]);rn $promote_id= $_POST['promote_id'];rn $pindao_id= $_POST['pindao_id'];rn $category_id = $_POST['category_id'];rn $num=$_POST['num'];rn $nick=$_POST['nick'];rn $description=$_POST['description'];rn rn if ($detail_url == "" || $title == "" || $pic_url == "" || $price == "" || $coupon_price == "")rn rn $updateMessage = "请把商品信息填写完整!!";rn rn elsern rn //修改数据库开始rn $sql = 'UPDATE `goods` SET `freight_payer`="'.$freight_payer.'", `detail_url`="' . $detail_url . '", `title`="' . $title . '", `pic_url`="' . $pic_url . '", `price`="' . $price .rn '", `coupon_price`="' . $coupon_price . '", `begin_time`="' . $begin_time . '", `end_time`="' . $end_time . '", `promote_id`="' . $promote_id .rn '", `category_id`="' . $category_id . '", `num`="'.$num.'", `pindao_id`="'.$pindao_id.'", `description`="'.$description.'" WHERE `id`='.$id;rn rn $result = $pdo->exec($sql);rn if ($result > 0)rn rn $updateMessage = "修改成功";rn rn elsern rn echo $sql;rn $updateMessage = "修改失败";rn rn rnrnrn[/code]
本地测试没问题,部署后有问题
系统要把饼图导出到Excel,本地(win7)测试正常,部署到服务器(windows2008) 点击导出按钮报错:未将对象引用设置到对象的实例 rn把代码拷贝到另一测试环境(windows2008)调试,报错:Attempted to read or write protected memory. This is often an indication that other memory is corrupt
导出excel 放到服务器上导出失败 本地测试成功
错误信息: [color=#FF0000]检索 COM 类工厂中 CLSID 为 00024500-0000-0000-C000-000000000046 的组件失败,原因是出现以下错误: 80070005 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))。rn说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。rnrn异常详细信息: System.UnauthorizedAccessException: 检索 COM 类工厂中 CLSID 为 00024500-0000-0000-C000-000000000046 的组件失败,原因是出现以下错误: 80070005 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))。rnrnASP.NET 无权访问所请求的资源。请考虑对 ASP.NET 请求标识授予访问此资源的权限。ASP.NET 有一个在应用程序没有模拟时使用的基进程标识(通常,在 IIS 5 上为 MACHINE\ASPNET,在 IIS 6 和 IIS 7 上为网络服务,在 IIS 7.5 上为配置的应用程序池标识)。如果应用程序正在通过 模拟,则标识将为匿名用户(通常为 IUSR_MACHINENAME)或经过身份验证的请求用户。rnrn要将 ASP.NET 访问权限授予某个文件,请在资源管理器中右击该文件,选择“属性”,然后选择“安全”选项卡。单击“添加”添加适当的用户或组。突出显示 ASP.NET 帐户,选中所需访问权限对应的框。[/color]rnrn 服务器上已安装office2010 dll文件也已引用(引用的版本是14.0的)可还是报这个错误?各位帮忙看看那。。。。。。。rnrnrn
本地测试输出中文乱码,而放到服务器上却正常?
原来的db_conn.php中有一句:header ( "content-type:text/html;charset=utf-8" ); 后来好像因为session的原因注释掉了。但是这个只影响到本地调试,服务器上却没有影响。这是为什么呢?谢谢!
本地测试没问题,上传服务器运行不正常
我编写好了一个读写数据库的页面,在本地测试没问题,可是传到服务器上后能读出数据,可是按提交数据按钮页面没反应。晕!~~rn大虾们是怎么回事啊??指点下小弟。
http接口,报空指针,请教大虾
项目中要做一个发短信的功能,客户给了一个http接口url,一开始以为直接这样用BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); 后来那个开发接口的公司说不能这样使用,也不能直接在浏览器窗口中输入url的请求:因为他们后台是这么处理的:[code=java]String result = "";rn request.setCharacterEncoding("GBK");rn BufferedReader br = request.getReader();rn String line = br.readLine();rn String[] params = line.split("&");rn Map param = new HashMap();rn for(String s : params)rn String[] keyAndValue = s.split("=");rn String key = keyAndValue[0];rn String value = keyAndValue[1];rn if(key.equals("SMSContent") || key.equals("DestMobile")) rn value = URLDecoder.decode(value,"GBK");rn rn param.put(key, value);rn if(!isOpen)System.out.println(key+":"+value);rn rn if(!isOpen)System.out.println("");rn String BizType = param.get("BizType").toString();rn if(BizType.equals("01"))rn result = smsWordService.senMsgServiceAPI(param);rn else if(BizType.equals("02"))rn System.out.println("已发短信查询");rn else if(BizType.equals("03"))rn System.out.println("上行短信查询");rn [/code]rn后来httpClient.executeMethod(getMethod);rn byte[] responseBody = getMethod.getResponseBody();rn strHtml = new String(responseBody);rn还是报空指针的错误,他们说给的url是正确的,是在不知道怎么写了
请求帮助,请求帮助
大家好,我在开发时碰到了一个问题,求教,帮我解决一下:rn我用UserControl自定义了一个控件如:rn这是xaml部分:rn[img=https://img-bbs.csdn.net/upload/201408/12/1407813098_613843.png][/img]rn这是.cs部分:rn[img=https://img-bbs.csdn.net/upload/201408/12/1407813148_310437.png][/img]rn然后再MainPage页面我用到了这个控件,但是出现了如下问题:rn[img=https://img-bbs.csdn.net/upload/201408/12/1407813447_424146.png][/img]rn说明一下:这里的day1,day2等都是自定义控件的Name,但是呢?day1这个只能调用当初在定义这个UserControl时候给他里边的子控件命名的名称,无法调用.cs中重新定义的属性,求解决。rnrn
android图片验证码本地
android图片验证码,本地生成,本地验证
抓取图片验证码的请求
背景:因登录系统改造,原本的验证码是直接以img标签的形式直接放在页面中,但改造后的登录系统需要获取该请求的请求头中的数据,改造如下 // react 页面中写法 { showVcode &amp;amp;&amp;amp; &amp;lt;Input type=&quot;text&quot; label=&quot;验证码&quot; maxLength=&quot;6&quot; placeholder=&quot;请输入验证码&quot; ref=&quot;validatio
图片验证码请求验证filter
ValidateFilter继承oncePerRequestFilter 继承调用首先是验证是否是特定的请求,是否post,sessionStrategy进行验证码sessionid校验查看是否是否从在通过servletwebRequset判断信息是否相同,在config中配置,在user 请求配置(接口传递)-》应用配置(某个应用)-》默认配置(core) 1.基本参数可配置 建立参...
相关热词 c# 线程结束时执行 c# kb mb 图片 c# 替换第几位字符 c#项目决定成败 c# 与matlab c# xml缩进 c#传感器基础 c#操作wps c# md5使用方法 c# 引用父窗口的组件