WebSphere 异常问题记录

java.lang.IllegalAccessError: Class com/mysql/jdbc/NonRegisteringDriver illegally accessing “protected” member of class com/mysql/jdbc/ConnectionImpl

解决:确认jar包存在;可能为Jar包版本;
猜测或者为was bug: JDBC provides新建后,修改一下才会生效,否则报错如上(NonRegisteringDriver);而且,新建Data source时指定了jdbc provide,则以当时jdbc provide的配置为准,后面对jdbc provide的修改,不会影响到已新建的Data source(重启生效)


java.sql.SQLRecoverableException: Communications link failure Last packet sent to the server was 0 ms ago.

解决:确认jar包存在;检查数据库连接URL;
可能为mysql JDBC jar包版本问题,修改jar包;


javax.naming.NameNotFoundException: Context: DefaultCell01/nodes/DefaultNode01/servers/server1, name: comp/env/local_container: First component in name comp/env/local_container not found.

解决:不使用jndi的域,直接保持数据源名一致(不使用java:/com/env/xxx)
https://veryls.iteye.com/blog/1841525
eg:
Spring-ds.xml:配置jndiName = jdbc/local_jndi
Websphere:配置jndiName = jdbc/local_jndi


java.security.NoSuchAlgorithmException: sunX509 KeyManagerFactory not available

解决:WebSphere不支持SunX509,只有ibmX509
https://issues.apache.org/jira/browse/ZOOKEEPER-2429
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(“sunX509”);
修改为:
String defaultAlgorithm = KeyManagerFactory.getDefaultAlgorithm();
KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(defaultAlgorithm);


javax.net.ssl.SSLException: Received fatal alert: protocol_version

解决:代码实现替换版本
https://developer.ibm.com/answers/questions/206952/how-do-i-configure-websphere-application-server-ss.html
https://jazz.net/forum/questions/219184/error-javaxnetsslsslexception-received-fatal-alert-protocol_version-starting-rqm-command-line-adapter-with-java-18
https://stackoverflow.com/questions/38398265/kubernetes-fatal-alert-protocol-version-error-when-creating-a-deployment
https://developer.ibm.com/recipes/tutorials/configuring-tlsv1-2-for-websphere-application-servers-8-5-5/

确认接口的ssl版本
curl -k --tlsv1.2 https://10.8.6.37:6443
curl -k --tlsv1.0 https://10.8.6.37:6443
openssl s_client -connect 10.8.6.37:9443 -tls1_2


java.lang.OutOfMemoryError: Java 堆空间

解决:设置JVM参数
Servers > Server Types(WebSphere application servers) > server1 >
Configuration > Server Infrastructure > Java and Process Management(Process definition) >
Additional Properties > Java Virtual Machine


端口冲突

解决
server1 > Ports
Environment > Virtual hosts


java.lang.NoSuchMethodError: javax/persistence/JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;

java.lang.NoSuchMethodError: javax/persistence/Table.indexs();
解决:由于was8默认使用jpa2.0,而项目使用jpa2.1,导致冲突。一般为jar包冲突
Enterprise Applications > afa-console_war > Manage Modules > afa-console.war > Class loader order(parent last)
https://stackoverflow.com/questions/29476026/deploying-application-using-hibernate-jpa-2-1-to-ibm-websphere-gives-nullpointer/29476578
https://stackoverflow.com/questions/28062271/java-lang-nosuchmethoderror-javax-persistence-joincolumn-foreignkeyljavax-per



Was9 Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype

解决:包冲突问题
https://developer.ibm.com/answers/questions/439545/websphere-9-startup-problem/
If applications are not using CDI, disabling CDI should help.
application server > Server Infrastructure > Java and process management(Process definition) > Additional Properties(Java virtual machine) > Additional Properties(Custom properties)
Add this custom property with value false
Name = com.ibm.ws.cdi.enableCDI
Value = false


javax.xml.parsers.SAXParserFactory: org.apache.xerces.jaxp.SAXParserFactoryImpl not a subtype

javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype
java.lang.ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl incompatible with javax.xml.parsers.SAXParserFactory(不兼容)
解决:包冲突问题,移除项目中xml相关的jar包
开启verbose class loading,查看类加载的路径(Servers > Server Types(WebSphere application servers) > server1 > Configuration > Server Infrastructure > Java and Process Management(Process definition) > Additional Properties > Java Virtual Machine > Verbose class loading)
移除xercesImpl-xx.jar 、 xml-apis-xx.jar、xmlParserAPIs-xx.jar、stax-api-xx.jar、woodstox-core-als-xx.jar、woodstox-core-xx.jar
https://stackoverflow.com/questions/19585014/was-8-5-java-lang-classcastexception-org-apache-xerces-jaxp-saxparserfactoryim

https://stackoverflow.com/questions/54106531/javax-xml-parsers-documentbuilderfactory-could-not-be-instantiated-in-websphere
Enterprise Applications > afa-console_war > Manage Modules > afa-console.war > Class loader order(Classes loaded with parent class loader first)


feature is not implemented PreparedStatement.setBinaryStream. WSJdbcPreparedStatement.java db2 ERRORCODE=-4499, SQLSTATE=08001

解决:驱动包版本问题,更改驱动包(JDBC3.0 -> JDBC4.0)
目前使用方案:删掉was自带的 db2jcc.jar(JDBC3.0),数据源配置 db2jcc4.jar(JDBC4.0)
http://www.notonlyanecmplace.com/feature-is-not-implemented-preparedstatement-setbinarystream/
https://www.ibm.com/support/pages/connection-refused-db2-errorcode-4499-during-server-setup
https://blog.csdn.net/xiaoyu714543065/article/details/52775218
https://developer.ibm.com/answers/questions/190002/what-causes-this-exception-when-connecting-to-webs/
https://www.ibm.com/support/pages/troubleshooting-enterprise-applications-websphere-application-server-which-simultaneously-use-jdbc-providers-jdbc-30-and-40-specification-levels


java.sql.SQLNonTransientException: [jcc][t4][10205][11234][4.14.113] Null userid is not supported.

解决:点击数据源名打开详情页,进入JAAS-J2CC认证数据配置(配置JAAS)


Could not obtain WebSphere TransactionManager

java.lang.ClassCastException: com.ibm.ws.tx.jta.TranManagerSet incompatible with javax.transaction.TransactionManager
解决:未知


com.ibm.db2.jcc.am.SqlException: [jcc][t4][10199][10462][4.14.113] Required character converter is not available. ERRORCODE=-4220, SQLSTATE=null
    at com.ibm.db2.jcc.am.ed.a(ed.java:661) ~[db2jcc-db2jcc4.jar:na]
    ...
    at org.hibernate.loader.Loader.doList(Loader.java:2554) ~[hibernate-core-4.3.9.Final.jar:4.3.9.Final]
    ... 72 common frames omitted    

解决:更新jdbc驱动包。对应数据库版本。
目前方案:去掉项目的jar包(db2jcc-db2jcc4.jar),则默认使用was自带的 db2jcc4.jar
https://www.ibm.com/support/pages/db2-jdbc-driver-versions-and-downloads


com.ibm.db2.jcc.am.SqlDataException: [jcc][t4][10275][10041][4.14.113] Unsupported ccsid, encoding, or locale: “Cp1386”. ERRORCODE=-4220, SQLSTATE=22021
    at com.ibm.db2.jcc.am.ed.a(ed.java:669) ~[db2jcc4.jar:na]
    at com.ibm.db2.jcc.am.ed.a(ed.java:60) ~[db2jcc4.jar:na]
    ... 71 common frames omitted

Caused by: java.io.UnsupportedEncodingException: GBK
at sun.io.Converters.getConverterClass(Converters.java:319) ~[jacl.jar:na]
at com.ibm.db2.jcc.am.Agent.getByteToCharConverter(Agent.java:463) ~[db2jcc4.jar:na]
… 93 common frames omitted
解决
https://developer.ibm.com/answers/questions/439579/unsupported-ccsid-encoding-or-locale-cp037-errorco.html?smartspace=decision-optimization


com.ibm.ws.webcontainer.webapp.WebApp initializeStaticFileHandler SRVE0278E: Error while adding servlet mapping --> /*.

解决:未知
https://www.ibm.com/support/knowledgecenter/en/SSAW57_9.0.5/com.ibm.websphere.nd.multiplatform.doc/ae/tweb_jspengine.html
https://stackoverflow.com/questions/41773355/webapp-srve0278e-error-while-adding-servlet-mapping
https://www-01.ibm.com/support/docview.wss?uid=swg1PI34990


使用DB2数据库,频繁锁超时异常,locktimeout

解决:创建锁监视器,查看锁超时语句STMT_TEXT(锁拥有者ACTIVITY_TYPE=“Past”、锁请求者ACTIVITY_TYPE=“CURRENT”)以及事务隔离级别EFFECTIVE_ISOLATION
调整超时时间(db2 update db cfg for 数据库名 using locktimeout 30)

WAS默认事务隔离级别:https://www.ibm.com/support/pages/changing-default-isolation-level-non-cmp-applications-and-describing-how-do-so-using-new-custom-property-webspheredefaultisolationlevel
DB2事务隔离级别&加锁机制:https://www.cnblogs.com/live-and-learn077/p/5462548.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值