2011-10-21 1 views
2

내가이 넷빈즈 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을 사용하고이 프로젝트에서 오류가 무엇

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<web-app 
xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 
    <servlet> 
     <description>Generated servlet for Java ME Client to Web Application </description> 
     <display-name>Javon service for MyPackage.WebToMobileServlet</display-name> 
     <servlet-name>WebToMobileServlet</servlet-name> 
     <servlet-class>MyPackage.WebToMobileServlet</servlet-class> 
    </servlet> 
    <servlet> 
     <servlet-name>ServletAdaptor</servlet-name> 
     <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>WebToMobileServlet</servlet-name> 
     <url-pattern>/servlet/MyPackage.WebToMobileServlet</url-pattern> 
    </servlet-mapping> 
    <servlet-mapping> 
     <servlet-name>ServletAdaptor</servlet-name> 
     <url-pattern>/resources/*</url-pattern> 
    </servlet-mapping> 
    <session-config> 
     <session-timeout> 
      30 
     </session-timeout> 
    </session-config> 
    <welcome-file-list> 
     <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list> 
    <persistence-context-ref> 
     <persistence-context-ref-name>persistence/WebApplicationPU</persistence-context-ref-name> 
     <persistence-unit-name>WebApplicationPU</persistence-unit-name> 
    </persistence-context-ref> 
    <resource-ref> 
     <res-ref-name>UserTransaction</res-ref-name> 
     <res-type>javax.transaction.UserTransaction</res-type> 
     <res-auth>Container</res-auth> 
    </resource-ref> 
</web-app> 

답변

1

귀하의 web.xml 파일이 잘못된 것입니다, 당신은 그것을 게시 할 수 있습니다 이리? elemnet 지속성 컨텍스트-REF

5. 귀하의 web.xml에만이 문제가 해결되지 않습니다 변경

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd이 프로젝트는 1.4 스펙을 위해 만들어진하지 http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd 스키마를 사용한다 자바 EE에 속하는 그 태그는 Java EE 5 사양입니다.

올바른 사양 버전으로 프로젝트를 재 작성하거나 해당 태그를 사용하지 마십시오.

web.xml 파일의 헤더는 다음과 같이해야한다 : 당신의 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" 
+0

오류 WEB-INF라는 디렉토리에 있습니다. 아카이브 [웹]에 xml. 요소 [스키마]가 유효한 루트 요소가 아닙니다. 자세한 내용은 server.log를 참조하십시오. C : \ Users \ win-7 \ Desktop \ 새 폴더 (2) \ WebApplication \ nbproject \ build-impl.xml : 727 : 모듈이 배포되지 않았습니다. –

0

그것은 보인다. 여기에 게시 할 수 있습니까? 그러면 문제를 볼 수 있습니까? 예외를 응용 프로그램 [웹 응용] 배포하는 동안 : 배포 설명자 파일의 WEB-INF/웹 내가 장에서 XML 오류가 배포 중에 발생했을 때

은 web.xml은