mac上安装myeclipse提示virtual memory不足 原因:mac的虚拟内存一般是内存空间不够用才会开启,用来做内存交换。 解决方案:让内存飙升,开启一些应用什么的,像我以前开发安卓,直接开启内存消耗比较大的android studio,再安装的时候就没问题了。
maven安装攻略 http://www.cnblogs.com/fancyzero/archive/2012/06/09/maven3.html
3.设置Myeclipse中的代码格式化、注释模板及保存时自动格式化 http://www.cnblogs.com/sixiweb/p/3250298.html
4.svn插件的安装 参考:http://bbs.feng.com/read-htm-tid-3657589.html 其中svn解压后的文件应该存放到这里 最后重启myeclipse后能看到提示则表示安装成功
5.安装了svn结果spket不见了 这个问题我折腾了一上午,最后发现拷贝到dropins中的文件只能有features和plugins两个文件夹。其他文件通通不要。当安装多个插件时,仅将这两个文件夹的内容合并即可。
6.搭建一个Spring MVC过程中遇到的若干问题 1)如果你遇到Injection of autowired dependencies failed,这是Spring在创建Bean过程中自动注入属性时失败了。 解决方案:耐心看完所有exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.cd.service.impl.UserServiceImplTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.cd.service.impl.UserServiceImplTest.setUserServiceImpl(com.cd.service.impl.UserServiceImpl); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.cd.service.impl.UserServiceImpl.setUserDaoImpl(com.cd.dao.impl.UserDaoImpl); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.cd.dao.impl.UserDaoImpl.setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [jdbc-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'datasource' of bean class [org.springframework.jdbc.core.JdbcTemplate]: Bean property 'datasource' is not writable or has an invalid setter method. Did you mean 'dataSource'?以上是我的所有exception,最后发现在定义JdbcTemplate的时候写错了属性,并没有datasource属性,只有dataSource.。 综上所述,不到最后你永远不清楚该bug是如何产生的,坚持看完就是胜利。
2)在执行数据库命令时,出现一个问题 java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed 很明显是因为我在查询之后执行了修改操作而不被允许。
解决方案:看看这个read-only是在哪里定义的。我的是在Spring的配置文件中定义的。 这里声明了所有方法都为只读,删掉即可。
在做demo的时候出现了7、8个错误,其他错误太low了,这里不一一列举了。
7.如果发现静态资源js,css等加载不到。可能是以下原因: 1)web.xml下对spring的DispatcherServlet请求url映射的配置,如果你的DispatcherServlet拦截“/”,拦截了所有的请求,同时对.js,.jpg的访问也就被拦截了。 解决方案: 可以在springmvc的配置文件中添加
<!-- 当在web.xml 中 DispatcherServlet使用 <url-pattern>/</url-pattern> 映射时,能映射静态资源 --> <mvc:default-servlet-handler />2)如果你将资源目录,放置到webapp/WEB-INF下面的话,则就会访问失败。WEB-INF是Java的WEB应用的安全目录。所谓安全就是客户端无法访问,只有服务端可以访问的目录。如果想在页面中直接访问其中的文件,必须通过web.xml文件对要访问的文件进行相应映射才能访问。当然,你非要放在WEB-INF中,则必须修改resources映射,如:
<mvc:resources mapping="/js/**" location="/WEB-INF/js/" />8.在maven项目中的pom.xml添加了许多dependency然而却报错 classnotfound,有可能是assembly中没有添加maven的依赖
9.eclipse创建或者导入maven项目jre都是1.5,会报problem:Dynamic Web Module 需要 java 1.6。如果把eclipse或者项目的编译环境都配到1.6以上还没用,可以尝试一下方法。
解决办法: 修改Maven中conf目录里的setting.xml文件内容,加上如下内容:
<profiles> <!-- profile | Specifies a set of introductions to the build process, to be activated using one or more of the | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/> | or the command line, profiles have to have an ID that is unique. | | An encouraged best practice for profile identification is to use a consistent naming convention | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc. | This will make it more intuitive to understand what the set of introduced profiles is attempting | to accomplish, particularly when you only have a list of profile id's for debug. | | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo. --> <profile> <id>jdk-1.8</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.8</jdk> </activation> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://maven.oschina.net/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>local private nexus</name> <url>http://maven.oschina.net/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <!-- | Here is another profile, activated by the system property 'target-env' with a value of 'dev', | which provides a specific path to the Tomcat instance. To use this, your plugin configuration | might hypothetically look like: | | ... | <plugin> | <groupId>org.myco.myplugins</groupId> | <artifactId>myplugin</artifactId> | | <configuration> | <tomcatLocation>${tomcatPath}</tomcatLocation> | </configuration> | </plugin> | ... | | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to | anything, you could just leave off the <value/> inside the activation-property. | <profile> <id>env-dev</id> <activation> <property> <name>target-env</name> <value>dev</value> </property> </activation> <properties> <tomcatPath>/path/to/tomcat/instance</tomcatPath> </properties> </profile> --> </profiles>其中的1.8修改为你需要的jdk版本号,然后在eclipse里的项目右击鼠标-Maven-select Maven profiles,选择对应的jdk参数,然后更新项目就可以了
10.关于spring profile的介绍以及使用了它之后junit单元测试的配置 http://www.jianshu.com/p/948c303b2253
11.如果有一天你突然发现后台接受不到前端post请求的参数,可能是tomcat引起的,而不是jdk版本问题。这个问题困扰了几次,最后在这里发现了解决方案:http://blog.csdn.net/javabean96/article/details/54601136。根本原因是tomcat7的配置限制了post请求。
12.今天碰到一个问题,word转pdf在mac上正常,到了linux系统上出了乱码。在这里找到了答案 http://blog.csdn.net/h254541060/article/details/48448521。 另外,如果不重启的情况下,需要让系统强制刷新读取所有字体 使用命令:sudo fc-cache –fv 如果已经启动了应用,比如tomcat服务器,浏览页面。这时候需要重启tomcat,才能让新字体生效。
13.最用了hibernate,结果今天出了一个问题,后台数据库查询的数据没问题,用fastjson将数据封装成json,前端接收列表的时候,第一条数据正常,后面几条实体跟第一条一样,结果都变成了$ref:。 产生原因:查了一些资料,原来fastjson在封装json的时候,如果你的数据中出现了循环引用,比如A实体引用B实体,B实体又引用A实体,这时候问题就来了,无限循环的结果是内存溢出,fastjson的处理是将其屏蔽掉,转换成$ref中止引用。类似这个http://bbs.csdn.net/topics/390964291?page=1。
解决方案:为了前端能正常解析,解决方案是解除这种循环的引用。 另外:我发现其他人也是这样的却能读到数据,试了一下果然重复的数据才会变成ref,不重复的就会正常,这也是为什么第一条数据正常
14.hibernate在用JoinColumn的时候出现了一条should be mapped with insert=”false” updatable=false,是因为你用的这个column的名字在类中已经存在了, 这时候hibernate不知道该不该映射。
在ManyToOne中的 @JoinColumn(name = “order_id”,referencedColumnName=”orderid”),这里的name = “order_id”是orderitem的外键,与order表的主键”orderid”关联
解决方案:JoinColumn中添加insertable=false,updatable=false.
15.数据库异常:org.hibernate.QueryException: could not resolve property: “xxx” 解决方案:这篇就够了http://blog.csdn.net/chark_leo/article/details/40541137
16.关于multipart/form-data post 方法提交表单,后台获取不到数据 参考:https://www.cnblogs.com/bdqczhl/p/5971404.html