首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Eclipse Maven Spring项目-错误

Eclipse Maven Spring项目-错误
EN

Stack Overflow用户
提问于 2013-11-10 22:21:40
回答 1查看 1.7K关注 0票数 2

我需要帮助解决一个让我发疯的错误。

我开始学习Java,我正在浏览youtube上的教程。在我来到Spring、Hibernate、JSF准备项目之前,一切都进行得很顺利。

我向我的pom.xml项目添加了依赖项,如下所示,但是在我的配置文件中,我有一个错误:

org/aspectj/weaver/BCException"的“生成路径不完整找不到类文件

我正在看谷歌,也在这里寻找我的问题的答案。我发现我需要添加aspectj依赖项,但是它仍然不能工作,而且我也有相同的错误。

我在我的项目中包括了下面的libary:(所以我想这不是缺少libary的问题)。

我的pom.xml文件:

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org  /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0  http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example.j2eeapp</groupId>
<artifactId>j2eeapplication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>J2EE Application Example</name>

<!-- 
Prime faces helps in building themes for jsf
 -->
<repositories>
    <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
    </repository>
</repositories>


<!-- 
hibernate helps manage database via java
 -->
 <dependencies>
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.1.8.Final</version>
    </dependency>
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>4.2.0.Final</version>
    </dependency>     
    <dependency>
            <groupId>aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.5.2</version>
    </dependency>      
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
 <!-- 
Spring Web flow is specifically designed to implement complex page flows. 
It is an extension of Spring MVC and a tool 
to specify page navigation rules and manage navigation.
 -->
    <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-webflow</artifactId>
            <version>2.3.1.RELEASE</version>
    </dependency>
 <!-- 
The Spring Faces module comes with a set of components, 
which are provided through a tag library.
 -->
    <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-faces</artifactId>
            <version>2.3.1.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>org.springframework.webflow</groupId>
            <artifactId>spring-js</artifactId>
            <version>2.0.9.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.1.1.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc14</artifactId>
            <version>10.2.0.1.0</version>
    </dependency>
    <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
    </dependency>
    <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <version>2.1.10</version>
    </dependency>
    <dependency>
            <groupId>com.sun.facelets</groupId>
            <artifactId>jsf-facelets</artifactId>
            <version>1.1.14</version>
    </dependency>
    <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <version>2.1.10</version>
    </dependency>
    <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>20030825.184428</version>
    </dependency>
    <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.4</version>
    </dependency>
    <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
    </dependency>
    <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.3.02</version>
    </dependency>
    <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.1.3.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.1.3.RELEASE</version>
    </dependency>
    <dependency>
            <groupId>org.primefaces</groupId>
                    <artifactId>primefaces</artifactId>
            <version>3.4</version>
    </dependency>
    <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
            <scope>runtime</scope>
    </dependency>
    <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.1.8.Final</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>


  </dependencies>
  <--
     This is what I added, after I read some answer to my question on stackoverflow. Doesn't work me.
  -->
  <build>
    <plugins>
                <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.4</version>
        <configuration>
            <showWeaveInfo>true</showWeaveInfo>
            <source>1.7.0</source>
            <target>1.7.0</target>
            <Xlint>ignore</Xlint>
            <complianceLevel>1.7.0</complianceLevel>
            <encoding>UTF-8</encoding>
            <verbose>false</verbose>
            <aspectLibraries>
                <aspectLibrary>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aspects</artifactId>
                </aspectLibrary>
            </aspectLibraries>
        </configuration>
        <dependencies>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
                <version>1.7.0</version>
            </dependency>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjtools</artifactId>
                <version>1.7.0</version>
            </dependency>
        </dependencies>
    </plugin>
    </plugins>
</build>
    </project>

在这里,您可以看到一个包含错误的文件:(我删除了xml声明,并在错误发生的地方添加了注释)

代码语言:javascript
复制
    <!-- HERE -->               
    <bean id="jpaFlowExecutionListener"   class="org.springframework.webflow.persistence.JpaFlowExecutionListener">
            <constructor-arg ref="entityManagerFactory" />
            <constructor-arg ref="transactionManager" />
    </bean>
     <!-- HERE -->
    <bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" />

    <webflow:flow-executor id="flowExecutor">
            <webflow:flow-execution-listeners>
                    <webflow:listener ref="jpaFlowExecutionListener" />
                    <webflow:listener ref="facesContextListener"/>
                    <webflow:listener ref="securityFlowExecutionListener"/>
            </webflow:flow-execution-listeners>
    </webflow:flow-executor>                        
    <!-- HERE -->
    <webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/flows">
            <webflow:flow-location-pattern value="/**/*-flow.xml" />
    </webflow:flow-registry>

    <faces:flow-builder-services id="facesFlowBuilderServices" development="true" />

    <faces:resources />
    <!-- HERE -->
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
            <property name="order" value="1"/>
            <property name="flowRegistry" ref="flowRegistry" />
            <property name="defaultHandler">
    <!-- HERE -->             
    <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
            </property>
    </bean>
    <!-- HERE -->
    <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
            <property name="flowExecutor" ref="flowExecutor" />
    </bean>
    <!-- HERE -->
    <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
            <property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
            <property name="prefix" value="/WEB-INF/" />
            <property name="suffix" value=".xhtml" />
    </bean>
    <!-- HERE -->
    <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />

我非常感谢你的帮助。

我在我的类中签了名,如果BCExcepction是可见的,似乎是可见的。此外,我还添加了外部程序、jars、aspectj和xwork,但它仍然无法工作。

这个问题很奇怪,imo,因为在eclipse左侧的explorer选项卡上,当您检查时,会发现类名中没有出现错误。现在,在eclipse的中心,您可以看到代码所在的位置,就会出现这个问题。

不过,这个问题我还是需要帮助。有没有人?

EN

回答 1

Stack Overflow用户

发布于 2013-11-10 22:42:27

有时,导入库的顺序很重要,尝试让应用程序更早地加载库。如果您使用eclipse,请签入构建路径配置、导入顺序。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19895981

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档