【问题标题】:WebLogic 12.2 to 12.1 lost endpointsWebLogic 12.2 到 12.1 丢失端点
【发布时间】:2015-12-11 05:31:56
【问题描述】:

您好,这相对简单。我在 weblogic 12.2 上开始了我的项目,但现在我收到了老板的消息,说这将安装在 12.1.3 上。但是做一些测试我发现我在 12.2 上生成的端点休息在 12.1.3 上不起作用有人能告诉我为什么...

这是我的一项服务:

 package xxxxxx
 import package.DdcEstado;
 import java.math.BigDecimal;
 import java.util.List;
 import javax.ejb.Stateless;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.DELETE;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;


@Stateless
@Path("estados")
public class DdcEstadoFacadeREST extends AbstractFacade<DdcEstado> {
@PersistenceContext(unitName = "Data_Delaer_CentralizerPU")
private EntityManager em;

public DdcEstadoFacadeREST() {
    super(DdcEstado.class);
}

@POST
@Override
@Consumes({"application/xml", "application/json"})
public void create(DdcEstado entity) {
    super.create(entity);
}

@PUT
@Path("{id}")
@Consumes({"application/xml", "application/json"})
public void edit(@PathParam("id") BigDecimal id, DdcEstado entity) {
    super.edit(entity);
}

@DELETE
@Path("{id}")
public void remove(@PathParam("id") BigDecimal id) {
    super.remove(super.find(id));
}

@GET
@Path("{id}")
@Produces({"application/xml", "application/json"})
public DdcEstado find(@PathParam("id") BigDecimal id) {
    return super.find(id);
}

@GET
@Override
@Produces({"application/xml", "application/json"})
public List<DdcEstado> findAll() {
    return super.findAll();
}

@GET
@Path("{from}/{to}")
@Produces({"application/xml", "application/json"})
public List<DdcEstado> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
    return super.findRange(new int[]{from, to});
}

@GET
@Path("count")
@Produces("text/plain")
public String countREST() {
    return String.valueOf(super.count());
}

@Override
protected EntityManager getEntityManager() {
    return em;
}

}

这是应用配置:

package gt.com.pckg.service;
import java.util.Set;
import javax.ws.rs.core.Application;
@javax.ws.rs.ApplicationPath("rest")
public class ApplicationConfig extends Application {

@Override
public Set<Class<?>> getClasses() {
    Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
    addRestResourceClasses(resources);
    return resources;
}

/**
 * Do not modify addRestResourceClasses() method.
 * It is automatically populated with
 * all resources defined in the project.
 * If required, comment out calling this method in getClasses().
 */
private void addRestResourceClasses(Set<Class<?>> resources) {
    resources.add(gt.com.pckg.service.DdcAlarmaFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcColaDetalleFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcColaFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcDealerFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcEstadoFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcProcesoFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcProgramacionFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcPuntoVentaFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcRolFacadeREST.class);
    resources.add(gt.com.pckg.service.DdcUsuarioFacadeREST.class);
    resources.add(gt.com.pckg.service.ProcessExecutor.class);
}

}

在这种情况下,当您输入 localhost:7001/proyect/rest/estados 时,我会收到 404 响应。

我将非常感谢所有的帮助。

【问题讨论】:

    标签: java rest weblogic12c


    【解决方案1】:

    您好,我找到了解决方案,这很简单。

    12.1.3和12.2.1的sintaxis和端点指令有这么多不同,为什么?

    好吧,因为 Oracle 说我们将在此表单上执行此操作...

    例如,12.2.1 上的 MediaTypes 您将它们设置为 http 标头“application/json”,但在 12.1.3 上您还使用 MediaType.APPLICATION_JSON

    还有其他类似 ApplicationConfig 的 thnigs 有一些变化......

    我的解决方案是将项目设置为新的服务器版本,并在 netbeans 上再次从数据库生成端点。

    【讨论】:

      猜你喜欢
      • 2019-09-29
      • 1970-01-01
      • 2018-05-01
      • 1970-01-01
      • 2016-11-05
      • 1970-01-01
      • 1970-01-01
      • 2018-11-22
      • 1970-01-01
      相关资源
      最近更新 更多