0

我一直在与这个问题作斗争超过 48 小时。所以我有一个我开发的 gwt 应用程序,然后我决定通过使用 GAE 数据存储(实体)为其添加持久性,一切都运行良好,所以我决定使用 JPA 来减少我使用实体编写的代码量。

我遇到了数据核的问题,很多!直到我什至无法启动我的应用程序。我已经尝试了很多新的配置,现在我陷入了困境。

我碰到了这个pom,所以我决定使用,我删除了我不需要的东西,因为它们在编译时被破坏了。

眼下。我可以毫无问题地编译和运行,但是当请求通过 GWT 时,我得到了这个奇怪的异常

2012-04-30 14:02:45.175:WARN::Error for /LottoShop/lottoService
java.lang.Error: Unresolved compilation problem: |?The import org.apache.log4j cannot be resolved|
        at co.za.cre8.web.lottoShop.server.LottoServiceImpl.<init>(LottoServiceImpl.java:11)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at java.lang.Class.newInstance0(Class.java:355)
        at java.lang.Class.newInstance(Class.java:308)
        at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
        at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
        at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
        at co.za.cre8.web.lottoShop.server.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:49)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
        at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
        at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
        at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
2012-04-30 14:02:45.195:WARN::Error for /LottoShop/lottoService

没有一个单一的导入,import org.apache.log4j事实上该类 LottoService 中没有。

这就是我的依赖树的样子:

[INFO] Building GWT Maven Archetype
[INFO]    task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree {execution: default-cli}]
[INFO] co.za.cre8.web:lottoShop:war:0.0.1-SNAPSHOT
[INFO] +- net.sourceforge:rsslib4j:jar:0.2:compile
[INFO] +- org.jsoup:jsoup:jar:1.6.2:compile
[INFO] +- com.google.appengine:appengine-api-1.0-sdk:jar:1.5.3:compile
[INFO] +- com.allen-sauer.gwt.log:gwt-log:jar:3.1.6:compile
[INFO] |  \- com.google.gwt:gwt-user:jar:2.4.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.apache.commons:commons-math:jar:2.2:compile
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- javax.validation:validation-api:jar:1.0.0.GA:compile
[INFO] +- javax.validation:validation-api:jar:sources:1.0.0.GA:compile
[INFO] +- log4j:log4j:jar:1.2.16:compile
[INFO] +- org.scribe:scribe:jar:1.3.0:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.4:compile
[INFO] +- com.google.appengine.orm:datanucleus-appengine:jar:1.0.8:compile
[INFO] +- org.datanucleus:datanucleus-core:jar:1.1.5:compile
[INFO] +- org.datanucleus:datanucleus-jpa:jar:1.1.5:compile
[INFO] |  \- org.apache.geronimo.specs:geronimo-jpa_3.0_spec:jar:1.1.1:compile
[INFO] +- org.datanucleus:datanucleus-rdbms:jar:1.1.5:compile
[INFO] |  \- javax.transaction:transaction-api:jar:1.1:compile
[INFO] +- org.datanucleus:datanucleus-enhancer:jar:1.1.4:compile
[INFO] |  \- asm:asm:jar:3.3.1:compile
[INFO] +- javax.jdo:jdo2-api:jar:2.3-eb:compile
[INFO] +- org.hibernate:hibernate-validator:jar:4.0.2.GA:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.5.6:compile
[INFO] +- cglib:cglib-nodep:jar:2.2:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:3.0.3.RELEASE:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  \- org.springframework:spring-tx:jar:3.0.3.RELEASE:compile
[INFO] |     \- org.springframework:spring-aop:jar:3.0.3.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.0.3.RELEASE:compile
[INFO] +- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] +- commons-dbcp:commons-dbcp:jar:1.3:compile
[INFO] +- org.springframework:spring-web:jar:3.0.3.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework:spring-context:jar:3.0.3.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-asm:jar:3.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:3.0.3.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:3.0.3.RELEASE:compile
[INFO] +- org.springframework.webflow:spring-js:jar:2.0.8.RELEASE:compile
[INFO] +- commons-digester:commons-digester:jar:2.0:compile
[INFO] |  \- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.1:compile
[INFO] +- org.tuckey:urlrewritefilter:jar:3.1.0:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- javax.el:el-api:jar:1.0:provided
[INFO] \- joda-time:joda-time:jar:1.6:compile

即使我通过删除依赖项中的 log4j 来使用 slf4j,我也添加了以下内容:Nothing works,同样的问题,当我查看 Eclipse mvn 依赖项时,日志库就在那里,甚至在

 <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.5.10</version>
</dependency>                
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>jcl-over-slf4j</artifactId>
    <version>1.5.10</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.10</version>
</dependency>

添加了 slf4j 在 WEB-INF/lib 中的证明

WEB-INF 库文件夹

您的帮助将不胜感激,谢谢

4

1 回答 1

0

你在你的类路径中添加了 log4j 吗?Slf4j 只是一个 Facde 接口,从你使用的 jar 文件中,Slf4j 需要找到 log4j 来生成日志信息。

于 2012-04-30T14:38:43.813 回答