我怎么能阻止这个?
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-2" java.lang.OutOfMemoryError: PermGen space
Run Code Online (Sandbox Code Playgroud)
例如,如果我经常重新加载数据表页面就会发生这种情况.我理解垃圾收集器有一些错误的设置..
我正在使用Eclipse Java EE IDE,JSF2,richfaces4
我InvalidObjectException: Could not find a SessionFactory named: null重新启动tomcat服务器后得到了.
我找到了一些可能的解决方案:
如果您尝试序列化已断开连接的Hibernate会话并在其他VM中反序列化,或者,如果类加载器已重新启动(例如,在应用程序服务器或Web容器中的热重新部署期间),则会发生此异常.这在Tomcat中尤为明显.在应用程序服务器中,总是使用JNDI来存储SessionFactory,如文档所述.在Tomcat或其他Web容器中, 在上下文重新加载期间禁用HttpSession序列化.这有副作用,在Web容器的文档中有解释.
我该怎么做?在上下文重新加载期间禁用HttpSession序列化?
注意:我在Eclipse中使用Tomcat7.
更新:
我已尝试在context.xml以下位置启用此标记:
<Manager pathname="" />
是的,异常消失,但我失去了持久性会话,所以我必须在tomcat服务器重启后再次登录.
我是否理解会话持久性,如果我相信,在例如JSF应用程序中重启tomcat之后应保留该会话(并且我不能通过登录创建新会话)?
UPDATE2(会话管理员):
@SessionScoped
@ManagedBean(name="userManager")
public class UserManager implements Serializable {
private static final long serialVersionUID = 1L;
private transient HttpSession session;
private String username;
private String password;
private User user;
public String login() {
// here is seraching for user in database (based on username and password)
if (user != null) {
FacesContext context = …Run Code Online (Sandbox Code Playgroud) 我是新手lucene用户,现在尝试获得一些基础知识.
我有三个文件:
apache_empty.txt (空的文件), apache.txt(包含许多'apache'令牌),other.txt(只包含一个标记 - 'apache')当我尝试搜索'apache',我只得到 apache.txt和other.txt在结果,但我想得连apache_empty.txt文件,该文件的名称中搜索的词...
这就是我如何向索引添加文档:
protected Document getDocument(File f) throws Exception
{
Document doc = new Document();
Field contents = new Field("contents", new FileReader(f));
Field parent = new Field("parent", f.getParent(), Field.Store.YES, Field.Index.NOT_ANALYZED);
Field filename = new Field("filename", f.getName(), Field.Store.YES, Field.Index.ANALYZED);
Field fullpath = new Field("fullpath", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED);
filename.setBoost(2.0F);
doc.add(contents);
doc.add(parent);
doc.add(filename);
doc.add(fullpath);
return doc;
}
Run Code Online (Sandbox Code Playgroud)
如何让lucene索引也是文件名?
我正在尝试在C列填写公式,如下所示:
LastRow = Range("A65536").End(xlUp).Row
Range(Cells(1, 3), Cells(LastRow, 3)).Formula = "=A1*B1"
Run Code Online (Sandbox Code Playgroud)
它工作正常.但是有可能跳过C列中的那些单元格,其值例如> 0?
A B C -> A B C
3 2 0 3 2 6
3 4 0 3 4 12
5 6 5 5 6 5 <- this value is not updated
Run Code Online (Sandbox Code Playgroud) 我使用HtmlDataTable查看数据库中的数据时遇到问题.
当我创建组件时,该表有时(不总是)两列的列数.
它被正确显示并且经过几次刷新(没有在dtb或其他东西中移动),例如有6列而不是3列,应用程序(有时)变得不稳定.从那时起,我无法使用表,因为它报告"组件的重复ID".
简单的例子(来源:http://balusc.blogspot.com/2006/06/using-datatables.html):
<h:form id="bde">
<h:dataTable id="tbl"
binding="#{myBDE.dataTable}"
value="#{myBDE.dataList}"
var="bdeItem">
<h:column>
<f:facet name="header">
<h:outputText value="S" />
</f:facet>
<h:outputText value="#{bdeItem.s}" rendered="#{!myBDE.editModeRow}"/>
<h:inputText value="#{bdeItem.s}" rendered="#{myBDE.editModeRow}" required="true" size="3"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{bdeItem.id}"/>
</h:column>
</h:dataTable>
</h:form>
Run Code Online (Sandbox Code Playgroud)
和java.class
protected HtmlDataTable dataTable;
public void setDataTable(HtmlDataTable dataTable)
{
this.dataTable = dataTable;
}
public HtmlDataTable getDataTable()
{
if (dataTable == null)
{
dataTable = new HtmlDataTable();
dataTable.setRows(DEFAULT_TABLE_ROWS);
}
return dataTable;
}
Run Code Online (Sandbox Code Playgroud)
和错误消息:
javax.servlet.ServletException: Component ID …Run Code Online (Sandbox Code Playgroud) 有没有办法将rich:dataTable绑定到bean?我可以在非绑定rich:dataTable中显示项目,但是当我添加绑定属性时,整个dataTable会消失.
部分代码:
<rich:dataTable
id="tableDetail"
value="#{myBdeCheck.dataListBde}"
binding="#{myBdeCheck.dataTable}"
var="bdeItem">
<rich:column>
<f:facet name="header">
<h:outputText value="Select" />
</f:facet>
<h:selectBooleanCheckbox value="#{myBdeCheck.selectedRow}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="Shift" />
</f:facet>
<h:outputText value="#{bdeItem.dayShift}"/>
</rich:column>
<f:facet name="footer">
<h:commandButton id="btnAdd" action="#{myBdeCheck.add}"/>
</f:facet>
</rich:dataTable>
Run Code Online (Sandbox Code Playgroud)
因为JSF正在运作private HtmlDataTable dataTable;.
richfaces还有别的东西吗?谢谢
继续解决这个问题,我已经更换了钻嘴鱼科通过的MyFaces和升级JDK,当我继续工作形式的服务器重新启动后,显示以下错误:
发生错误:
/food.xhtmlNo saved view state could be found for the view identifier: /food.xhtml
Caused by:
javax.faces.application.ViewExpiredException - /food.xhtmlNo saved view state could be found for the view identifier: /food.xhtml
Run Code Online (Sandbox Code Playgroud)
控制台:
SEVERE: Exception loading sessions from persistent storage
java.lang.IllegalStateException: unread block data
at java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2376)
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪:
javax.faces.application.ViewExpiredException: /food.xhtmlNo saved view state could be found for the view identifier: /food.xhtml
at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecutor.java:128)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:171)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at …Run Code Online (Sandbox Code Playgroud) 继续解决这个问题,我发现使用MAT有几个'org.hibernate.impl.SessionFactoryImpl'内存泄漏:
54 instances of "org.hibernate.impl.SessionFactoryImpl", loaded by "org.apache.catalina.loader.WebappClassLoader @ 0xbb00fb0" occupy 33 962 536 (64,40%) bytes.
Biggest instances:
org.hibernate.impl.SessionFactoryImpl @ 0x3f026c0 - 652 664 (1,24%) bytes.
org.hibernate.impl.SessionFactoryImpl @ 0x49018f8 - 652 664 (1,24%) bytes.
org.hibernate.impl.SessionFactoryImpl @ 0x7b0e2b8 - 652 664 (1,24%) bytes.
org.hibernate.impl.SessionFactoryImpl @ 0x7d65e60 - 652 664 (1,24%) bytes.
...
Run Code Online (Sandbox Code Playgroud)
详情:

DaoSF.java
public final class DaoSF implements Serializable
{
private static final long serialVersionUID = 1L;
private static SessionFactory sessionFactory;
private static Session hibSession;
private …Run Code Online (Sandbox Code Playgroud) 从文件中解析这些行的最佳做法是什么?
files txt 50 // first gab are spaces, the second is tabulator
files bmp 9979
files all 2063
score scr 656
index ind 0.0779
index ind 0.0213
Run Code Online (Sandbox Code Playgroud)
我需要获取值(50, 9979等)才能将它们保存到CSV文件(但这不是这个问题的一部分).