gpt4 book ai didi

java - REST、EJB 应用程序中的 AbstractMethodError : javax. ws.rs.core.UriBuilder.uri

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:16:03 25 4
gpt4 key购买 nike

<分区>

我的 pom.xml 文件有问题。我知道,有很多关于这个问题的话题,但其中任何一个都能回答我的问题。

@Path("/actors")
public class MainController {

@EJB
private ActorDaoLocal actorDao;

}

@Local
public interface ActorDaoLocal {
//some stuff here
}

@Stateless
public class ActorDao implements ActorDaoLocal {

@PersistenceContext
private EntityManager em ;
//some stuff here
}

@ManagedBean(name = "ActorBean")
@ApplicationScoped
public class ActorBean {

@EJB
private ActorDaoLocal usersDao;

}

在我的应用程序中,当我在 ActorBean 中没有注释时,如下所示:

@ManagedBean(name = "ActorBean")
@ApplicationScoped

actorDao 在 MainController 中为 null

但是,当我为它添加这个注释和依赖项时,我得到了异常:

java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:119)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:651)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

我的pom.xml:

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<type>jar</type>
</dependency>

请帮我改正这个问题,我在我的 pom 文件中找不到错误。

我在 Tomcat 8 工作

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com