您的位置:首页 > 移动开发 > 微信开发

微信支付java后台点滴学习----遇到的问题解决

2016-12-22 15:05 609 查看

1.问题 maven项目问题,本地和配置依赖不同的问题

Description Resource Path Location Type

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from

https://repo.maven.apache.org/maven2 was cached in the local repository,

resolution will not be reattempted until the update interval of central has elapsed or updates are forced.

Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 from/to central

(https://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /WeiXinpay line 1 Maven Configuration Problem

解决方案

2.问题 net.sf.json-lib:json-lib:jar:jdk15 问题

Description Resource Path Location Type

Project build error: ‘dependencies.dependency.version’ for net.sf.json-lib:json-lib:jar:jdk15 is missing. pom.xml /WeiXinpay line 82 Maven pom Loading Problem

解决方案:

net.sf.json-lib

json-lib

2.4

jdk15

结果,错误没有了,编译通过了,但是我本地用的是jdk7,而那个配置里面却是jdk5,

这个好像必须写5,我把jdk16/jdk17都试了一遍都不行,无奈只有用jdk15可以编译通过,有知道原因的朋友请留言。

3.问题 eval

在本例中,我们将在几个字符串上运用 eval(),并看看返回的结果:

eval("x=10;y=20;document.write(x*y)")

document.write(eval("2+2"))

var x=10
document.write(eval(x+17))

输出:200 4 27

3.1为什么要 eval这里要添加 “(“(“+data+”)”);//”呢?

1.对于服务器返回的JSON字符串,如果jquery异步请求没做类型说明,或者以字符串方式接受,那么需要做一次对象化处理,方式不是太麻烦,就是将该字符串放于eval()中执行一次。这种方式也适合以普通javascipt方式获取json对象,以下举例说明:

var dataObj=eval(“(“+data+”)”);//转换为json对象

原因在于:eval本身的问题。 由于json是以”{}”的方式来开始以及结束的,在JS中,它会被当成一个语句块来处理,所以必须强制性的将它转换成一种表达式。

加上圆括号的目的是迫使eval函数在处理JavaScript代码的时候强制将括号内的表达式(expression)转化为对象,而不是作为语句(statement)来执行。举一个例子,例如对象字面量{},如若不加外层的括号,那么eval会将大括号识别为JavaScript代码块的开始和结束标记,那么{}将会被认为是执行了一句空语句。所以下面两个执行结果是不同的:

alert(eval(“{}”); // return undefined

alert(eval(“({})”);// return object[Object]

4.web.xml 可以配置多个servelet

AcceptLink

labmanagement.AcceptLink

HelloWorld

labmanagement.HelloWorld

AcceptLink

/AcceptLink

HelloWorld

/HelloWorld

5.tomcat tomcat出现故障

Caused by: java.lang.IllegalArgumentException: Invalid addNewsServlet in servlet mapping

at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3223)

at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3198)

at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1366)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1353)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)

at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

… 6 more

The servlets named [WeiChatServlet] and [com.javen.course.weixin.servlet.WeiChatServlet] are both mapped to the url-pattern

[/WeiChatServlet] which is not permitted

servelet mapping 的配置 防止重复,就是小写

http://www.aiuxian.com/article/p-1489426.html

6.servlet输出的中文乱码

出入到数据库的中文也乱码

解决:

项目的编码和整体的编码,都要统一我的

servlet的request respond 加入

// 将请求、响应的编码均设置为UTF-8(防止中文乱码)

request.setCharacterEncoding(“UTF-8”);

response.setCharacterEncoding(“UTF-8”);

6.2数据库的配置 一定要加上utf-8的编码

#Mysql

jdbc.driverClassName=com.mysql.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/weixins?useUnicode=true&characterEncoding=utf-8

jdbc.username=suter

jdbc.password=123456

7.问题jdk版本的问题



8.Type HttpServlet cannot be resolved to a type报错

其实就是servlet的api找不到了,一般的帖子,就是让导入这个jar包

这个jar在tomcat里,

其实,只需要,运行一下你的targeted runtime就可以了

具体,见图



9.java web应用 tomcat无法启动,或者启动失败(非第一次)

在测试启动run as a server时,经常无法启动tomcat,是因为自身的tomcat配置问题,和runtarget 版本不同,还有一种,就是原来启动过,但是没有完全关闭;

就要在任务管理器内,关闭一个javaw.exe

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐