Tag - java

java exception    2017-07-19 22:14:16    1354
分析bug原因:
是因为某次下载jar包的时候出错,导致下文红色部分标注的jar包没有下载下来,在repository目录下,删除此jar包的文件夹,重新下载即可

我这里是junit3的jar包,但是也可能是其他jar包,这个是不确定的




[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project hello: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing: 
[ERROR] ---------- 
[ERROR] 1) org.apache.maven.surefire:surefire-junit3:jar:2.12.4 
[ERROR] 
[ERROR] Try downloading the file manually from the project website. 
[ERROR] 
[ERROR] Then, install it using the command: 
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file 
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the file there: 
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-junit3 -Dversion=2.12.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] 
[ERROR] 
[ERR
hibernate java exception    2017-07-19 22:13:27    1114

Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist  

今天 用JPA保存数据的时候出现此错误。

 

原因:   ID生成策略  我设置的自动。但是代码里面还是手动给对象ID设置了值

 

解决方案: 去掉手动给ID设置值的代码即可。


如:

 @Id

 @GeneratedValue(strategy = GenerationType.IDENTITY)

 @Column(name = "id", unique = true, nullable = false)


这种情况下,会报错,因为对id仅仅是设置了主键,并没有设置自增长,将

    @GeneratedValue(strategy = GenerationType.IDENTITY)

去掉即可

 

 


 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

maven java    2017-07-19 22:09:09    885
pom文件中,在plugins节点下添加:
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>



 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

java 虚拟主机 tomcat    2017-07-19 21:58:58    851
其实表象类似CNAME

1、修改文件conf/server.xml:
在engine中添加如下:
<Host appBase="F:\apache-tomcat-7.0.54\webapps2" autoDeploy="true" name="test1" unpackWARs="true"></Host>
其中,name为域名
appBase是访问此域名的时候,指向的web存放的根目录

2、通过页面管理添加,tomcat首页找到Host Manager,进行添加


如此即可


 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

xwiki java mariadb    2017-07-19 21:52:46    925
下载地址:http://enterprise.xwiki.org/xwiki/bin/view/Main/Download
系统要求:
    1、XWiki 的编译从6.0版本以后使用Java 7 来进行编译,所以要安装6.0以后的版本,需要jdk7以上版本
    2、我选择使用tomcat 7 版本
    3、然后我使用MariaDB 10

1、安装容器(这里以Tomcat为例),安装jdk和tomcat不用解释了吧
2、安装数据库(MariaDB),当然这里也不做解释了,但是有一点,如果是远程数据库,还请启动远程访问功能
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
3、配置XWiki数据库
    找到文件:xwiki-enterprise-web-6.1\WEB-INF\hibernate.cfg.xml
    找到“MySQL configuration”
    后面就自己配置了,都是hibernate的配置
4、然后启动吧
5、为了可以部署基础配置的xar包,必须修改MariaDB的max_allowed_packet属性,但是MariaDB 10 的配置位置和MySQL的不一样了,
    找到安装目录的my-huge.ini文件,打开设置max_allowed_packet属性


默认管理员账户是superadmin,密码是:system(默认没启用)



 

by 刘迎光@萤火虫工作室 
OpenBI交流群:495266201 
MicroService 微服务交流群:217722918 
mail: liuyg#liuyingguang.cn 
博主首页(==防止爬虫==):http://blog.liuyingguang.cn

3/7