Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 测试restful时出错_Java_Netbeans - Fatal编程技术网

Java 测试restful时出错

Java 测试restful时出错,java,netbeans,Java,Netbeans,我使用的netbeans 7.0.1在这个项目中有什么错误 Error occurred during deployment: Exception while deploying the app [WebApplication] : org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 30; Deployment descriptor file WEB-INF/web.xml in archive [web]. cvc-co

我使用的netbeans 7.0.1在这个项目中有什么错误

Error occurred during deployment: Exception while deploying the app [WebApplication] : org.xml.sax.SAXParseException; lineNumber: 30; columnNumber: 30; Deployment descriptor file WEB-INF/web.xml in archive [web].  cvc-complex-type.2.4.a: Invalid content was found starting with element 'persistence-context-ref'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.. Please see server.log for more details.
    C:\Users\win-7\Desktop\WebApplication\nbproject\build-impl.xml:727: 
    The module has not been deployed.
        at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
        at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:106)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
    BUILD FAILED (total time: 2 seconds)
web.xml


为Java ME客户端到Web应用程序生成的servlet
MyPackage.WebToMobileServlet的Javon服务
WebToMobileServlet
MyPackage.WebToMobileServlet
伺服适配器
com.sun.jersey.spi.container.servlet.ServletContainer
1.
WebToMobileServlet
/servlet/MyPackage.WebToMobileServlet
伺服适配器
/资源/*
30
index.jsp
持久性/WebApplicationPU
WebApplicationPU
用户事务
javax.transaction.UserTransaction
容器

您的web.xml文件格式不正确,能否将其发布到此处

elemnet持久化上下文ref属于JavaEE5。您的web.xml应该使用架构而不是

仅更改此项不会解决问题,您的项目是为1.4规范创建的,该标记是为JavaEE5规范创建的

使用正确的规范版本重新创建项目,或者不使用该标记

web.xml文件的标题必须如下所示:

xmlns="http://java.sun.com/xml/ns/javaee"  
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"  
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee  
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

看起来您的web.xml格式不正确或不正常。你能把它贴在这里吗?也许我们可以看看这个问题


web.xml位于名为web-INF的目录中

更改xml时出错部署期间发生错误:部署应用程序[WebApplication]时出现异常:存档[web]中的部署描述符文件web-INF/web.xml。元素[schema]不是有效的根元素。有关详细信息,请参阅server.log。C:\Users\win-7\Desktop\New folder(2)\WebApplication\nbproject\build impl.xml:727:尚未部署模块。