gamecenter项目调试

1、配置host
C:\WINDOWS\system32\drivers\etc
127.0.0.1 localhost
10.3.19.200 fuxi.xoa.renren.com

2、配置test类
在test类 右键 Run as--Run configurations
双击Java Application 会弹出 Test
新测试类需进行以下操作:
VM arguments下 -Dxoa.hosts.fuxi.xoa.renren.com=10.3.19.200:8388

3、先rebuild修改过的层

3、连接200

sh /data/staging/tools/stage_wap.fuxi.xoa.sh 41801
tail -100f /data/web_log/logs/useraccess.fuxi.xoa.2011-07-29.log
tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
tail -1000f /data/web_log/log/xoa-fuxi/wap_stdout.log

拷贝logger.jsp文件
cd /data/xoa/xoa-yoyo/ROOT/
scp /data/xoa/xoa-yoyo/ROOT/logger.jsp root@10.3.19.200:/data/xoa/xoa-fuxi/ROOT/

/opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
或者 ps aux|grep fuxi-tomcat
kill 18358
/opt/xoa-fuxi-tomcat/bin/startup.sh
rm renren-wap-fuxi-service-1.0-SNAPSHOT.jar
sh /data/staging/tools/stage_wap.fuxi.xoa.sh 41801

页面脚本resin
sh /data/staging/tools/stage_wap.fuxi.sh
more /data/staging/tools/stage_wap.fuxi.sh

tail -1000f /data/web_log/log/wap/fuxi/stdout.log

/opt/resin-fuxi/bin/httpd.sh start

4、在log4j.xml中
<appender name="stdout" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/data/web_log/log/xoa-fuxi/catalina.out" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd-HH:mm:ss,SSS} %5p - %m%n" />
</layout>
</appender>

<!-- WAP Stdout -->
<appender name="wapStdoutFile" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/data/web_log/log/xoa-fuxi/wap_stdout.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd-HH:mm:ss,SSS} %5p - %m%n" />
</layout>
</appender>

<logger name="com.xiaonei.wap.framework" additivity="false">
<level value="error" />
<appender-ref ref="wapStdoutFile" />
</logger>

<logger name="com.xiaonei.wap" additivity="false">
<level value="error" />
<appender-ref ref="wapStdoutFile" />
</logger>

<logger name="com.renren.wap" additivity="false">
<level value="error" />
<appender-ref ref="wapStdoutFile" />
</logger>

<logger name="com.xiaonei.checkin" additivity="false">
<level value="error" />
<appender-ref ref="wapStdoutFile" />
</logger>

tail -1000f /data/web_log/log/xoa-fuxi/catalina.out
tail -1000f /data/web_log/log/xoa-fuxi/wap_stdout.log


6、rebuild文件 server下 rebuild文件
rebuild.bat:
set MAVEN_OPTS=-Dfile.encoding=utf-8
cd /d %~dp0
svn up
call mvn clean package -U deploy
pause

rebuild.sh:
#!/bin/sh
svn up
mvn clean
mvn package -U
mvn deploy


7、ServiceFactory 对Service接口进行封装的工厂
public interface ServiceFactory {

public <T> T getService(Class<T> serviceInterface);

public <T> T getService(Class<T> serviceInterface, XoaClientI client);

}

ServiceFactories {@link ServiceFactory}的工厂,以及封装相关工具方法。

public class ServiceFactories {

private static ServiceFactory defaultFactory = new DefaultServiceFactory();

/**
* @return 默认的ServiceFactory
*/
public static ServiceFactory getFactory() {
return defaultFactory;
}

}

DefaultServiceFactory {@link ServiceFactory}的默认实现

public class DefaultServiceFactory implements ServiceFactory {

protected Log logger = LogFactory.getLog(this.getClass());

private Map<Class<?>, ServiceDefinition> xoaServices = new ConcurrentHashMap<Class<?>, ServiceDefinition>();

@SuppressWarnings("unchecked")
@Override
public <T> T getService(Class<T> serviceInterface, XoaClientI client) {

ServiceDefinition servicdDef = xoaServices.get(serviceInterface);

if (servicdDef == null) {
if (logger.isDebugEnabled()) {
logger.debug("Definition NOT found for " + serviceInterface.getName());
}
for (Annotation annotation : serviceInterface.getAnnotations()) {
if (annotation instanceof XoaService) {
XoaService xoaService = (XoaService)annotation;
servicdDef = new ServiceDefinition();
servicdDef.setServiceId(xoaService.serviceId());
//servicdDef.setHosts(xoaService.hosts());
xoaServices.put(serviceInterface, servicdDef);
break;
}
}
} else {
if (logger.isDebugEnabled()) {
if (logger.isDebugEnabled()) {
logger.debug("Definition found for " + serviceInterface.getName());
}
}
}

if (servicdDef == null) {
throw new IllegalArgumentException(serviceInterface + " must be annotated with " + XoaService.class);
}

ServiceInvocationHandler handler;
if (client == null) {
handler = new ServiceInvocationHandler(servicdDef);
} else {
handler = new ServiceInvocationHandler(servicdDef, client);
}

T proxy = (T)Proxy.newProxyInstance(
ClassUtils.getDefaultClassLoader(),
new Class<?>[]{serviceInterface}, handler);
return proxy;
}

@Override
public <T> T getService(Class<T> serviceInterface) {
return getService(serviceInterface, null);
}

}

ServiceDefinition 一个XOA service的定义
public class ServiceDefinition {

/**
* service id
*/
private String serviceId;

/**
* 可以指定本次调用的host列表,以ip:port的形式,
* 如果指定了hosts,那么registry中的配置会被覆盖
*/
//private String[] hosts;

public String getServiceId() {
return serviceId;
}

public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}

/*public String[] getHosts() {
return hosts;
}

public void setHosts(String[] hosts) {
this.hosts = hosts;
}*/
}

在类中获取一个bean,则
ServiceFactory fact = ServiceFactories.getFactory();
gameCententerService = fact.getService(GameCenterService.class);


ServiceFuture 封装一次异步调用的返回信息

获取{@link ServiceFuture}实例后,其所对应的XOA请求并没有提交出去,在提交之前,还是可以添加header和param的,而调用此方法后,请求才会真正提交出去。
ServiceFuture<T> submit();

Waits for this future to be completed within the specified time limit.
boolean await(long timeoutMillis) throws InterruptedException;

Returns {@code true} if and only if the I/O operation was completed successfully.
boolean isSuccess();

获取返回的内容,如果调用尚未成功返回,或者有错误的返回,那么会抛出{@link IllegalStateException},所以调用此方法前应该先调用isSuccess方法来判断当前返回状态
T getContent();

Java 泛型
? 表示不确定的java类型。
T 表示java类型。
K V 分别代表java键值中的Key Value。
E 代表Element。

8、打包发布
SecureFX 10.3.19.200
/data/xoa/xoa-fuxi/ROOT/WEB-INF/lib
export--jar file--renren-wap-fuxi-xoa-server--src/main/java

6、更改sevice的版本
cd /data/xoa/xoa-fuxi/ROOT/WEB-INF/lib
pwd
目前下面有三个版本
renren-wap-fuxi-model-1.0-SNAPSHOT.jar
renren-wap-fuxi-service-1.0-20110712.062725-6.jar
renren-wap-fuxi-server.jar

服务器位于opt/xoa-fuxi-tomcat

5、查看log:
http://fuxi.xoa.renren.com:8380/logger.jsp
查找
com.xiaonei.wap.fuxi.service.impl.AppPageServiceImpl [DEGUG]
可以选择log level

tail -100f /data/web_log/logs/useraccess.fuxi.xoa.2011-07-25.log
tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
tail -1000f /data/web_log/log/xoa-fuxi/wap_stdout.log

拷贝logger.jsp文件
cd /data/xoa/xoa-yoyo/ROOT/
scp logger.jsp root@10.3.19.200:/data/xoa/xoa-fuxi/ROOT/

9、linux 登录
如:Quick Connect
SSH2 10.3.19.157 root GSSAPI--Properties--GSSAPI

3、连接200
/opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
或者 ps aux|grep fuxi-tomcat
kill 18358
/opt/xoa-fuxi-tomcat/bin/startup.sh
rm renren-wap-fuxi-service-1.0-SNAPSHOT.jar

通过脚本重启tomcat
sh /data/staging/tools/stage_wap.fuxi.xoa.sh 41801
/data/staging/tools/stage_wap.fuxi.xoa.sh 脚本需要看一下

页面脚本resin
sh /data/staging/tools/stage_wap.fuxi.sh
more /data/staging/tools/stage_wap.fuxi.sh

tail -1000f /data/web_log/log/wap/fuxi/stdout.log

Date d = userLoginLog.getLoginTime();
if (d == null) {
d = new Date();
}
Timestamp t = new Timestamp(d.getTime());

9、
com.renren.xoa.ServiceNotFoundException: fuxi.xoa.renren.com
未配置 -Dxoa.hosts.fuxi.xoa.renren.com=10.3.19.200:8388

No healthy communication client available 服务器未启动


{"name":"图片1", "url":"http://www.renren.com/testiphone1.html"},
{"name":"图片2", "url":"http://www.renren.com/testiphone2.html"},
{"name":"图片3", "url":"http://www.renren.com/testiphone3.html"}

10、注意要配置applicationContext-service.xml中配置
Java代码
<bean id="userAccessService" class="com.xiaonei.wap.fuxi.service.impl.UserAccessServiceImpl" />

---------------------------------------
Linux下调试
969 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
970 cd ..
971 ls
972 cd opt
973 ls
974 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
975 ps aux|grep fuxi-tomcat
976 kill 19348
977 ps aux|grep fuxi-tomcat
978 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
979 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
980 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
981 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
982 ps aux|grep fuxi-tomcat
983 /opt/xoa-fuxi-tomcat/bin/startup.sh
984 tail -100f /data/web_log/logs/useraccess.fuxi.xoa.2011-07-22.log
985 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
986 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
987 tail -1000f /data/web_log/log/xoa-fuxi/wap_stdout.log
988 tail -1000f /opt/xoa-fuxi-tomcat/logs/catalina.out
989 cd /opt/xoa-fuxi-tomcat/
990 ls
991 cd conf/
992 ls
993 cat|less server.xml
994 sh /data/staging/tools/stage_wap.fuxi.xoa.sh 42826
995 sh /data/staging/tools/stage_wap.fuxi.xoa.sh 42826
996 sh /data/staging/tools/stage_wap.fuxi.xoa.sh 42826
997 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
998 ps aux|grep fuxi-tomcat
999 sh /data/staging/tools/stage_wap.fuxi.xoa.sh 42826
1000 tail -100f /data/web_log/logs/useraccess.fuxi.xoa.2011-07-22.log
1001 cd /opt/
1002 ll
1003 cd xoa-fuxi-tomcat
1004 ll
1005 cd conf/
1006 ll
1007 vim server.xml
1008 ll
1009 cd ..
1010 ll
1011 ps -ef|grep xoa-f
1012 tail -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1013 tail -200f /opt/xoa-fuxi-tomcat/logs/catalina.out
1014 less /opt/xoa-fuxi-tomcat/logs/catalina.out
1015 rm -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1016 rm -f /opt/xoa-fuxi-tomcat/logs/*
1017 ps -ef|grep xoa-f
1018 kill -9 21885
1019 ps -ef|grep xoa-f
1020 cd conf/
1021 ll
1022 vim server.xml
1023 ll /data/xoa/xoa-fuxi
1024 /opt/xoa-fuxi-tomcat/bin/startup.sh
1025 rm -f /opt/xoa-fuxi-tomcat/PID
1026 /opt/xoa-fuxi-tomcat/bin/startup.sh
1027 tail -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1028 cd /data/staging/tools
1029 sh stage_wap.fuxi.xoa.sh 42903
1030 tail -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1031 less /opt/xoa-fuxi-tomcat/logs/catalina.out
1032 netstat -nal |grep 8380
1033 netstat -nl |grep 8380
1034 netstat -p |grep 8380
1035 vim /opt/xoa-fuxi-tomcat/conf/server.xml
1036 ll
1037 ps -ef|grep xoa-f
1038 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
1039 rm -f /opt/xoa-fuxi-tomcat/logs/catalina.
1040 rm -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1041 /opt/xoa-fuxi-tomcat/bin/startup.sh
1042 tail -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1043 sz /data/xoa/xoa-fuxi/ROOT/WEB-INF/lib/renren-wap-fuxi-service-1.0-20110722.055045-97.jar
1044 less /opt/xoa-fuxi-tomcat/logs/catalina.out
1045 cd /root/
1046 ll
1047 mkdir ke.liao
1048 cd ke.liao/
1049 ll
1050 svn co http://svn.d.xiaonei.com/wap/renren/renren-wap-fuxi-service/trunk renren-wap-fuxi-service
1051 cd renren-wap-fuxi-service
1052 ll
1053 mvn package -U
1054 svn up
1055 mvn clean -package -U
1056 mvn clean package -U
1057 mvn deploy
1058 cd ..
1059 ll
1060 svn co http://svn.d.xiaonei.com/wap/renren/renren-wap-fuxi-model/trunk renren-wap-fuxi-model
1061 cd renren-wap-fuxi-model
1062 ll
1063 mvn clean package -U deploy
1064 cd ..
1065 ll
1066 cd renren-wap-fuxi-service
1067 cp target/renren-wap-fuxi-service-1.0-SNAPSHOT.jar /data/xoa/xoa-fuxi/ROOT/WEB-INF/lib/
1068 cd /data/xoa/xoa-fuxi/ROOT/WEB-INF/lib/
1069 ll |grep fuxi
1070 rm -f renren-wap-fuxi-service-1.0-20110722.055045-97.jar
1071 /opt/xoa-fuxi-tomcat/bin/shutdown.sh -force
1072 vim /opt/xoa-fuxi-tomcat/bin/catalina.sh
1073 /opt/xoa-fuxi-tomcat/bin/startup.sh
1074 tail -f /opt/xoa-fuxi-tomcat/logs/catalina.out
1075 history


各种异常:

java.io.IOException: Connection reset by peer
客户端关闭的错误

/opt/resin-fuxi/bin/httpd.sh 增加 FUXI_XOA参数
FUXI_XOA="-Dxoa.hosts.fuxi.xoa.renren.com=10.3.19.200:8388"
args="-Xms4000M -Xmx4000M -J-server -J-Xss128k -J-XX:ThreadStackSize=128 -XX:MaxPermSize=128M -J-verbosegc -J-XX:+PrintGCDet
ails -J-XX:+UseParallelGC -J-XX:+PrintGCTimeStamps $FUXI_XOA -Djava.library.path=/opt/resin-fuxi/libexec:/opt/j2sdk/lib:/us
r/lib64 -Djmagick.systemclassloader=false"
-----------------------------------------------------

ifconfig 查看公网ip
--------------------------------------------

导入 配置文件
判断null 多用util
StringUtil
NumberUtil
CollectionUtil
注入主要注入接口
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值