我有一个类,它有一个在xml中定义的init方法
<bean id="appStarter" class="com.myapp.myClass" init-method="init" destroy-method="destroy"/>
Run Code Online (Sandbox Code Playgroud)
我的课:
public class myClass{
private Thread t;
public void init() {
t = new Thread() {
@Override
public void run() {
while (true)
try {
doStuff();
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
};
t.start();
}
public void destroy() {
t.interrupt();
}
}
Run Code Online (Sandbox Code Playgroud)
当应用程序启动时,这些线程运行正常,一切正常,一段时间后我得到以下异常.
INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.mail.imap.IMAPStore. The eventual following stack trace is caused by an error thrown for debugging …Run Code Online (Sandbox Code Playgroud) 我正在尝试在swing应用程序中使用hibernate 3.5.1 final,这里是我正在使用的jar:
当我尝试运行该应用程序时,出现以下错误:
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:165)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:127)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.xeno.xecamp.desktopManagement.Main.main(Main.java:16)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 11 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:128)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:108)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:279)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:265)
at …Run Code Online (Sandbox Code Playgroud) 嗨伙计们尝试在tomcat上使用eclipse/linux运行我的应用程序时,我收到以下信息消息:
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64/server:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/amd64:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/../lib/amd64:/usr/lib64/xulrunner-addons:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
我有一个部门实体,其关系如下:
许多部门可以在一个父部门:
@ManyToOne
@JoinColumn(name = "ik_parent_department_id")
private Department parentDepartment;
Run Code Online (Sandbox Code Playgroud)一个父部门可以有很多部门:
@OneToMany(mappedBy = "parentDepartment")
private Set<Department> children = new HashSet<Department>(0);
Run Code Online (Sandbox Code Playgroud)我想实现下一个:当我删除一个部门时,该部门所有子项的ik_parent_department_id参数都设置为null.任何想法如何做到这一点?
我只是想知道如何增加tomcat线程池中的线程数?以及设置最大值的数字,我不知道什么是合适的?
当尝试使用Oracle SQL Developer连接到我的数据库时,我收到错误:
ORA-28001密码已过期
如何在SQL Developer中更改密码?
问候所有我想让JQuery在两个函数之间休眠/等待一秒钟
$('#div1').hide();
//sleep or wait or for a sec
$("#div2").show();
Run Code Online (Sandbox Code Playgroud)
该怎么办?
我通过添加以下行来设置tomcat 7的堆大小 catalina.sh
export CATALINA_OPTS="-Xms512m -Xmx1024m"
Run Code Online (Sandbox Code Playgroud)
然后停下来,启动了tomcat.但是当尝试使用命令jmap -heap获取堆大小时,我可以注意到内存不会改变:
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 526385152 (502.0MB)
NewSize = 1048576 (1.0MB)
MaxNewSize = 4294901760 (4095.9375MB)
OldSize = 4194304 (4.0MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 16777216 (16.0MB)
MaxPermSize = 67108864 (64.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 99352576 (94.75MB)
used = 9643144 (9.196418762207031MB)
free = 89709432 (85.55358123779297MB)
9.705982862487632% used
From Space:
capacity = 4063232 (3.875MB)
used = 0 (0.0MB)
free = 4063232 …Run Code Online (Sandbox Code Playgroud) 我想在独立的应用程序中使用嵌入式德比的hibernate,我有一些问题:
如果你也可以建议我这个方法的一些好的教程,这将是更好的,提前谢谢.
hibernate ×3
java ×3
tomcat ×3
java-ee ×2
tomcat7 ×2
apache ×1
derby ×1
exception ×1
foreach ×1
heap-memory ×1
jakarta-mail ×1
javascript ×1
jquery ×1
linux ×1
log4j ×1
maven ×1
oracle ×1
slf4j ×1
threadpool ×1