一、javamail 异常
1. java.lang.NoClassDefFoundError: javax/mail/Authenticator 表示没找到mail.jar等javamail所需的依赖库,将这些依赖文件放到tomcat自带库文件夹或部署项目的WEB-INF/lib目录下即可。
2. Tomcat: java.lang.ClassCastException: javax.mail.Session 这个异常说明Tomcat自带库和webapp项目库里均有mail.jar和activation.jar依赖文件,删除两者之一即可。
官方说明:
Although Tomcat 5.5 supports J2EE, you still need to get the activation.jar (Java Activation Framework) and mail.jar (JavaMail) files from Sun's site.
JavaMail API
Java Activation Framework (JAF)
The ClassCastException is most likely being thrown being thrown because you have either of those two libraries in a WEB-INF/lib directory within one of your applications. To avoid this problem, make sure that you only have the libraries in the $TOMCAT_HOME/common/lib/ directory.
Also be sure to read the JNDI resources page on the Apache Tomcat site: http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html
二、hibernate异常
1. org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect). Could not synchronize database state with session
说明操作的对象应用了乐观锁;version
错误原因:当在进行操作时,当前version版本与DB中version版本不一致:
A:另外有人对此记录进行了相似操作;
B:自己操作有误:。
例如通过编辑页面来修改一条记录时,传回来的form对象中version为空,然后又指导这些form中的值copy到相应的实体对象中,此时此实体对象中的version也为空,当update时version不一致就会出错。
解决:
A. 用form传数据时把version也传过来
B. 从DB中把version查出来赋给实体对象再更新
三、开发工具
1. eclipse中jboss启动时提示 50 seconds. 超时
解决方法1:双击servers中的”JBoss v4.2 at localhost”,在timeout选项中调大start时间就可以了。
解决方法2:eclipse中jboss启动时提示
Server JBoss v4.2 at localhost was unable to start within 50 seconds.
If the server requires more time, try increasing the timeout in the server editor.
解决办法,修改
workspace\.metadata\.plugins\org.eclipse.wst.server.core\servers.xml
<server auto-publish-setting="1" hostname="localhost" id="JBoss v4.2 at localhost" name="JBoss v4.2 at localhost" runtime-id="JBoss v4.2" server-type="org.eclipse.jst.server.generic.jboss42" server-type-id="org.eclipse.jst.server.generic.jboss42" start-timeout="50" stop-timeout="15" timestamp="7">
把 start-timeout="50" 改为 start-timeout="500000"
重启eclipse就可以了
2. eclipse 安装jboss tools 重启报错(Juno Service Release 2, Jboss4.2.3.GA)
org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: Cannot cast org.eclipse.core.commands.CommandManager to org.eclipse.core.commands.CommandManager
...
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
Caused by: java.lang.ClassCastException: Cannot cast org.eclipse.core.commands.CommandManager to org.eclipse.core.commands.CommandManager
... 27 more
...
org.eclipse.e4.core.di.InjectionException: Unable to process "CommandProcessingAddon.commandService": no actual value was found for the argument "ECommandService".
...
org.eclipse.e4.core.di.InjectionException: Unable to process "BindingProcessingAddon.commandService": no actual value was found for the argument "ECommandService".
...
java.lang.NullPointerException
at org.eclipse.e4.ui.internal.workbench.E4Workbench.processHierarchy(E4Workbench.java:172)
...
解决办法:
Problems with Eclipse's workspaces tend to be painful. Try going to your installation path, and find configuration\org.eclipse.equinox.simpleconfigurator\.
Open bundle.info and then delete the lower version of duplicate entry for org.eclipse.core.commands. Then restart the eclipse with the -clean option.
四、apache httpd常见错误
1. Starting httpd: httpd: apr_sockaddr_info_get() failed for MYHOST
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName.
这个问题应该是没有在 /etc/httpd/conf/httpd.conf 中设定 ServerName 所以它会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。
所以要解决这个问题可以设定 ServerName 或者在 /etc/hosts 中填入自己的主机名 MYHOST,像这样:
>vi /etc/hosts
127.0.0.1 localhost.localdomain localhost MYHOST
2. 登陆时提示:“缺少 mysqli 扩展。请检查 PHP 配置
请检查 PHP 配置,查看php.ini 文件,发现没有mysql扩展,所以需要安装php-mysql
3. The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results.
yum install php-mbstring
4. The mcrypt extension is missing. Please check your PHP configuration.
I installed php 5.3 and some modules using
yum install php53-{module-name}
But mcrypt did not work.
I searched like this:
yum list php* | grep mcry
The only package that came up was
php-mcrypt.x86-64 5.1.6-15.e15.centos.1 extras
I have the same exact problem with mhash. The results for php are even more confusing.
I know this is probably a dumb question, but any help would be appreciated. I am used to Ubuntu's simple "apt-get install" and everything works. CentOS seems to be a lot more detail oriented.
The package you are looking for exists! All you need to do is
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install php-mcrypt
5. 严重: Unable to set localhost. This prevents creation of a GUID.
Cause was: gom.localdomain: gom.localdomain
java.net.UnknownHostException: gom.localdomain: gom.localdomain
at java.net.InetAddress.getLocalHost(InetAddress.java:1426)
at net.sf.ehcache.Cache.<clinit>(Cache.java:199)
修改/etc/hosts文件。在其中加上一条(对应改成你自己的机器名称),重启后问题解决。
127.0.0.1 gom.localdomain
五、J2EE常见错误
1. uploadify与struts2 整合时遇到的异常
刚开始以为form没设置enctype="multipart/form-data"属性,修改uplaodify源码,还是老问题,后来又以为是uploadify的flash SessionID 与Server不同所致,于是回传SessionId,还是不能解决问题。在无数次尝试之后发现是名称问题,真他妈郁闷呀….
File名称不能命名为upload,我该为myupload之后,一切都正常了…
当时项目要求用的是struts2 v2.3.4的版本,不知是不是这个问题
JSP
<input licencePhotoname="upload" type="file" />
Action源码
private File upload;//和HTML中input标记name同名
private String uploadFileName;//Struts2拦截器获得的文件名
private String uploadContentType;
报的错误如下:
[com.opensymphony.xwork2.ognl.OgnlValueStack]-[WARN] Error setting expression 'Upload' with value '[Ljava.lang.String;@ff5d3f'
ognl.MethodFailedException: Method "setUpload" failed for object
com.ttni.haveFun.Action.upload.FileUploadAction@1e229be[java.lang.NoSuchMethodException:
com.ttni.haveFun.Action.upload.FileUploadAction.setUpload([Ljava.lang.String;)]
......
Cannot create type class java.io.File from value Submit Query - [unknown location]
....
2. log4j:WARN Error initializing output writer.
log4j:WARN Unsupported encoding?
把 log4j.appender.stdout.Encoding=UTF-8 这一行去掉就可以了
3. Syntax error on line 292 of /etc/httpd/conf/httpd.conf: DocumentRoot must be a directory
解决办法:
The link you posted under "Other websites" highlights the root cause of your problem, which is Selinux.
Unless the server is part of a super secure environment, I would simply disable Selinux.
On RedHat / CentOS / Scientific Linux this can easily be done by editing /etc/sysconfig/selinux - find the parameter "selinux" and change the option "enforcing" to "disabled" as per the extract below:
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
It is probably wise to reboot the server after making this change.
相关推荐
【低空经济】低空人工智能调度中心建设方案
少儿编程scratch项目源代码文件案例素材-诅咒大厦.zip
scratch少儿编程逻辑思维游戏源码-纸片马里奥 激流勇进.zip
scratch少儿编程逻辑思维游戏源码-一路跳跃.zip
内容概要:本文详细介绍了五个用于空气耦合超声仿真的COMSOL模型,涵盖二维和三维场景,适用于铝板和钢板的多种缺陷检测。每个模型都包含了具体的参数设置、边界条件选择以及优化技巧。例如,Lamb波检测模型展示了如何利用A0模态检测铝板内的气泡,而三维模型则强调了内存管理和入射角参数化扫描的重要性。表面波检测模型提供了裂纹识别的相关性分析方法,变厚度模型则展示了如何通过几何参数化来模拟复杂的工件形态。文中还分享了许多实用的操作技巧,如内存优化、信号处理和自动化检测逻辑。 适用人群:从事无损检测研究的技术人员、COMSOL软件使用者、超声检测领域的研究人员。 使用场景及目标:①帮助用户理解和掌握空气耦合超声仿真的具体实现方法;②提供实际工程应用中的缺陷检测解决方案;③指导用户进行高效的仿真建模和结果分析。 其他说明:文中提供的模型不仅涵盖了常见的缺陷检测场景,还包括了一些高级技巧,如参数化扫描、自动化检测逻辑等,能够显著提高工作效率。同时,文中还给出了硬件配置建议和一些常见的注意事项,确保用户可以顺利运行这些模型。
实训商业源码-【脐橙】租赁 2.80.0+租赁商家-毕业设计.zip
scratch少儿编程逻辑思维游戏源码-幽灵冲刺.zip
scratch少儿编程逻辑思维游戏源码-粘粘世界物理.zip
机器人开发教程&案例&相关项目资源,奖励仅
实训商业源码-酒吧微上墙4.1.0-毕业设计.zip
实训商业源码-会员计次卡V1.1.1-毕业设计.zip
实训商业源码-二手跳蚤市场V5.4.10带微信支付+上架通知+广告插件-毕业设计.zip
实训商业源码-健康保健类企业网站源码-毕业设计.zip
Linux环境安装mysql的RPM包以及安装步骤:客户端和服务端的安装
实训商业源码-房产中介小程序8.0.51+前端-毕业设计.zip
scratch少儿编程逻辑思维游戏源码-钟声.zip
实训商业源码-【最新版】Xyplayer X3.96 官方正式版-毕业设计.zip
scratch少儿编程逻辑思维游戏源码-追逐游戏.zip
内容概要:本文详细介绍了基于Android Studio开发的日历备忘录记事本项目,涵盖日历查看、添加备忘录、闹钟提醒和删除备忘录等功能。项目使用SQLite数据库进行数据管理和持久化,利用AlarmManager实现闹钟提醒功能。文章深入讲解了各个功能模块的实现细节,如日历视图的使用、数据库操作类的设计、闹钟设置的逻辑以及界面交互的优化。此外,还探讨了一些常见的开发技巧和注意事项,如时间戳的存储、手势识别的应用等。 适用人群:适用于初学者和有一定经验的Android开发者,尤其是希望深入了解SQLite数据库操作和AlarmManager使用的开发者。 使用场景及目标:① 学习如何使用Android Studio构建完整的应用程序;② 掌握SQLite数据库的基本操作,包括建表、增删查改;③ 理解AlarmManager的工作机制及其在实际项目中的应用;④ 提升用户体验,如优化界面交互和提高代码质量。 其他说明:文中提供的源码和详细的代码注释有助于读者更好地理解和实践。同时,项目中预留了一些扩展任务,鼓励读者进一步探索和提升技能。
X52K数控铣床改造纵向进给机构CAD装配图.rar