二月 2010


javaee and websphere12 二 2010 09:56 上午

环境描述
Windows平台
IBMWAS6.1.0.29
使用DM控制网络节点,DM由于无法获得受控节点的主机名导致DM无法启动

报错信息如下

[10-2-12 9:48:44:812 CST] 0000000a HostNameMap   E   HMGR0024W: 查找核心组成员的主机名的 IP 地址时发生错误。主机名为 xxxServer,异常为 java.net.UnknownHostException: xxxServer: xxxServer
at java.net.InetAddress.getAllByName0(InetAddress.java:1247)
at java.net.InetAddress.getAllByName(InetAddress.java:1174)
at java.net.InetAddress.getAllByName(InetAddress.java:1097)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMap.getInetAddresses(HostNameMap.java:182)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMap.<init>(HostNameMap.java:62)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMapManager.getHostNameMap(HostNameMapManager.java:87)

[10-2-12 9:48:49:953 CST] 0000000a AppProfileCom I   ACIN0009I: 正在停止 Application Profiling 服务。
[10-2-12 9:48:49:953 CST] 0000000a ActivitySessi I   WACS0049I: ActivitySession Service 正在停止。
[10-2-12 9:48:50:031 CST] 0000000a CGBridgeServi I   CWRCB0103I: 核心组网桥服务已停止。
[10-2-12 9:48:50:078 CST] 0000000a WsServerImpl  E   WSVR0009E: 启动期间发生错误
META-INF/ws-server-components.xml
[10-2-12 9:48:50:078 CST] 0000000a WsServerImpl  E   WSVR0009E: 启动期间发生错误
com.ibm.ws.exception.RuntimeError: com.ibm.ws.exception.RuntimeError: Unable to start the CoordinatorComponentImpl
at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:199)
at com.ibm.ws.runtime.WsServerImpl.start(WsServerImpl.java:140)
at com.ibm.ws.runtime.WsServerImpl.main(WsServerImpl.java:461)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:183)
at com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:90)
at com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:72)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)
at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
at org.eclipse.core.launcher.Main.run(Main.java:981)
at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:339)
at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:94)
Caused by: com.ibm.ws.exception.RuntimeError: Unable to start the CoordinatorComponentImpl
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl.start(CoordinatorComponentImpl.java:302)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:977)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:673)
at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:526)
at com.ibm.ws.runtime.WsServerImpl.bootServerContainer(WsServerImpl.java:192)
… 24 more
Caused by: com.ibm.wsspi.hamanager.HAInternalStateException: failure creating the Coordinator
at com.ibm.ws.hamanager.coordinator.impl.CoordinatorImpl.<init>(CoordinatorImpl.java:336)
at com.ibm.ws.hamanager.coordinator.corestack.CoreStackFactoryImpl.createDefaultCoreStack(CoreStackFactoryImpl.java:88)
at com.ibm.ws.hamanager.runtime.CoordinatorComponentImpl.start(CoordinatorComponentImpl.java:272)
… 28 more
Caused by: com.ibm.wsspi.hamanager.datastack.DataStackException: Failure creating core stack
at com.ibm.ws.hamanager.coordinator.impl.DCSPluginImpl.<init>(DCSPluginImpl.java:252)
at com.ibm.ws.hamanager.coordinator.impl.CoordinatorImpl.<init>(CoordinatorImpl.java:329)
… 30 more
Caused by: com.ibm.wsspi.hamanager.HAException: Host name xxxServer is not registered in DNS
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMap.<init>(HostNameMap.java:68)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMapManager.getHostNameMap(HostNameMapManager.java:87)
at com.ibm.ws.hamanager.coordinator.dcs.CoreStackMembershipManager.createMemberMapping(CoreStackMembershipManager.java:473)
at com.ibm.ws.hamanager.coordinator.dcs.CoreStackMembershipManager.<init>(CoreStackMembershipManager.java:120)
at com.ibm.ws.hamanager.coordinator.impl.DCSPluginImpl.<init>(DCSPluginImpl.java:220)
… 31 more
Caused by: java.net.UnknownHostException: xxxServer: xxxServer
at java.net.InetAddress.getAllByName0(InetAddress.java:1247)
at java.net.InetAddress.getAllByName(InetAddress.java:1174)
at java.net.InetAddress.getAllByName(InetAddress.java:1097)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMap.getInetAddresses(HostNameMap.java:182)
at com.ibm.ws.hamanager.coordinator.dcs.HostNameMap.<init>(HostNameMap.java:62)
… 35 more

解决办法
在C:\WINDOWS\system32\drivers\etc\hosts文件中直接增加改主机名和ip的对应关系,启动DM即可。

javaee and spring and websphere11 二 2010 01:52 下午

环境
IBMWAS6.1.0.29
spring2.5.6
hibernate3.3.1GA
jconn3驱动
Sybase15

java.sql.SQLException: JZ0PA: The query has been cancelled and the response discarded. The cancel was probably issued by another statement on the connection.
java.sql.SQLException: JZ0PA: 已取消查询,响应被放弃。取消指令可能由连接上的另一语句发出。
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.getUpdateCount(Unknown Source)
at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.closeWrapper(WSJdbcPreparedStatement.java:445)
at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:185)
at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:144)
at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:563)
at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:291)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:307)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:234)
at org.hibernate.loader.Loader.doQuery(Loader.java:749)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

原因是由于刚更新了WAS6.1.0.29,回滚到WAS6.1.0.21,问题消失。29解决办法还未找到。

javaee and spring05 二 2010 11:10 上午

<bean id=”myMessageSource” class=”org.springframework.context.support.ResourceBundleMessageSource”>
<property name=”basenames”>
<list><value>mymessage</value></list>
</property>
</bean>

默认
mymessage.properties
中文
mymessage_zh_CN.properties
英文
mymessage_en_US.properties

首先要把中文的配置给native2ascii化
使用sunjdk的native2ascii
native2ascii mymessage.properties mymessage_zh_CN.properties
执行后发现是乱码,由于我的编译环境是utf-8,加传一个encoding参数如下
native2ascii -encoding UTF-8 mymessage.properties mymessage_zh_CN.properties
乱码没了

javaee and spring01 二 2010 10:58 上午

使用场景
spring2.5.6
hibernate3.3.1GA
Sybase15
jconn3驱动
使用spring的jdbctemplate调用Sybase15的存储过程报错
ERROR: ConnectionCallback; uncategorized SQLException for SQL []; SQL state [ZZZZZ]; error code [7713]; Stored procedure ‘proc_xxx’ may be run only in unchained transaction mode. The ‘SET CHAINED OFF’ command will cause the current session to use unchained transaction mode.;
nested exception is com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure ‘proc_xxx’ may be run only in unchained transaction mode. The ‘SET CHAINED OFF’ command will cause the current session to use unchained transaction mode.
org.springframework.jdbc.UncategorizedSQLException: ConnectionCallback; uncategorized SQLException for SQL []; SQL state [ZZZZZ]; error code [7713]; Stored procedure ‘proc_xxx’ may be run only in unchained transaction mode. The ‘SET CHAINED OFF’ command will cause the current session to use unchained transaction mode.;
nested exception is com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure ‘proc_xxx’ may be run only in unchained transaction mode. The ‘SET CHAINED OFF’ command will cause the current session to use unchained transaction mode.
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:349)
Caused by: com.sybase.jdbc3.jdbc.SybSQLException: Stored procedure ‘proc_xxx’ may be run only in unchained transaction mode. The ‘SET CHAINED OFF’ command will cause the current session to use unchained transaction mode.
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.ResultGetter.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.nextResult(Unknown Source)
at com.sybase.jdbc3.jdbc.SybStatement.executeLoop(Unknown Source)
at com.sybase.jdbc3.jdbc.SybCallableStatement.execute(Unknown Source)
at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:70)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:342)
… 48 more

解决办法
1)在调用存储过程的代码
conn.setAutoCommit(true);//SET CHAINED OFF
CallableStatement cstmt = conn.prepareCall(“{call proc_xxx(?) }”);
//
conn.setAutoCommit(false);//SET CHAINED ON
2)或者在数据库中执行如下sql语句
sp_procxmode proc_xxx, “chained”

参考资料

http://forum.springsource.org/showthread.php?t=49398

http://manuals.sybase.com/onlinebook…iew/55096;hf=0

http://manuals.sybase.com/onlinebook…w/53740;hf=0#X