看到了http://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-class-files , 也没搞明白。 后面被证明, 实际上还是Unresolved compilation problems

[ERROR] [09-30 11:04:19] org.springframework.web.context.ContextLoader - Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'attachmentRestService' defined in file [/usr

/lk/bin/tomcat-master/webapps/ROOT/WEB-INF/classes/net/oracle/ldap/cxf/rest/AttachmentRestService.class]: Instantiation of bean

failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.oracle.ldap

.cxf.rest.AttachmentRestService]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:

    The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files
The import javax.ws.rs.GET cannot be resolved
The import javax.ws.rs.POST cannot be resolved
The import javax.ws.rs.Path cannot be resolved
The import javax.ws.rs.Produces cannot be resolved
The import javax.ws.rs.core.Context cannot be resolved
The import javax.ws.rs.core.MediaType cannot be resolved
Path cannot be resolved to a type
The attribute value is undefined for the annotation type Path
Produces cannot be resolved to a type
The attribute value is undefined for the annotation type Produces
MediaType cannot be resolved to a variable
Context cannot be resolved to a type
Context cannot be resolved to a type
GET cannot be resolved to a type
POST cannot be resolved to a type
Produces cannot be resolved to a type
The attribute value is undefined for the annotation type Produces
MediaType cannot be resolved to a variable
Path cannot be resolved to a type
The attribute value is undefined for the annotation type Path
GET cannot be resolved to a type
POST cannot be resolved to a type
Produces cannot be resolved to a type
The attribute value is undefined for the annotation type Produces
MediaType cannot be resolved to a variable
Path cannot be resolved to a type
The attribute value is undefined for the annotation type Path
GET cannot be resolved to a type
POST cannot be resolved to a type
Path cannot be resolved to a type
The attribute value is undefined for the annotation type Path at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.oracle.ldap.cxf.rest.AttachmentRestService]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:

The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files

The import javax.ws.rs.GET cannot be resolved

The import javax.ws.rs.POST cannot be resolved

The import javax.ws.rs.Path cannot be resolved

The import javax.ws.rs.Produces cannot be resolved

The import javax.ws.rs.core.Context cannot be resolved

The import javax.ws.rs.core.MediaType cannot be resolved

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Context cannot be resolved to a type

Context cannot be resolved to a type

GET cannot be resolved to a type

POST cannot be resolved to a type

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

GET cannot be resolved to a type

POST cannot be resolved to a type

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

GET cannot be resolved to a type

POST cannot be resolved to a type

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877)
... 31 more

Caused by: java.lang.Error: Unresolved compilation problems:

The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files

The import javax.ws.rs.GET cannot be resolved

The import javax.ws.rs.POST cannot be resolved

The import javax.ws.rs.Path cannot be resolved

The import javax.ws.rs.Produces cannot be resolved

The import javax.ws.rs.core.Context cannot be resolved

The import javax.ws.rs.core.MediaType cannot be resolved

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Context cannot be resolved to a type

Context cannot be resolved to a type

GET cannot be resolved to a type

POST cannot be resolved to a type

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

GET cannot be resolved to a type

POST cannot be resolved to a type

Produces cannot be resolved to a type

The attribute value is undefined for the annotation type Produces

MediaType cannot be resolved to a variable

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

GET cannot be resolved to a type

POST cannot be resolved to a type

Path cannot be resolved to a type

The attribute value is undefined for the annotation type Path

    at net.oracle.ldap.cxf.rest.AttachmentRestService.<init>(AttachmentRestService.java:1)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)
... 33 more

[ERROR] [09-30 11:04:19] net.jweb.listener.AppInitializerListener - 启动初始化异常:

java.lang.ClassCastException: org.springframework.beans.factory.BeanCreationException cannot be cast to org.springframework.web.context.WebApplicationContext

at net.jweb.listener.AppInitializerListener.contextInitialized(AppInitializerListener.java:92)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)

at org.apache.catalina.core.StandardService.start(StandardService.java:525)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)

at org.apache.catalina.startup.Catalina.start(Catalina.java:595)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

开始总还以为是缺少jar 呢, 但是jar 明明就是 lib 目录中的啊。。。 重启数次都不行,

后面 看到 Unresolved compilation problems, 突然,想到, 可能是编译的问题吧。。

找到AttachmentRestService, 反编译看看, 果然, 各个方法都是错误:

throw new Error("Unresolved compilation problems: \n\tGET cannot be resolved to a type\n\tPOST cannot be resolved to a type\n\tProduces cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Produces\n\tMediaType cannot be resolved to a variable\n\tPath cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Path\n");

package net.oracle.ldap.cxf.rest;

import Context;

import GET;

import POST;

import java.text.NumberFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

import javax.annotation.Resource;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import net.jweb.services.CommonFileService;

import net.jweb.services.UserFileService;

import net.jweb.services.UserService;

import net.oracle.ldap.cxf.bean.AttachmentResponseEntity;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Component;

@Component("attachmentRestService")

public class AttachmentRestService

{

private Logger logger;

@Resource(name="commonFileServiceImpl")

private CommonFileService commonFileService;

@Resource(name="userServiceImpl")

private UserService userService;

@Resource(name="userFileServiceImpl")

private UserFileService userFileService;

@Context

HttpServletRequest request;

@Context

HttpServletResponse response;

private static SimpleDateFormat sdf;

private static NumberFormat numberFormat;

@GET

@POST

public AttachmentResponseEntity delete()

{

throw new Error("Unresolved compilation problems: \n\tGET cannot be resolved to a type\n\tPOST cannot be resolved to a type\n\tProduces cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Produces\n\tMediaType cannot be resolved to a variable\n\tPath cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Path\n");

}

@GET

@POST

public AttachmentResponseEntity searchTagUpdate()

{

throw new Error("Unresolved compilation problems: \n\tGET cannot be resolved to a type\n\tPOST cannot be resolved to a type\n\tProduces cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Produces\n\tMediaType cannot be resolved to a variable\n\tPath cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Path\n");

}

@GET

@POST

public synchronized void pushFileInfo()

{

throw new Error("Unresolved compilation problems: \n\tGET cannot be resolved to a type\n\tPOST cannot be resolved to a type\n\tPath cannot be resolved to a type\n\tThe attribute value is undefined for the annotation type Path\n");

}

private Date dateFormate(String paramString)

{

throw new Error("Unresolved compilation problem: \n");

}

private void doResponseJson(String paramString)

{

throw new Error("Unresolved compilation problem: \n");

}

}

而源码是:

package net.oracle.ldap.cxf.rest;

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.PrintWriter;

import java.text.NumberFormat;

import java.text.ParseException;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.List;

import javax.annotation.Resource;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.ws.rs.GET;

import javax.ws.rs.POST;

import javax.ws.rs.Path;

import javax.ws.rs.Produces;

import javax.ws.rs.core.Context;

import javax.ws.rs.core.MediaType;

import net.jweb.common.model.CommonFileCache;

import net.jweb.common.model.CommonFileCache.Type;

import net.jweb.common.model.FileCache;

import net.jweb.common.model.User;

import net.jweb.common.util.Request;

import net.jweb.services.CommonFileService;

import net.jweb.services.UserFileService;

import net.jweb.services.UserService;

import net.oracle.ldap.cxf.bean.AttachmentResponseEntity;

import org.apache.commons.httpclient.HttpClient;

import org.apache.commons.httpclient.HttpStatus;

import org.apache.commons.httpclient.NameValuePair;

import org.apache.commons.httpclient.methods.PostMethod;

import org.apache.commons.lang3.StringUtils;

import org.apache.log4j.Logger;

import org.springframework.stereotype.Component;

import com.google.gson.JsonArray;

import com.google.gson.JsonObject;

/**

*

*/

@Component("attachmentRestService")

@Path("attachmentRestService")

@Produces({MediaType.APPLICATION_JSON})

public class AttachmentRestService {

private Logger logger = Logger.getLogger(this.getClass().getName());
@Resource(name="commonFileServiceImpl")
private CommonFileService commonFileService;
@Resource(name="userServiceImpl")
private UserService userService;
@Resource(name="userFileServiceImpl")
private UserFileService userFileService; @Context
HttpServletRequest request;
@Context
HttpServletResponse response; private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static NumberFormat numberFormat = NumberFormat.getInstance(); static
{
numberFormat.setMinimumIntegerDigits(6);
numberFormat.setGroupingUsed(false);
} @GET
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/Delete")
//附件删除接口
public AttachmentResponseEntity delete() {
AttachmentResponseEntity responseEntity = new AttachmentResponseEntity();
String app = "";
try
{
String username = Request.getString(request, "user");
String password = Request.getString(request, "password");
app = Request.getString(request, "app");
long fileId = Request.getLong(request, "fileId", 0);
int fileType = Request.getInt(request, "fileType", 1);
//参数完整性校验
/*if(requestEntity == null || requestEntity.getCertificate() == null)
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("请求参数不能为空!");
return responseEntity;
}*/ //user:erp1,password:E1D5F4969E5BE6FB46F14A008C51C7FA
String wsUser = "erp1";
String wsPassword = "E1D5F4969E5BE6FB46F14A008C51C7FA";
//用户校验
if(!StringUtils.equals(wsUser, username) || !StringUtils.equals(wsPassword, password))
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("没有足够的操作权限!");
return responseEntity;
} if(fileType == 1)
{
CommonFileCache fc = null;
if(fileId > 0)
{
fc = commonFileService.queryByPK(CommonFileCache.class, fileId);
if(fc != null && Type.attachment.match(fc.getType()) && fc.isFile())
{
Date nowDate = new Date();
long newRevision = commonFileService.commonFileRevision();
User user = userService.queryByPK(User.class, fc.getUserId());
commonFileService.deleteFile(user, fc, newRevision, nowDate);
logger.info(String.format("附件删除[u=%s,p=%s]:app=%s,fileId=%s,fileType=%s", username, password, app, fileId, fileType));
responseEntity.setStatus("SUCCESS");
responseEntity.setMsg("操作成功");
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("操作的附件不存在!");
return responseEntity;
}
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("参数[fileId]无效!");
return responseEntity;
}
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("调用了未实现的服务!");
return responseEntity;
}
} catch (Exception e) {
e.printStackTrace();
logger.error("webservice调用异常[app="+app+"]:",e);
responseEntity.setStatus("ERROR");
responseEntity.setMsg("服务调用错误,请联系管理员!");
}
return responseEntity;
} @GET
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/SearchTagUpdate")
//附近逻辑路径更新接口
public AttachmentResponseEntity searchTagUpdate() {
AttachmentResponseEntity responseEntity = new AttachmentResponseEntity();
String app = "";
try
{
String username = Request.getString(request, "user");
String password = Request.getString(request, "password");
app = Request.getString(request, "app");
long fileId = Request.getLong(request, "fileId", 0);
int fileType = Request.getInt(request, "fileType", 1);
String sTag = Request.getString(request, "sTag");
//参数完整性校验
/*if(requestEntity == null || requestEntity.getCertificate() == null)
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("请求参数不能为空!");
return responseEntity;
}*/ //user:erp1,password:E1D5F4969E5BE6FB46F14A008C51C7FA
String wsUser = "erp1";
String wsPassword = "E1D5F4969E5BE6FB46F14A008C51C7FA";
//用户校验
if(!StringUtils.equals(wsUser, username) || !StringUtils.equals(wsPassword, password))
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("没有足够的操作权限!");
return responseEntity;
} if(fileType == 1)
{
CommonFileCache fc = null;
if(fileId > 0)
{
fc = commonFileService.queryByPK(CommonFileCache.class, fileId);
if(fc != null && Type.attachment.match(fc.getType()) && fc.isFile())
{
//Date nowDate = new Date();
//long newRevision = commonFileService.commonFileRevision();
//User user = userService.queryByPK(User.class, fc.getUserId());
fc.setFileAttributeValue(29, sTag);//搜索标识:从最后一个自定义属性设置开始
commonFileService.update(fc);
//logger.info(String.format("搜索标识更新[u=%s,p=%s]:app=%s,fileId=%s,fileType=%s,sTag=%s", username, password, app, fileId, fileType, sTag));
responseEntity.setStatus("SUCCESS");
responseEntity.setMsg("操作成功");
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("操作的附件不存在!");
return responseEntity;
}
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("参数[fileId]无效!");
return responseEntity;
}
}
else
{
responseEntity.setStatus("ERROR");
responseEntity.setMsg("调用了未实现的服务!");
return responseEntity;
}
} catch (Exception e) {
e.printStackTrace();
logger.error("webservice调用异常[app="+app+"]:",e);
responseEntity.setStatus("ERROR");
responseEntity.setMsg("服务调用错误,请联系管理员!");
}
return responseEntity;
} @SuppressWarnings("unchecked")
@GET
@POST
//@Produces(MediaType.APPLICATION_JSON)
@Path("/push2CrlandHome")
//将文件信息推送到crland门户系统
public synchronized void pushFileInfo() {
String date1 = Request.getString(request, "begin");
String date2 = Request.getString(request, "end"); Date begin = dateFormate(date1);
Date end = dateFormate(date2);
if(begin == null)
{
begin = new Date();
}
if(end == null)
{
end = new Date();
}
StringBuffer hql = new StringBuffer();
hql.append("from FileCache t where t.lastModified>=").append(begin.getTime());
hql.append(" and t.lastModified<").append(end.getTime());
//hql.append(" and id=10046");
List<FileCache> fcList = userFileService.query(hql.toString()); String requestEntity = "";
if(fcList != null && fcList.size() > 0)
{
String fileSource = "东软云盘";//东软文档平台、东软云盘
JsonArray array = new JsonArray();
JsonObject jo = null;
int status = 1;//默认状态为创建状态
User user = null;
for(FileCache fc : fcList)
{
jo = new JsonObject();
if(fc.isDelete())
{
status = 3;//删除状态
}
else if(fc.getLastModified()> fc.getAddTime().getTime())
{
status = 2;//修改状态
}
user = userService.getUserBaseByUserId(fc.getUserId());
jo.addProperty("id", fc.getId()+"");
jo.addProperty("source", fileSource);//来源标识
jo.addProperty("loginname", user!=null?user.getUsername():"");//用户登录名
jo.addProperty("publisher", user!=null?user.getName():"");//文件上传人/文件所有人/文件更新人
jo.addProperty("downloadpath", "http://localhost:8090/disk/download.action");//文件下载路径
jo.addProperty("browsingpath", "http://localhost:8090/disk/myFileView.action");//文件预览路径
jo.addProperty("filepath", fc.getPath());//文件上传路径/文件存放路径
jo.addProperty("filename", fc.getName());//文件名
jo.addProperty("filesize", fc.getSize()+"");//文件大小
jo.addProperty("uploadtime", sdf.format(fc.getAddTime()));//上传时间
jo.addProperty("status", status+"");
//jo.addProperty("status", "1"); array.add(jo);
}
requestEntity = array.toString();
} /*if(StringUtils.isNotEmpty(requestEntity))
{
System.out.println("stop.");
return;
}*/
//String api = "http://homeuat.crland.cn/CrcDocWS/RestApplication/RestData/DocInterface";
String api = "http://10.72.1.101:10039/CrcDocWS/RestApplication/RestData/DocInterface"; String response = null;
PostMethod pm = null;
BufferedReader rd = null;
try
{
pm = new PostMethod(api){@Override
public String getRequestCharSet() {
return "UTF-8";
}};
pm.addParameter(new NameValuePair("strfile", requestEntity));
HttpClient client = new HttpClient();
int statusCode = client.executeMethod(pm); switch (statusCode) {
case HttpStatus.SC_OK://200
rd = new BufferedReader(new InputStreamReader(pm.getResponseBodyAsStream(), "UTF-8"));
StringBuffer stringBuffer = new StringBuffer();
String line;
while ((line = rd.readLine()) != null)
{
stringBuffer.append(line);
}
response = stringBuffer.toString();
break;
case HttpStatus.SC_MOVED_PERMANENTLY://301
case HttpStatus.SC_MOVED_TEMPORARILY://302
break;
default:
response = statusCode+"";
break;
}
} catch (IOException ex) {
ex.printStackTrace();
logger.error("文件信息推送失败:",ex);
} finally {
if(pm != null) pm.releaseConnection();//释放连接
try {
if(rd != null) rd.close();
} catch (IOException e) {
e.printStackTrace();
logger.error(e);
}
}
System.out.println("response="+response);
} private Date dateFormate(String dateStr) {
try {
return sdf.parse(dateStr);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
} private void doResponseJson(String responseText) {
try
{
response.setContentType("application/json;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
response.setHeader("Pragma", "No-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Access-Control-Allow-Origin", "*");
response.addHeader( "Cache-Control", "must-revalidate" );
response.addHeader( "Cache-Control", "no-cache" );
response.addHeader( "Cache-Control", "no-store" );
response.addHeader( "Cache-Control", "must-revalidate" );
response.addHeader( "Cache-Control", "post-check=0" );
response.addHeader( "Cache-Control", "pre-check=0" );
PrintWriter out = response.getWriter();
out.write(responseText);
out.flush();
out.close();
}
catch(Exception e)
{
logger.error(e.getMessage(),e);
}
}

}

The type javax.ws.rs.core.MediaType cannot be resolved. It is indirectly referenced from required .class files的更多相关文章

  1. Java——使用ObjectMapper.writeValueAsString时报错The type com.fasterxml.jackson.core.JsonProcessingException cannot be resolved. It is indirectly referenced from required .class files

    报错信息: The type com.fasterxml.jackson.core.JsonProcessingException cannot be resolved. It is indirect ...

  2. The type org.apache.commons.cli.Options cannot be resolved. It is indirectly referenced from required .class files

    在搭建好Hadoop Eclipse开发环境后,编写map-reduce,遇到如下的问题: 从字面上可以看出,工程缺少org.apache.commons.cli.Options,这个包被间接的被其他 ...

  3. The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from required .class files

    The type javax.servlet.http.HttpServletResponse cannot be resolved. It is indirectly referenced from ...

  4. Java微信开发_Exception_01_The type org.xmlpull.v1.XmlPullParser cannot be resolved. It is indirectly referenced from required .class files

    一.源码: package com.souvc.weixin.util; import java.io.InputStream; import java.io.Writer; import java. ...

  5. rcp(插件开发)The type XXX cannot be resolved. It is indirectly referenced from required .class files解决办法

    如果你在使用插件开发时遇到这个问题: The type org.eclipse.core.resources.IFile cannot be resolved. It is indirectly re ...

  6. 【ActiveMQ】管理界面查看消息详情,报错/WEB-INF/tags/form/forEachMapEntry.tag PWC6199: Generated servlet error: The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files

    ActiveMQ版本:5.12 JDK版本:1.8 ===================== 使用ActiveMQ过程中,在管理界面查看消息详情,发现报错: 查看日志信息,报错如下: 2017-11 ...

  7. The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....

    遇到The type XXX cannot be resolved. It is indirectly referenced from required .class files错误.....,查找的 ...

  8. eclipse中java文件报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class fi ...

  9. 使用openoffice将word文件转换为pdf格式遇到问题:The type com.sun.star.lang.XEventListener cannot be resolved. It is indirectly referenced from required

    The type com.sun.star.lang.XEventListener cannot be resolved. It is indirectly referenced from requi ...

随机推荐

  1. c#与java的区别

    经常有人问这种问题,用了些时间java之后,发现这俩玩意除了一小部分壳子长的还有能稍微凑合上,基本上没什么相似之处,可以说也就是马甲层面上的相似吧,还是比较短的马甲... 一般C#多用于业务系统的开发 ...

  2. 阿里巴巴直播内容风险防控中的AI力量

    直播作为近来新兴的互动形态和今年阿里巴巴双十一的一大亮点,其内容风险监控是一个全新的课题,技术的挑战非常大,管控难点主要包括业界缺乏成熟方案和标准.主播行为.直播内容不可控.峰值期间数千路高并发处理. ...

  3. 创建几个常用table展示方式插件

    这次和大家分享的是自己写的一个table常用几种展示格式的js插件取名为(table-shenniu),样式使用的是bootstrap.min.css,还需要引用jquery.min.js包,这个插件 ...

  4. javascript工厂模式和构造函数模式创建对象

    一.工厂模式 工厂模式是软件工程领域一种广为人知的设计模式,这种模式抽象了创建具体对象的过程(本书后面还将讨论其他设计模式及其在JavaScript 中的实现).考虑到在ECMAScript 中无法创 ...

  5. MediatorPattern(中介者模式)

    /** * 中介者模式 * @author TMAC-J * 研究了这么多设计模式,觉得无非就是几点: * 1.若两个类有耦合关系,设立一个中间类,处理两个类的关系,把两个类的耦合降低 * 2.面向接 ...

  6. Form 表单提交参数

    今天因为要额外提交参数数组性的参数给form传到后台而苦恼了半天,结果发现,只需要在form表单对应的字段html空间中定义name = 后台参数名 的属性就ok了. 后台本来是只有模型参数的,但是后 ...

  7. Linux基础介绍【第五篇】

    linux权限位 Linux文件或目录的权限位是由9个权限位来控制,每三位为一组,它们分别是文件属主权限.属组权限.其他用户权限. r:read可读权限,对应数字4: w:write可写权限,对应数字 ...

  8. CentOS 7 安装出现 /dev/root does not exits 导致无法安装的问题

    本人在官网下的是这个 CentOS-7-x86_64-DVD-1611.iso ,然后用UltraISO 9.6制作的U盘启动盘,不过在安装的时候出现了这个错误, 然后也是搜了好久,试了一下,下面这个 ...

  9. x01.os.22: ubuntu 常用设置

    新组装了个 64 位电脑,i5 CPU,进入 ubuntu 后,又是一通搜索设置,整理如下,以备后用. 安装 .dep 包 sudo dpkg -i [filename.dep] 在 ubuntu 中 ...

  10. openfire的组件(Component)开发

    在之前的文章<Openfire阶段实践总结>中提到过一种openfire的扩展模式Compoent.本文将主要探讨对这种模式的应用与开发方法. 内部与外部组件介绍 在openfire中的许 ...