小编Tec*_*ind的帖子

无法构造org.apache.maven.plugin.war.util.WebappStructure,因为它没有no-args构造函数

[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
---- Debugging information ----
message             : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
cause-exception     : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message       : Cannot construct org.apache.maven.plugin.war.util.WebappStructure as it does not have a no-args constructor
class               : org.apache.maven.plugin.war.util.WebappStructure
required-type       : org.apache.maven.plugin.war.util.WebappStructure
path                : /webapp-structure
line number         : 1
-------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Trace
com.thoughtworks.xstream.converters.ConversionException: Cannot construct …
Run Code Online (Sandbox Code Playgroud)

maven-2 maven

92
推荐指数
6
解决办法
5万
查看次数

spring PropertyPlaceholderConfigurer和context:property-placeholder

我有以下bean声明:

  <bean
     class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>WEB-INF/classes/config/properties/database.properties</value>
                <value>classpath:config/properties/database.properties</value>
            </list>
        </property>
        <property name="ignoreResourceNotFound" value="true"/>
    </bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="${jdbc.driverClassName}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
</bean>
Run Code Online (Sandbox Code Playgroud)

现在我想将上面的PropertyPlaceholderConfigurer更改为以下格式:

<context:component-scan base-package="org.example.config"/>
<util:properties id="jdbcProperties" 
           location="classpath:config/properties/database.properties"/>
Run Code Online (Sandbox Code Playgroud)
  1. ignoreResourceNotFound将在运行时忽略该属性.例如:当测试应用程序WEB-INF/..路径将忽略(因为maven项目和属性文件在src/main/resources/..下),在启动Web应用程序时,其他属性将忽略路径,我需要实现相同的以上格式.
  2. 应该能够添加多个属性文件,如database.properties,test.properties等.
  3. 在Spring 3中,我可以使用注释而不是这些xml文件进行数据库加载,我该怎么办?因为我只使用一个xml文件(如上所述)来加载db的东西.

我正在使用Spring 3框架.

spring

27
推荐指数
2
解决办法
14万
查看次数

Hibernate注释或XML配置

我用Hibernate开始了一个新项目.Hibernate注释是更好的选择还是更好的Hibernate XML映射?

我已经使用Hibernate和XML配置,但我不知道注释.

  1. 在进行基于注释的实现时是否有任何问题?
  2. 基于注释的应用程序的维护是更容易还是更复杂?
  3. 哪一个更好(即注释或XML映射)哪一个被广泛使用?为什么?
  4. 如果我在不同的级别使用不同的数据库,即生产或集成或开发级别,我是否需要更改代码?

注意:我不是在比较两种技术,但我想知道在使用最新技术的应用程序中使用哪种技术(即两种方式).

hibernate hibernate-mapping hibernate-annotations

24
推荐指数
2
解决办法
1万
查看次数

如何增加蚂蚁的permgen大小?

如何增加蚂蚁的permgen大小?我在ANT_OPTS中给出了

-Xms768m -Xmx1024m -XX:PermSize = 128m -XX:MaxPermSize = 128m

问题1)在系统环境中指定上述设置后,我仍然因为junit的ant目标而失去了记忆错误.

Caught an exception while logging the end of the build.  Exception was:
java.lang.OutOfMemoryError: PermGen space
Run Code Online (Sandbox Code Playgroud)

2)当我输入命令promt以查看ant_opts的路径时,echo%ant_opts%仅显示

-Xmx512m

和其他部分跳过.在我的道路上有什么不对劲?注意:我正在使用命令提示符来运行ant目标.

ant junit maven

23
推荐指数
1
解决办法
3万
查看次数

hibernate NonUniqueObjectException:具有相同标识符值的其他对象已与会话关联:

我的代码:

我正在尝试更新/插入.它被正确插入,唯一的问题是当我尝试更新它时给出了以下错误消息.

private String sessionType=null;
public String getAccountsDetails(List<Account> accountList) {       
    Session session = sessionFactory.openSession();
    for (Account account : accountList) {
        AccountDetails accountDetails = new AccountDetails();
        accountDetails.setAccountsId(Long.parseLong(account.getId()));
        accountDetails.setAccounttype(account.getAccountType().value());
        Query query = session.createQuery("from QBAccounts qba where qba.accountsId=:accId");
        List<AccountDetails> queryList = query.setParameter("accId", accountDetails.getAccountsId()).list();
        if(queryList.size()>0){         
            session.update(accountDetails);
        }else{
            session.save(accountDetails);
        }
    }
    session.flush();  
    session.beginTransaction().commit();
    session.clear();
    session.close();           
    return "Successfully data updated into table";
}
Run Code Online (Sandbox Code Playgroud)

错误:

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.trinet.mulesoft.quickbooks.dto.AccountDetails#0]
    at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:638)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:305)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:246) …
Run Code Online (Sandbox Code Playgroud)

hibernate hibernate-mapping

11
推荐指数
2
解决办法
5万
查看次数

m2e Eclipse indigo给出了错误

我已经在没有eclipse的情况下在本地设置了Maven项目,它已成功完成.现在我已经下载了Eclipse indgo 3.7.0.由于Eclipse-indigo正在使用m2e(maven 2 eclipse)插件

Eclipse-> help->安装新软件 - >使用(Indigo - http://download.eclipse.org/releases/indigo) - >通用工具 - > m2e(检查)并安装.

在eclipse中将项目添加为maven项目,但是在运行pom.xml文件时出现错误:

Downloading: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.625s
[INFO] Finished at: Thu Sep 15 12:33:01 CEST 2011
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 from/to ibiblio.org (http://mirrors.ibiblio.org/pub/mirrors/maven2): null to http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.pom: UnresolvedAddressException -> [Help 1]
[ERROR] …
Run Code Online (Sandbox Code Playgroud)

eclipse maven

10
推荐指数
2
解决办法
4万
查看次数

Tomcat 7 LinkageError:加载器约束违规

INFO: Deploying web application archive test-1.0-SNAPSHOT.war
20-Sep-2011 12:08:42 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\software\apache-tomcat-7.0.21\webapps\test-1.0-SNAPSHOT\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
20-Sep-2011 12:08:42 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.0 (SNAPSHOT 20100817) for context '/test-1.0-SNAPSHOT'
20-Sep-2011 12:08:42 com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
20-Sep-2011 12:08:43 com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment: 
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance …
Run Code Online (Sandbox Code Playgroud)

jsf tomcat maven jsf-2

8
推荐指数
1
解决办法
2万
查看次数

打印Ant中的JUnit故障数

<target name="test" depends="compile-test">
    <junit failureProperty="test.failure">
      <classpath refid="classpath.test" />

      <formatter type="brief" usefile="false" />
      <batchtest>
        <fileset dir="${tst-dir}" includes="**/Test*.class" />
      </batchtest>
    </junit>

    <fail message="test failed" if="test.failure" />
  </target>
Run Code Online (Sandbox Code Playgroud)

我想打印多少个测试用例:

  1. 失败
  2. 错误
  3. 通过

仅在build.xml文件中进行更改.我怎样才能做到这一点?

ant junit

6
推荐指数
1
解决办法
3957
查看次数

带批注的Spring批处理

我是Spring批处理的新手,正在寻找一些带有Annotation概念的Spring批处理示例.

此链接(单击)讨论Spring批处理,但不是Spring批处理注释概念.正如在给定的链接文档中所讨论的那样,目 我正在使用最新的Spring框架.我想避免xml配置.

Spring批次是批处理的非常好的工具吗?或者有没有更好的工具可用于批处理而不是Spring批处理?

Spring批次有什么限制吗?

spring-batch

6
推荐指数
1
解决办法
2万
查看次数

fileset不支持"erroronmissingdir"属性

我正在使用ant 1.7,收到以下错误:

build.xml:55:fileset不支持"erroronmissingdir"属性

1.7中的erroronmissingdir(它在1.8中)的替代属性是什么

ant

5
推荐指数
1
解决办法
6017
查看次数