Memcached-Java-Client 错误。请人指点!速结

YSEE 2012-02-06 02:37:27
https://github.com/gwhalin/Memcached-Java-Client/wiki/HOWTO

-----------------------
package test;

import com.danga.MemCached.*;

public class TestMemcache {

// create a static client as most installs only need
// a single instance
protected static MemCachedClient mcc = new MemCachedClient();

// set up connection pool once at class load
static {

// server list and weights
String[] servers = { "192.168.1.212:11211" };

Integer[] weights = { 3 };

// grab an instance of our connection pool
SockIOPool pool = SockIOPool.getInstance();

// set the servers and the weights
pool.setServers(servers);
pool.setWeights(weights);

// set some basic pool settings
// 5 initial, 5 min, and 250 max conns
// and set the max idle time for a conn
// to 6 hours
pool.setInitConn(5);
pool.setMinConn(5);
pool.setMaxConn(250);
pool.setMaxIdle(1000 * 60 * 60 * 6);

// set the sleep for the maint thread
// it will wake up every x seconds and
// maintain the pool size
pool.setMaintSleep(30);

// set some TCP settings
// disable nagle
// set the read timeout to 3 secs
// and don’t set a connect timeout
pool.setNagle(false);
pool.setSocketTO(3000);
pool.setSocketConnectTO(0);

// initialize the connection pool
pool.initialize();

// lets set some compression on for the client
// compress anything larger than 64k
mcc.setCompressEnable(true);
mcc.setCompressThreshold(64 * 1024);
}

// from here on down, you can call any of the client calls
public static void examples() {
mcc.set("foo", "This is a test String");
//String bar = (String)mcc.get("foo");
}
}
--------web----------------
<body>
<%
TestMemcache.examples();
%>
This is my JSP page. <br>
</body>

---------ERROR---------------------
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 6 in the generated java file
Only a type can be imported. test.TestMemcache resolves to a package

An error occurred at line: 33 in the jsp file: /Test/MyTest.jsp
TestMemcache cannot be resolved
30:
31: <body>
32: <%
33: TestMemcache.examples();
34: %>
35: This is my JSP page. <br>
36: </body>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.

---------------------



那位高人帮忙解决下。
...全文
192 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
kouyiSC 2012-02-07
  • 打赏
  • 举报
回复
An error occurred at line: 33 in the jsp file: /Test/MyTest.jsp
TestMemcache cannot be resolved


一看就是没有引包吧。。。。
YSEE 2012-02-07
  • 打赏
  • 举报
回复
请问 谁在 java web 里用过 memcached 的?
请留个QQ给我
YSEE 2012-02-06
  • 打赏
  • 举报
回复
// SockIOPool 是一个自平衡的连接池
SockIOPool sock = SockIOPool.getInstance();

这句报错
YSEE 2012-02-06
  • 打赏
  • 举报
回复
Constant.MEMCACHE_SERVER ?
ivan_070 2012-02-06
  • 打赏
  • 举报
回复
import com.danga.MemCached.*;
import java.util.Date;

public class CacheClient {

protected static MemCachedClient mcc = new MemCachedClient();

static {

String[] serverlist = {Constant.MEMCACHE_SERVER};
SockIOPool pool = SockIOPool.getInstance();
pool.setServers(serverlist);
pool.initialize();

}

public static String get(String strKey) {
return (String)mcc.get(strKey);
}

public static boolean set(String strKey,String strValue,Date objDate){
return mcc.set(strKey,strValue,objDate);
}

}
YSEE 2012-02-06
  • 打赏
  • 举报
回复
Referenced Libraries
java_memcached-release_2.6.3.jar
YSEE 2012-02-06
  • 打赏
  • 举报
回复
memcached telnet通过
内容概要:本文围绕基于PI双闭环解耦控制的三相电压型PWM整流器在第四象限运行的仿真研究展开,重点分析其在电流反向流动工况下的控制性能。通过Simulink搭建系统模型,采用电压外环与电流内环构成的双闭环PI控制策略,并引入d-q轴解耦环节以消除交叉耦合影响,实现对整流器在能量回馈状态下的高精度、稳定控制。研究涵盖了系统数学建模、控制器参数设计、解耦算法实现及动态响应仿真验证,充分展示了该控制方法在抑制扰动、提升系统鲁棒性方面的有效性。; 适合人群:电力电子、电气工程及其自动化等相关专业的研究生、科研人员及从事新能源变流器、电能质量治理或工业传动系统开发的工程技术人员;具备自动控制理论基础和Simulink仿真能力者更佳。; 使用场景及目标:①深入掌握三相电压型PWM整流器的工作原理及其在不同运行象限的能量流动特性;②理解并实践PI双闭环控制系统的设计思路与参数整定方法;③学习d-q坐标系下电流解耦控制的实现机制;④熟练运用Simulink进行电力电子系统建模与仿真分析;⑤为实际工程中实现高效能量双向变换提供理论依据与技术参考。; 阅读建议:建议结合Simulink环境同步搭建模型,细致分析各模块的信号流向与控制逻辑,重点关注电流内环的动态跟踪能力和电压外环的稳态调节性能,可通过改变负载突变、电网电压波动等条件进行对比实验,进一步评估系统的抗干扰能力与稳定性表现。

81,111

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧