message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.ExceptionInInitializerError
com.sonic.HibernateUtil.<clinit>(HibernateUtil.java:32)
com.sonic.struts.action.LoginAction.execute(LoginAction.java:58)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs
----------------------------------------
原文件是:HibernateUtil.java
package com.sonic;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import net.sf.hibernate.*;
import net.sf.hibernate.cfg.*;
/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
public class HibernateUtil {
private static Log log=LogFactory.getLog(HibernateUtil.class);
private static final SessionFactory sessionFactory;
static {
try{
sessionFactory=new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
log.error("Initial SessionFactory creation failed.",ex);
throw new ExceptionInInitializerError(ex);
}
}
public static final ThreadLocal session=new ThreadLocal();
public static Session Session() throws HibernateException {
Session s=(Session)session.get();
//Open a new Session, if this Thread has none yet
if (s==null) {
s=sessionFactory.openSession();
session.set(s);
}
return s;
}
public static void closeSession() throws HibernateException {
Session s=(Session) session.get();
session.set(null);
if (s !=null)
s.close();
}
}
23 个解决方案
#1
static块抛出了异常
是不是你读config的时候出了问题
是不是你读config的时候出了问题
#2
我是用eclipse+myeclipse做的
#3
struts-config.xml文件内容是自动配成的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans />
<global-exceptions />
<global-forwards />
<action-mappings >
<action path="/login" type="com.sonic.struts.action.LoginAction" />
</action-mappings>
<message-resources parameter="com.sonic.struts.ApplicationResources" />
</struts-config>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans />
<global-exceptions />
<global-forwards />
<action-mappings >
<action path="/login" type="com.sonic.struts.action.LoginAction" />
</action-mappings>
<message-resources parameter="com.sonic.struts.ApplicationResources" />
</struts-config>
#4
要看你的hibernate.cfg.xml,贴出来吧,不关struts config的事情
#5
hibernate.cfg.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
</session-factory>
</hibernate-configuration>
楼上的说得对
我把com.sonic.struts.action.LoginAction的LoginAction.java文件的注释掉数据连接部分就不会出错了
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
/*获取提交的用户名称和密码
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
*/ 注释掉就可以了
return (new ActionForward("/index.jsp"));
}
}
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
</session-factory>
</hibernate-configuration>
楼上的说得对
我把com.sonic.struts.action.LoginAction的LoginAction.java文件的注释掉数据连接部分就不会出错了
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
/*获取提交的用户名称和密码
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
*/ 注释掉就可以了
return (new ActionForward("/index.jsp"));
}
}
#6
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>//这儿配错了,一般是org.hibernate.dialect.MySQLDialect这个
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>//这儿配错了,一般是org.hibernate.dialect.MySQLDialect这个
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
#7
sessionFactory=new Configuration().configure().buildSessionFactory();
---
在创建工厂的时候发生了错误,这个需要更多的错误信息才可以知道,你给出的信息还看不出来
---
在创建工厂的时候发生了错误,这个需要更多的错误信息才可以知道,你给出的信息还看不出来
#8
to:ll42002(灰舌)
我用的Hibername是2.0版的所以用net.sf.hibernate.dialect.MySQLDialect
to:zhkchi(火焰神)
我在编译时老出现端口被用的问题
2006-6-18 21:14:55 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.5\bin;D:\Tomcat5.5\bin
2006-6-18 21:14:55 org.apache.coyote.http11.Http11BaseProtocol init
严重: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.coyote.http11.Http11BaseProtocol.init(Http11BaseProtocol.java:138)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException: Protocol handler initialization failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.initialize(Connector.java:1018)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3313 ms
2006-6-18 21:14:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2006-6-18 21:14:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.17
2006-6-18 21:14:56 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\jsp_web\ROOT does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3814)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3985)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Context [/root] startup failed due to previous errors
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/root] has not been started
2006-6-18 21:15:00 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 13 column 80: The reference to entity "characterEncoding" must end with the ';' delimiter.
我用的Hibername是2.0版的所以用net.sf.hibernate.dialect.MySQLDialect
to:zhkchi(火焰神)
我在编译时老出现端口被用的问题
2006-6-18 21:14:55 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.5\bin;D:\Tomcat5.5\bin
2006-6-18 21:14:55 org.apache.coyote.http11.Http11BaseProtocol init
严重: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.coyote.http11.Http11BaseProtocol.init(Http11BaseProtocol.java:138)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException: Protocol handler initialization failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.initialize(Connector.java:1018)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3313 ms
2006-6-18 21:14:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2006-6-18 21:14:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.17
2006-6-18 21:14:56 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\jsp_web\ROOT does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3814)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3985)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Context [/root] startup failed due to previous errors
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/root] has not been started
2006-6-18 21:15:00 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 13 column 80: The reference to entity "characterEncoding" must end with the ';' delimiter.
#9
严重: Error starting endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)
at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.start(Connector.java:1096)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
信息: Server startup in 87687 ms
2006-6-18 21:16:23 org.apache.catalina.core.StandardServer await
严重: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)
at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.start(Connector.java:1096)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
信息: Server startup in 87687 ms
2006-6-18 21:16:23 org.apache.catalina.core.StandardServer await
严重: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
#10
端口被占用,当然启动不了tomcat,换一个端口试试。
#11
我把最初用8080改到80改到88改到8123端口都有这样的提示
但在浏览器里面运行其它的程序是没有问题的
但在浏览器里面运行其它的程序是没有问题的
#12
初步估计是你的Tomcat已经作为系统服务已经起动了(不需要再手动启动)。
#13
是的,我是先启动Tomcat5.5,然后到eclipse的工具栏点击Tomcat5--->start
#14
顶
#15
可能手动启动的tomcat5.5和eclipse启动的是同一个tomcat,那么肯定会有这个问题了。
两者选其一就行了。
两者选其一就行了。
#16
是的。只要啟動一次Tomcat就可以了
#17
但是hibername連數數據還是有問題。
#18
最新的问题又是什么
#19
关注..
#20
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
com.sonic.struts.action.LoginAction.execute(LoginAction.java:73)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
com.sonic.struts.action.LoginAction.execute(LoginAction.java:73)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
#21
这个不一定是hibernate的问题,把LoginAction.java这个类的代码贴出来看看。
#22
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
return (new ActionForward("/index.jsp"));
}
}
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
return (new ActionForward("/index.jsp"));
}
}
#23
自己搞定
#1
static块抛出了异常
是不是你读config的时候出了问题
是不是你读config的时候出了问题
#2
我是用eclipse+myeclipse做的
#3
struts-config.xml文件内容是自动配成的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans />
<global-exceptions />
<global-forwards />
<action-mappings >
<action path="/login" type="com.sonic.struts.action.LoginAction" />
</action-mappings>
<message-resources parameter="com.sonic.struts.ApplicationResources" />
</struts-config>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<data-sources />
<form-beans />
<global-exceptions />
<global-forwards />
<action-mappings >
<action path="/login" type="com.sonic.struts.action.LoginAction" />
</action-mappings>
<message-resources parameter="com.sonic.struts.ApplicationResources" />
</struts-config>
#4
要看你的hibernate.cfg.xml,贴出来吧,不关struts config的事情
#5
hibernate.cfg.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
</session-factory>
</hibernate-configuration>
楼上的说得对
我把com.sonic.struts.action.LoginAction的LoginAction.java文件的注释掉数据连接部分就不会出错了
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
/*获取提交的用户名称和密码
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
*/ 注释掉就可以了
return (new ActionForward("/index.jsp"));
}
}
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
</session-factory>
</hibernate-configuration>
楼上的说得对
我把com.sonic.struts.action.LoginAction的LoginAction.java文件的注释掉数据连接部分就不会出错了
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
/*获取提交的用户名称和密码
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
*/ 注释掉就可以了
return (new ActionForward("/index.jsp"));
}
}
#6
<property name="connection.username">root</property>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>//这儿配错了,一般是org.hibernate.dialect.MySQLDialect这个
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
<property name="connection.url">jdbc:mysql://localhost:3306/jcc</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>//这儿配错了,一般是org.hibernate.dialect.MySQLDialect这个
<property name="connection.password"></property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- mapping files -->
<mapping resource="com/sonic/Userlist.hbm.xml"/>
#7
sessionFactory=new Configuration().configure().buildSessionFactory();
---
在创建工厂的时候发生了错误,这个需要更多的错误信息才可以知道,你给出的信息还看不出来
---
在创建工厂的时候发生了错误,这个需要更多的错误信息才可以知道,你给出的信息还看不出来
#8
to:ll42002(灰舌)
我用的Hibername是2.0版的所以用net.sf.hibernate.dialect.MySQLDialect
to:zhkchi(火焰神)
我在编译时老出现端口被用的问题
2006-6-18 21:14:55 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.5\bin;D:\Tomcat5.5\bin
2006-6-18 21:14:55 org.apache.coyote.http11.Http11BaseProtocol init
严重: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.coyote.http11.Http11BaseProtocol.init(Http11BaseProtocol.java:138)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException: Protocol handler initialization failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.initialize(Connector.java:1018)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3313 ms
2006-6-18 21:14:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2006-6-18 21:14:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.17
2006-6-18 21:14:56 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\jsp_web\ROOT does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3814)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3985)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Context [/root] startup failed due to previous errors
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/root] has not been started
2006-6-18 21:15:00 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 13 column 80: The reference to entity "characterEncoding" must end with the ';' delimiter.
我用的Hibername是2.0版的所以用net.sf.hibernate.dialect.MySQLDialect
to:zhkchi(火焰神)
我在编译时老出现端口被用的问题
2006-6-18 21:14:55 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\jdk1.5\bin;D:\Tomcat5.5\bin
2006-6-18 21:14:55 org.apache.coyote.http11.Http11BaseProtocol init
严重: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.coyote.http11.Http11BaseProtocol.init(Http11BaseProtocol.java:138)
at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException: Protocol handler initialization failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.initialize(Connector.java:1018)
at org.apache.catalina.core.StandardService.initialize(StandardService.java:580)
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:791)
at org.apache.catalina.startup.Catalina.load(Catalina.java:503)
at org.apache.catalina.startup.Catalina.load(Catalina.java:523)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:266)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
2006-6-18 21:14:55 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 3313 ms
2006-6-18 21:14:56 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2006-6-18 21:14:56 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.17
2006-6-18 21:14:56 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext resourcesStart
严重: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\jsp_web\ROOT does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3814)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3985)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:14:56 org.apache.catalina.core.StandardContext start
严重: Error in resourceStart()
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Error getConfigured
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext start
严重: Context [/root] startup failed due to previous errors
2006-6-18 21:14:57 org.apache.catalina.core.StandardContext stop
信息: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/root] has not been started
2006-6-18 21:15:00 org.apache.commons.digester.Digester fatalError
严重: Parse Fatal Error at line 13 column 80: The reference to entity "characterEncoding" must end with the ';' delimiter.
#9
严重: Error starting endpoint
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)
at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.start(Connector.java:1096)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
信息: Server startup in 87687 ms
2006-6-18 21:16:23 org.apache.catalina.core.StandardServer await
严重: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)
at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use: JVM_Bind:88
at org.apache.catalina.connector.Connector.start(Connector.java:1096)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2006-6-18 21:16:23 org.apache.catalina.startup.Catalina start
信息: Server startup in 87687 ms
2006-6-18 21:16:23 org.apache.catalina.core.StandardServer await
严重: StandardServer.await: create[8005]:
java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
#10
端口被占用,当然启动不了tomcat,换一个端口试试。
#11
我把最初用8080改到80改到88改到8123端口都有这样的提示
但在浏览器里面运行其它的程序是没有问题的
但在浏览器里面运行其它的程序是没有问题的
#12
初步估计是你的Tomcat已经作为系统服务已经起动了(不需要再手动启动)。
#13
是的,我是先启动Tomcat5.5,然后到eclipse的工具栏点击Tomcat5--->start
#14
顶
#15
可能手动启动的tomcat5.5和eclipse启动的是同一个tomcat,那么肯定会有这个问题了。
两者选其一就行了。
两者选其一就行了。
#16
是的。只要啟動一次Tomcat就可以了
#17
但是hibername連數數據還是有問題。
#18
最新的问题又是什么
#19
关注..
#20
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
com.sonic.struts.action.LoginAction.execute(LoginAction.java:73)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
com.sonic.struts.action.LoginAction.execute(LoginAction.java:73)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
#21
这个不一定是hibernate的问题,把LoginAction.java这个类的代码贴出来看看。
#22
LoginAction.java
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
return (new ActionForward("/index.jsp"));
}
}
----------------
package com.sonic.struts.action;
import java.util.Iterator;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Query;
import net.sf.hibernate.Session;
import net.sf.hibernate.Transaction;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.sonic.HibernateUtil;
import com.sonic.Userlist;
/**
* MyEclipse Struts
* Creation date: 04-10-2005
*
* XDoclet definition:
* @struts:action validate="true"
*/
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
* @throws HibernateException
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws HibernateException {
//注释掉就可以了
String userName=request.getParameter("userName");
String userPwd=request.getParameter("userPwd");
String mUserPwd=null;
Userlist ul=null;
//创建连接
Session session=HibernateUtil.Session();
//创建事务
Transaction tx=session.beginTransaction();
//创建对话
Query query=session.createQuery("select u from userlist as u where userName='" +
userName + "'");
try{
Iterator it = query.iterate();
ul = (Userlist) it.next();
mUserPwd=ul.getUserpwd();
}catch (Exception e) {
System.out.println(e.getMessage());
}
if(userPwd.equals(mUserPwd))
request.setAttribute("loginOk","Hello " + ul.getUsername());
else
request.setAttribute("loginOk","Login Error!");
//事务提交
tx.commit();
//关闭连接
HibernateUtil.closeSession();
return (new ActionForward("/index.jsp"));
}
}
#23
自己搞定