关于eclipse j2ee下工程的部署时,tomcat下的本工程的文件夹被eclipse中的覆盖

图片说明是这样的,点击查看原图,这个upload是我在eclipse中建的,我在index.jsp中设置了一个文件上传,只要上传了我都保存到tomcat/webapp/工程名/upload(自己在硬盘上建的文件夹)这个路径下,每次上传文件后,在硬盘那个路径里面会有图片,但是eclipse中却没有图片。所以我重新把tomcat重启一次,但是工程reload后,硬盘里的upload文件夹下的图片也没了,好像是eclipse中的这个工程又重新覆盖了一次,所以硬盘upload里面的图片也没了,想请教下这个该如何解决。。。

2个回答

1.其实你的分析是正确的,每次发布新的代码都会将原来的文件删除。所以第一种方案就是每次发布的时候将原来的文件备份,部署完新的代码再将其
拷贝到原来的目录。但是这样会比较繁琐,但是是一种方案。
2.第二种方案就是实现项目和资源分离的思想,将upload目录放在项目之外,通过tomcat自身的配置实现简单的分离。在tomcat的server.xml配置文件中添加
如下配置项。

  <Context path="/upload/file" docBase="D:\upload\file"></Context>

这样访问图片的路径就会被重新定向到项目之外的路径。从某种意义上方便了项目的重新部署。
3.更好的方案,也是现在比较主流的方案,就是增加一台静态资源服务器,专门用来保存应用项目可能用的静态资源(比如图片资源,文件资源等),上传
接口直接指向远程的静态服务器路径,性能上减轻了应用服务器的压力,同时也免去了部署覆盖原先资源的担忧。

qq_27875615
qq_27875615 谢谢你!
大约 4 年之前 回复
qq_27875615
qq_27875615 恩,谢谢你!现在在学习中,就用采用第二种方案吧!
大约 4 年之前 回复

楼上正解。建议使用第二种方案,存储到制定路径,缓解tomcat服务器压力

qq_27875615
qq_27875615 恩!谢谢!
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Eclipse是如何把项目部署到Tomcat里的,webapps文件夹里并没有项目文件啊

以前做简单的jsp页面时,都是在eclipse j2ee版本里面(不是MyEclipse)里面,配置好tomcat,写好jsp文件,run on server之后就运行起来了,现在结合flex做东西的时候发现对这个过程很不了解,主要问题是: 1.好像web项目的文件需要放在tomcat的webapp文件夹里才能通过localhost:8080/projectname/somejsp.jsp访问,可是通过run on server的方法运行网页时并没有在webapp文件夹下面添加东西 2.MyEclipse里面有个deployment的功能,就是把项目文件夹放到webapp里面去(我是这么理解的),这个和不带MyEclipse插件的eclipse的做法有什么区别? 请大家为我解惑,谢谢、!

用eclipse写的程序启动访问都没问题 部署到tomcat上有问题

用eclipse写的程序启动访问都没问题 部署到tomcat上 查询数据库的操作就特别慢 总是连接超时

eclipse发布web到tomcat,tomcat无法启动,但是单独启动eclipse可以!

错误提示如下: 四月 25, 2015 11:56:45 上午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-nio-8088"] 四月 25, 2015 11:56:45 上午 org.apache.coyote.AbstractProtocol destroy 严重: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8088"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:302) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:473) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:818) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:532) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:859) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485) 上面8088是我把8009改过来的,另外我还试了8007,这就排出了端口的问题!

Tomcat部署后出现重复项目

conf下的server.xml的相关配置如下 <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log." suffix=".txt"/> <Context docBase="test" path="/web" reloadable="true" source="org.eclipse.jst.j2ee.server:test"/></Host> 我把war包放入webapps文件夹下面后,尝试启动.发现会出现test和web这两个同名的文件夹,并且这两个文件夹下面的内容是完全一样的. Linux环境,tomcat版本为7

用myeclipse部署项目到tomcat后,发现classes文件夹为空,这是什么问题

![图片说明](https://img-ask.csdn.net/upload/201603/03/1456972146_110696.png) ![图片说明](https://img-ask.csdn.net/upload/201603/03/1456972199_681033.png)

javaweb项目中jar包相互引用导致tomcat不能正常发布

现在做一个项目是用到结构如下: web项目 A 引用了普通java项目B,我在B里重写了Myservlet,结果两者都引用了j2ee.jar。 项目在tomcat发布时老是报“tomcat/webapps/testweb is locked”大体是这样。 想了解下在这种情况下,如何配置project

maven项目导入到Eclipse中红色叹号!

最近看一个开源CMS系统Magnolia。 环境: Ubuntu14,Eclipse4.4 for j2ee,jdk1.6,tomcat6,maven2.2.1 按照文档,写了一个小项目。用maven。在命令行创建的项目结构大概: myProject ----myProject-webapp ----myTemplateModule 下面两个是上面的module。 在命令行中已经clean install成功。 但是导入到Eclipse中myProject-webapp项目的图标上有红色感叹号。 ![CSDN移动问答][1] 网上说是jar引用问题。我在buildpath》library中没有发现有问题的jar啊,也尝试过order and export,sellect all。打开.classpath里面貌似也没有引用什么jar啊。内容如下:.classpath. 另外,myProject项目上还有个红叉,其中的一个文件引用的某个类,Eclipse说找不到,可是我在library中都找到这个类了。 ![CSDN移动问答][2] 后来,我不管这个红色提醒,就把myProject-webapp部署在tomcat上面了。运行错误: 2014-9-4 18:25:42 org.apache.catalina.startup.TldConfig tldScanJar 严重: Exception processing JAR at resource path /home/user/.m2/repository/com/vaadin/vaadin-shared/7.1.7/vaadin-shared-7.1.7.jar in context /myProject-webapp java.util.zip.ZipException: error in opening zip file at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:127) at java.util.jar.JarFile.<init>(JarFile.java:136) at java.util.jar.JarFile.<init>(JarFile.java:100) at org.apache.catalina.startup.TldConfig.tldScanJar(TldConfig.java:393) at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:320) at org.apache.catalina.startup.TldConfig.lifecycleEvent(TldConfig.java:688) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4616) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 2014-9-4 18:25:42 org.apache.catalina.startup.TldConfig tldScanJar 严重: Exception processing JAR at resource path /home/user/.m2/repository/org/jsoup/jsoup/1.6.3/jsoup-1.6.3.jar in context /myProject-webapp ............ ......... **附件:** .classpath <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" output="target/classes" path="src/main/java"> <attributes> <attribute name="optional" value="true"/> <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> <classpathentry kind="src" output="target/test-classes" path="src/test/java"> <attributes> <attribute name="optional" value="true"/> <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> <classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="maven.pomderived" value="true"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"> <attributes> <attribute name="owner.project.facets" value="jst.web"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45"> <attributes> <attribute name="owner.project.facets" value="java"/> </attributes> </classpathentry> <classpathentry kind="output" path="target/classes"/> </classpath> [1]: http://my.csdn.net/my/album/detail/1784229 [2]: http://my.csdn.net/my/album/detail/1784231

was部署程序启动报 找不到 Servlet 映射 xxxx 的 Servlet 名称错,tomcat启动没问题

日志在下边,说 找不到 Servlet 映射 /fckeditor/editor/filemanager/connectors/* 的 Servlet 名称,但是我看了这个路径下有这个类 web.xml <servlet> <servlet-name>ConnectorServlet</servlet-name> <servlet-class>fckeditor.editor.filemanager.connectors.ConnectorServlet</servlet-class> <load-on-startup>5</load-on-startup> </servlet> <servlet-mapping> <servlet-name>ConnectorServlet</servlet-name> <url-pattern>/fckeditor/editor/filemanager/connectors/*</url-pattern> </servlet-mapping> 还有一堆 [18-11-15 15:25:03:682 CST] 000000a3 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Failed to create class reader for [ WEB-INF/classes/jbpm/pdmanage/SpringUtil.class ] in [ myagent.war ]: [ null ] [18-11-15 15:25:03:682 CST] 000000a3 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Failed to create class reader for [ WEB-INF/classes/jbpm/pdmanage/Variables.class ] in [ myagent.war ]: [ null ] [18-11-15 15:25:03:683 CST] 000000a3 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Failed to create class reader for [ WEB-INF/classes/jbpm/pdmanage/PDManage.class ] in [ myagent.war ]: [ null ] [18-11-15 15:25:03:683 CST] 000000a3 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Failed to create class reader for [ WEB-INF/classes/jbpm/pdmanage/TaskTest.class ] in [ myagent.war ]: [ null ] [18-11-15 15:25:03:683 CST] 000000a3 wtp W org.eclipse.jst.j2ee.commonarchivecore.internal.helpers.WARFileAnnotationsDetector locateAnnotations Failed to create class reader for [ WEB-INF/classes/jbpm/pdmanage/Person.class ] in [ myagent.war ]: [ null ] 等等很多 [18-11-15 16:38:20:804 CST] 00000063 AdminHelper A ADMN1009I: 尝试启动 myagent_war 应用程序。 [18-11-15 16:38:20:822 CST] 00000063 CompositionUn A WSVR0190I: 正在启动 BLA WebSphere:blaname=myagent_war 中的组合单元 WebSphere:cuname=myagent_war。 [18-11-15 16:38:21:070 CST] 00000063 ApplicationMg A WSVR0200I: 正在启动应用程序:myagent_war [18-11-15 16:38:21:070 CST] 00000063 ApplicationMg A WSVR0204I: 应用程序:myagent_war,应用程序构建级别:未知 [18-11-15 16:38:21:471 CST] 00000063 webapp E com.ibm.ws.wswebcontainer.webapp.WebAppConfigurationHelper constructServletMappings SRVE0303E: 找不到 Servlet 映射 /fckeditor/editor/filemanager/connectors/* 的 Servlet 名称。 [18-11-15 16:38:21:472 CST] 00000063 DeployedAppli W WSVR0206E: 应用程序 myagent_war.ear/deployments/myagent_war 的模块 myagent.war 未能启动 [18-11-15 16:38:21:473 CST] 00000063 ApplicationMg W WSVR0101W: 启动 myagent_war 时发生错误 [18-11-15 16:38:21:473 CST] 00000063 ApplicationMg A WSVR0217I: 正在停止应用程序:myagent_war [18-11-15 16:38:21:517 CST] 00000063 ApplicationMg A WSVR0220I: 应用程序已停止:myagent_war [18-11-15 16:38:21:594 CST] 00000063 CompositionUn E WSVR0194E: BLA WebSphere:blaname=myagent_war 中的组合单元 WebSphere:cuname=myagent_war 未能启动。 [18-11-15 16:38:21:628 CST] 00000063 FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC 事件发生于 /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/ffdc/server1_15fe3728_18.11.15_16.38.21.5966888678733202598958.txt com.ibm.ws.runtime.component.CompositionUnitMgrImpl 679 [18-11-15 16:38:21:701 CST] 00000063 FfdcProvider W com.ibm.ws.ffdc.impl.FfdcProvider logIncident FFDC1003I: FFDC 事件发生于 /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/ffdc/server1_15fe3728_18.11.15_16.38.21.6305289518091167357800.txt com.ibm.ws.management.AdminServiceImpl.invoke 679 [18-11-15 16:38:21:705 CST] 00000063 MBeanHelper E Could not invoke an operation on object: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=GCSNode01,version=8.5.5.0,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=GCSNode01Cell,spec=1.0 because of an mbean exception: com.ibm.ws.exception.RuntimeWarning: SRVE0303E: 找不到 Servlet 映射 /fckeditor/editor/filemanager/connectors/* 的 Servlet 名称。 [18-11-15 16:40:36:163 CST] 00000066 WebContainer E com.ibm.ws.webcontainer.internal.WebContainer handleRequest SRVE0255E: 尚未定义要处理 /myagent/login.jsp 的 Web 组/虚拟主机。 [18-11-15 16:40:37:640 CST] 00000063 WebContainer E com.ibm.ws.webcontainer.internal.WebContainer handleRequest SRVE0255E: 尚未定义要处理 /favicon.ico 的 Web 组/虚拟主机。

怎么maven项目部署之后不能访问servlet?

1.我用的myeclipse,servlet中的是ShowTable.java 在浏览器中能访问src/main/webapp中的index.jsp, 访问路径是http://localhost:8080/magSystem/index.jsp,能够显示出内容; 但是想要用servlet:http://localhost:8080/magSystem/ShowTable却404,还不会报错。。 http://localhost:8080/magSystem/servlet/ShowTable 会显示404并且有错误信息: ``` Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary. java.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.zkz.magSystem.dao.BaseDAO.getConnection(BaseDAO.java:16) at com.zkz.magSystem.dao.BaseDAO.runSelect(BaseDAO.java:20) at com.zkz.magSystem.servlet.ShowTable.service(ShowTable.java:43) at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1468) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85) at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132) at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234) at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258) at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319) at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ... 31 more ``` 我的其他配置以及目录如下: ## web.xml ``` <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" > <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>ShowTable</servlet-name> <display-name>This is the display name of my J2EE component</display-name> <description>This is the description of my J2EE component</description> <servlet-class>com.zkz.magSystem.servlet.ShowTable</servlet-class> </servlet> <servlet-mapping> <servlet-name>ShowTable</servlet-name> <url-pattern>/servlet/ShowTable</url-pattern> </servlet-mapping> </web-app> ``` ## ShowTable.java ``` package com.zkz.magSystem.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.jstl.sql.Result; import com.zkz.magSystem.dao.BaseDAO; @WebServlet("/uploadsevlet") public class ShowTable extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; /** * Constructor of the object. */ public ShowTable() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub try { Result result = BaseDAO.runSelect("select * from ex1"); request.setAttribute("rows", result.getRows()); request.getRequestDispatcher("index.jsp").forward(request, response); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); response.sendRedirect("error.jsp"); } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occurs */ public void init() throws ServletException { // Put your code here } } ``` ## BaseDAO.java ``` package com.zkz.magSystem.dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.jsp.jstl.sql.Result; import javax.servlet.jsp.jstl.sql.ResultSupport; public class BaseDAO { public static Connection getConnection() throws Exception{ Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:mysql://localhost:3306/exam","root","qianmoZONGHENG"); } public static Result runSelect(String sql) throws Exception{ Connection conn = getConnection(); PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); //将在线结果集转化为离线结果集 Result result = ResultSupport.toResult(rs); close(conn,ps,rs); return result; } //数据库关闭语句 public static void close(Connection conn, PreparedStatement ps, ResultSet rs) { try { if (rs != null) { rs.close(); rs = null; } if (ps != null) { ps.close(); ps = null; } if (conn != null) { conn.close(); conn = null; } } catch (SQLException se) { se.printStackTrace(); } } } ``` ## index.jsp ``` <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <%@ taglib prefix = "c" uri="http://java.sun.com/jsp/jstl/core" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <table> <tr> <th>编号</th> <th>姓名</th> <th>电话</th> <th>状态</th> </tr> <c:forEach var="row" items="${rows }"> <tr> <td>${row.id }</td> <td>${row.name }/td> <td>${row.phone }</td> <td>${row.state }</td> </tr> </c:forEach> </table> </body> </html> ``` ![图片说明](https://img-ask.csdn.net/upload/201905/07/1557239537_160797.png) ![图片说明](https://img-ask.csdn.net/upload/201905/07/1557239544_525903.png)

在Tomcat部署的时候出现Could not resolve placeholder

四月 08, 2015 5:24:09 下午 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_40/bin/server;C:/Program Files/Java/jre1.8.0_40/bin;C:/Program Files/Java/jre1.8.0_40/lib/amd64;D:\app\Administrator\product\11.2.0\client_2\bin;D:\app\Administrator\product\11.2.0\client_1\bin;D:\app\Administrator\product\11.2.0\dbhome_1\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Apache\apache-maven-3.2.5\bin;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Java\jre1.8.0_31\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\eclipse;;. 四月 08, 2015 5:24:09 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:pkp-deliver-web' did not find a matching property. 四月 08, 2015 5:24:09 下午 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 四月 08, 2015 5:24:09 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 347 ms 四月 08, 2015 5:24:09 下午 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 四月 08, 2015 5:24:09 下午 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.43 四月 08, 2015 5:24:10 下午 org.apache.catalina.core.ApplicationContext log 信息: Initializing Spring root WebApplicationContext [08/04/15 05:24:10:010 CST] INFO context.ContextLoader: Root WebApplicationContext: initialization started [08/04/15 05:24:10:010 CST] INFO support.XmlWebApplicationContext: Refreshing Root WebApplicationContext: startup date [Wed Apr 08 17:24:10 CST 2015]; root of context hierarchy [08/04/15 05:24:10:010 CST] INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from URL [jar:file:/C:/Users/Administrator/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/pkp-deliver-web/WEB-INF/lib/framework-server-1.1.2.jar!/com/deppon/foss/framework/server/META-INF/spring.xml] [08/04/15 05:24:10:010 CST] INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from URL [jar:file:/C:/Users/Administrator/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/pkp-deliver-web/WEB-INF/lib/pda-bdm-push-0.0.1-express-SNAPSHOT.jar!/com/deppon/pda/bdm/module/push/server/META-INF/spring.xml] [08/04/15 05:24:10:010 CST] INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring.xml] [08/04/15 05:24:11:011 CST] INFO support.DefaultListableBeanFactory: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@fd8294b: defining beans [org.springframework.aop.config.internalAutoProxyCreator,pushDao,pushService,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,{http://www.deppon.com/fin/module/claimpay/service}IFinClaimNumServicePort.http-conduit,dataSourceSpied,dataSource,transactionManager,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,sqlSessionFactory,mongo,mongodbFactory,performanceLog,mongoLogSender,poolConfig,client,storage,client1,storage1,client2,storage2,client3,storage3,esbInitUtil,fileConfig,fileManager,fileUpload,attachementDao,attachementService,appProfile,logSwitch,activeMQUtil,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,extendConfigurationDao,smsSender,messageCache,messageCacheProvider,oracleDialect,exceptionConvert,syncDataFetcherScanner,webApplicationContextHolder,JSONInterceptor,securityInterceptor,messageBundle,JSPErrorResult]; root of factory hierarchy [08/04/15 05:24:11:011 CST] ERROR context.ContextLoader: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'mongo' defined in ServletContext resource [/WEB-INF/spring.xml]: Could not resolve placeholder 'mongodb.host' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:287) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:759) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 四月 08, 2015 5:24:11 下午 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class com.deppon.foss.framework.server.web.ContextLoaderListener org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'mongo' defined in ServletContext resource [/WEB-INF/spring.xml]: Could not resolve placeholder 'mongodb.host' at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:287) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:638) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardHost.start(StandardHost.java:822) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1060) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:759) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 四月 08, 2015 5:24:11 下午 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 四月 08, 2015 5:24:11 下午 org.apache.catalina.core.StandardContext start 严重: Context [/pkp-deliver-web] startup failed due to previous errors 四月 08, 2015 5:24:11 下午 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext 四月 08, 2015 5:24:11 下午 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 四月 08, 2015 5:24:11 下午 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 四月 08, 2015 5:24:11 下午 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/18 config=null 四月 08, 2015 5:24:11 下午 org.apache.catalina.startup.Catalina start 信息: Server startup in 2212 ms 好纠结,怎么解决啊?这是一个二次开发的项目……

做了一个简单的SSH应用,但启动tomcat时总抛NoClassDefFoundError异常

做了一个简单的SSH应用,但启动tomcat时总抛NoClassDefFoundError异常。 <br />会有<pre name="code" class="java">java.lang.ClassNotFoundException: javax.transaction.TransactionManager</pre> <br />各位一定要帮看看啊!(ssh未入门级) <br /> <br />开发工具:Eclipse3.2+Tomcat5.5+Mysql5.0 <br />建表 <br /><pre name="code" class="java">CREATE TABLE `people` ( `id` int(11) NOT NULL auto_increment, `name` varchar(100) default NULL, `location` varchar(100) default NULL, PRIMARY KEY (`id`) ) </pre> <br /> <br />首先,建立工程和package,以下是我的工程目录 <br />  action <br />      DeletePeopleAction.java     //删除人员action <br />      EditPeopleAction.java         //编辑人员action第一步,读取需要修改的人员资料 <br />       EditPeopleActionDo.java   //修改人员action <br />      ListPeopleAction.javaSave   //显示人员列表action <br />      SavePeopleAction.java         //新增人员action <br />      SearchPeopleAction.java     //查找人员action <br />dao <br />      IDAO.java    //数据库操作接口 <br />       StudentDAOImpl.java  //数据库操作实现 <br />domain <br />      AbstractPeople.java   //实体抽象类 <br />       People.hbm.xml         //数据库映射 <br />       People.java                 //实体类 <br />service <br />      IService.java   //服务层接口 <br />       StudentManagerImpl.java   //服务层实现 <br />util <br />     Character.java   //字符编码过滤器 <br />      PageSupport.java   //分页 <br />applicationContext.xml   //Spring配置文件(hibernate部分和Service部分) <br /> <br />JSP:不详细些了。 <br />   addStudent.jsp <br />   editStudent.jsp <br />   searchList.jsp <br />   searchStudent.jsp <br />   studentList.jsp <br /> <br />我觉得问题就出在 Spring 的xml部署上, <br />或者是我引入的包有冲突,要么就是根本不对。 <br />下面是应用的配置信息: <br />1.web.xml <br /><pre name="code" class="java"><!----> &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/classes/applicationContext.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;resource-ref&gt; &lt;description&gt;SqlServer Datasource example&lt;/description&gt; &lt;res-ref-name&gt;jdbc/StudentManager&lt;/res-ref-name&gt; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt; &lt;res-auth&gt;Container&lt;/res-auth&gt; &lt;/resource-ref&gt; &lt;filter&gt; &lt;filter-name&gt;hibernateFilter&lt;/filter-name&gt; &lt;filter-class&gt; org.springframework.orm.hibernate3.support.OpenSessionInViewFilter &lt;/filter-class&gt; &lt;init-param&gt; &lt;param-name&gt;singleSession&lt;/param-name&gt; &lt;param-value&gt;true&lt;/param-value&gt; &lt;/init-param&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;hibernateFilter&lt;/filter-name&gt; &lt;url-pattern&gt;*.do&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;servlet&gt; &lt;servlet-name&gt;SpringContextServlet&lt;/servlet-name&gt; &lt;servlet-class&gt; org.springframework.web.context.ContextLoaderServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;SpringLog4jConfigServlet&lt;/servlet-name&gt; &lt;servlet-class&gt; org.springframework.web.util.Log4jConfigServlet &lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;web&lt;/servlet-name&gt; &lt;servlet-class&gt; org.springframework.web.servlet.DispatcherServlet &lt;/servlet-class&gt; &lt;/servlet&gt; &lt;servlet&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt; &lt;init-param&gt; &lt;param-name&gt;config&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/struts-config.xml&lt;/param-value&gt; &lt;/init-param&gt; &lt;init-param&gt; &lt;param-name&gt;debug&lt;/param-name&gt; &lt;param-value&gt;2&lt;/param-value&gt; &lt;/init-param&gt; &lt;init-param&gt; &lt;param-name&gt;detail&lt;/param-name&gt; &lt;param-value&gt;2&lt;/param-value&gt; &lt;/init-param&gt; &lt;load-on-startup&gt;2&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;action&lt;/servlet-name&gt; &lt;url-pattern&gt;*.do&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;/WEB-INF/jsp/index.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;taglib&gt; &lt;taglib-uri&gt;/WEB-INF/struts-bean.tld&lt;/taglib-uri&gt; &lt;taglib-location&gt;/WEB-INF/struts-bean.tld&lt;/taglib-location&gt; &lt;/taglib&gt; &lt;taglib&gt; &lt;taglib-uri&gt;/WEB-INF/struts-html.tld&lt;/taglib-uri&gt; &lt;taglib-location&gt;/WEB-INF/struts-html.tld&lt;/taglib-location&gt; &lt;/taglib&gt; &lt;taglib&gt; &lt;taglib-uri&gt;/WEB-INF/struts-logic.tld&lt;/taglib-uri&gt; &lt;taglib-location&gt;/WEB-INF/struts-logic.tld&lt;/taglib-location&gt; &lt;/taglib&gt; &lt;taglib&gt; &lt;taglib-uri&gt;/WEB-INF/struts-nested.tld&lt;/taglib-uri&gt; &lt;taglib-location&gt;/WEB-INF/struts-nested.tld&lt;/taglib-location&gt; &lt;/taglib&gt; &lt;/web-app&gt; </pre> <br /> <br />2.struts-config.xml <br /><pre name="code" class="java"><!----> &lt;struts-config&gt; &lt;data-sources&gt; &lt;form-beans&gt; &lt;form-bean name="people" type="domain.People"&gt;&lt;/form-bean&gt; &lt;/form-beans&gt; &lt;global-exceptions&gt; &lt;global-forwards&gt; &lt;action-mappings&gt; &lt;action path="/savePeople" name="people" type="action.SavePeopleAction" scope="session" parameter="method"&gt; &lt;forward name="success" path="/listPeople.do"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/listPeople" name="people" type="action.ListPeopleAction"&gt; &lt;forward name="success" path="/studentList.jsp"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/deletePeople" name="people" type="action.DeletePeopleAction"&gt; &lt;forward name="success" path="/studentList.jsp"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/editPeople" name="people" type="action.EditPeopleAction"&gt; &lt;forward name="success" path="/editStudent.jsp"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/editPeopleDo" name="people" type="action.EditPeopleActionDo"&gt; &lt;forward name="success" path="/studentList.jsp"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/searchPeople" name="people" type="action.SearchPeopleAction"&gt; &lt;forward name="success" path="/searchList.jsp"&gt;&lt;/forward&gt; &lt;/action&gt; &lt;action path="/test" name="people" type="action.Test"&gt;&lt;/action&gt; &lt;/action-mappings&gt; &lt;controller locale="true"&gt; &lt;message-resources parameter=""&gt; <!----> &lt;/struts-config&gt; </pre> <br /> <br /> <br />3.applicationContext.xml <br /><pre name="code" class="java"><!----> &lt;beans&gt; <!----> &lt;bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" depends-on="sessionFactory"&gt; &lt;property name="sessionFactory"&gt; &lt;ref bean="sessionFactory"&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="studentManager" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&gt; &lt;property name="transactionManager"&gt; &lt;ref bean="transactionManager"&gt;&lt;/ref&gt; &lt;/property&gt; &lt;property name="target"&gt; &lt;bean class="service.StudentManagerImpl"&gt; &lt;property name="studentDAO"&gt; &lt;ref bean="StudentDAO"&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/property&gt; &lt;property name="transactionAttributes"&gt; &lt;props&gt; &lt;prop key="save*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &lt;prop key="list*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt; &lt;prop key="delete*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &lt;prop key="get*"&gt;PROPAGATION_REQUIRED,readOnly&lt;/prop&gt; &lt;prop key="edit*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &lt;prop key="search*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; &lt;property name="proxyTargetClass"&gt; &lt;value&gt;true&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; <!----> &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt; &lt;property name="driverClassName"&gt; &lt;value&gt;com.mysql.jdbc.Driver&lt;/value&gt; &lt;/property&gt; &lt;property name="url"&gt; &lt;value&gt;jdbc:mysql://localhost:3306/dbjee&lt;/value&gt; &lt;/property&gt; &lt;property name="username"&gt; &lt;value&gt;root&lt;/value&gt; &lt;/property&gt; &lt;property name="password"&gt; &lt;value&gt;123456&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; <!----> &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; &lt;property name="dataSource"&gt; &lt;ref local="dataSource"&gt; &lt;/property&gt; &lt;property name="hibernateProperties"&gt; &lt;props&gt; &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt; &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.cache.use_query_cache"&gt;true&lt;/prop&gt; &lt;prop key="hibernate.cache.provider_class"&gt; org.hibernate.cache.HashtableCacheProvider&lt;/prop&gt; &lt;/props&gt; &lt;/property&gt; <!----> &lt;property name="mappingResources"&gt; &lt;list&gt; &lt;value&gt;domain/People.hbm.xml&lt;/value&gt; &lt;/list&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="StudentDAO" class="dao.StudentDAOImpl"&gt; &lt;property name="sessionFactory"&gt; &lt;ref local="sessionFactory"&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/beans&gt; </pre> <br /> <br />4.People.hbm.xml <br /><pre name="code" class="java"><!----> <!----> &lt;hibernate-mapping package="domain"&gt; &lt;class name="People" table="people"&gt; &lt;id name="id" type="java.lang.Integer"&gt; &lt;column name="id"&gt; &lt;generator class="increment"&gt;&lt;/generator&gt; &lt;/id&gt; &lt;property name="name" type="java.lang.String"&gt; &lt;column name="name" length="100"&gt; &lt;/property&gt; &lt;property name="location" type="java.lang.String"&gt; &lt;column name="location" length="100"&gt; &lt;/property&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </pre> <br /> <br /> <br /><span style="font-size: large;">附件里是我引入的jar包。 <br />希望各位能帮帮忙,困扰我2天,一直出不来。</span> <br /> <br />最后把启动Tomcat时报的错误也贴出来。 <br /><pre name="code" class="java">严重: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager java.lang.NoClassDefFoundError: javax/transaction/TransactionManager at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at java.beans.Introspector$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source) at java.beans.Introspector.getTargetMethodInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at org.springframework.beans.CachedIntrospectionResults.&lt;init&gt;(CachedIntrospectionResults.java:149) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:85) at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:234) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:192) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:176) at org.springframework.beans.BeanWrapperImpl.&lt;init&gt;(BeanWrapperImpl.java:129) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:491) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:366) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:330) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190) at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionManager at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 55 more 2008-11-14 20:08:31 org.apache.catalina.core.ApplicationContext log 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager java.lang.NoClassDefFoundError: javax/transaction/TransactionManager at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at java.beans.Introspector$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source) at java.beans.Introspector.getTargetMethodInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at org.springframework.beans.CachedIntrospectionResults.&lt;init&gt;(CachedIntrospectionResults.java:149) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:85) at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:234) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:192) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:176) at org.springframework.beans.BeanWrapperImpl.&lt;init&gt;(BeanWrapperImpl.java:129) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:491) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:366) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:330) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190) at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) Caused by: java.lang.ClassNotFoundException: javax.transaction.TransactionManager at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 55 more 2008-11-14 20:08:31 org.apache.catalina.core.StandardContext loadOnStartup 严重: Servlet /SSHDemo threw load() exception java.lang.ClassNotFoundException: javax.transaction.TransactionManager at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at java.beans.Introspector$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source) at java.beans.Introspector.getTargetMethodInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at java.beans.Introspector.getBeanInfo(Unknown Source) at org.springframework.beans.CachedIntrospectionResults.&lt;init&gt;(CachedIntrospectionResults.java:149) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:85) at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:234) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:192) at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:176) at org.springframework.beans.BeanWrapperImpl.&lt;init&gt;(BeanWrapperImpl.java:129) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:491) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:366) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:330) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190) at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83) at javax.servlet.GenericServlet.init(GenericServlet.java:212) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433) 2008-11-14 20:08:32 org.apache.coyote.http11.Http11BaseProtocol start 信息: Starting Coyote HTTP/1.1 on http-8888 2008-11-14 20:08:32 org.apache.jk.common.ChannelSocket init </pre><br /><strong>问题补充</strong><br /><div class="quote_title">zzxplayful 写道</div><div class="quote_div">没有这个包 <br />java.lang.ClassNotFoundException: javax.transaction.TransactionManager  </div> <br />这段异常我看得懂, <br />包括下面的: <br /><pre name="code" class="java">org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager</pre> <br /> <br />都看得懂,我想知道的是解决办法。 <br />比如 <br />javax.transaction.TransactionManager <br />在什么包里? <br />要怎样解决?<br /><strong>问题补充</strong><br /><div class="quote_title">fywcc 写道</div><div class="quote_div">这个是spring里面的  你把SPRING的jar包重新覆盖进去试试</div> <br /> <br />我在Spring包里看了啊, <br />源码都是以 org.springframework.×××× 开始的啊, <br />没有 javax.transcation.** 啊, <br />怎么办?还是需要什么别的包,要么是我的包冲突了。 <br /> <br />我引入了: <br />antlr <br />commons-beanutils.jar <br />commons-digester.jar <br />commons-fileupload.jar <br />commons-logging.jar <br />commons-validator.jar <br />jakarta-oro.jar <br />struts.jar <br /> <br />spring.jar <br /> <br />hibernate3.jar<br /><strong>问题补充</strong><br /><div class="quote_title">jones 写道</div><div class="quote_div">放入jta.jar就行了,找找吧,spring里面应该有,要不就是Hibernate里面有</div> <br />谢谢你。 <br />我把缺少的包都放上了,终于启动Tomcat时候不抛异常,而且也能打开welcome页面了。 <br /> <br />但还有其他问题,明天搞。 <br /> <br />第一次搞SSH,多谢指点啊!

Cannot load JDBC driver class 'oracle.jdbc.OracleDriver'

以前写的代码没有问题,现在在新的机器上部署就报错: 2013-10-8 22:36:17 org.apache.catalina.core.StandardHostDeployer install 信息: Installing web application at context path /NetCTOSS_V3 from URL file:E:\Tomcat 5.0\webapps\NetCTOSS_V3 ERROR - Cannot load JDBC driver class 'oracle.jdbc.OracleDriver' 2013-10-8 22:36:28 org.apache.catalina.core.StandardContext start 严重: Error filterStart 2013-10-8 22:36:28 org.apache.catalina.core.StandardContext start 严重: Context startup failed due to previous errors jar包也不缺啊。。tomcat下的servlet-api.jar也在。实在不知道什么原因了。求大家帮帮忙,不胜感激。我也在试探中。(看过有的资料说是eclipse的bug,搞不懂。自己感觉像spring配置文件的问题,还不敢确定,下面是配置文件内容) <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <!--指定Spring配置文件位置和名称 --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/applicationContext.xml</param-value> </context-param> <!--服务器启动时,实例化Spring容器对象 --> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <!--添加openSessionInViewFilter --> <filter> <filter-name>openSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>openSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <filter-name>Struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>Struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>

关于myEclipse的web项目自动往WEB-INF的lib中导包的问题

本人现在利用Tomcat的热部署,已经部署了一个项目,而在在myEclipse中利用小测试了一下, 运行没有问题。但是发布了之后,发现WEB-INF的lib包中,并没有相应的Hibernate,Spring等jar包, 但是我在myEclipse里,build path都是把这些jar添加进去的,请问要如何让myEclipse自动 的帮我往lib中添加jar包.

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

2020春招面试了10多家大厂,我把问烂了的数据库事务知识点总结了一下

2020年截止目前,我面试了阿里巴巴、腾讯、美团、拼多多、京东、快手等互联网大厂。我发现数据库事务在面试中出现的次数非常多。

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

在拼多多上班,是一种什么样的体验?我心态崩了呀!

之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

太狠了,疫情期间面试,一个问题砍了我5000!

疫情期间找工作确实有点难度,想拿到满意的薪资,确实要点实力啊!面试官:Spring中的@Value用过么,介绍一下我:@Value可以标注在字段上面,可以将外部配置文件中的数据,比如可以...

自学编程的 6 个致命误区

嗨,小伙伴们大家好,我是沉默王二。本篇文章来和大家聊聊自学编程中的一些误区——这是我在 B 站上看了羊哥的一期视频后有感而发的文章。因为确实有很多读者也曾私信问过我这些方面的问题,很有代表性,所以我就结合自己的亲身体会来谈一谈,希望对小伙伴们有所启发。 01、追求时髦 所谓基础不牢,地动山摇啊。可很多小伙伴压根就没注意过这个问题,市面上出什么新鲜的技术就想去尝试,结果把自己学的乱七八糟,心灰意冷...

立即提问
相关内容推荐