2014-11-15 5 views
5

NetBeans에서 XMLBeans를 사용하는 APACHE POI를 사용하여 일부 데이터를 EXCEL 파일로 내보내는 Exporter 클래스를 만들었습니다.사용자 정의 클래스에서 가져온 XMLBeans jar에 서명 할 수 없습니다.

zip 바이너리를 다운로드하고 수동으로 jars를 추가하여 APACHE POI 3.10.1 라이브러리를 추가했습니다.

같은 프로젝트에서이 클래스를 사용하면 모든 것이 올바르게 실행됩니다.

그런 다음이 클래스를 라이브러리 -> 프로젝트 추가를 마우스 오른쪽 버튼으로 클릭하여 다른 프로젝트에 추가했습니다.

하지만이 실행하려고하면 컴파일하는 동안 다음 오류가 발생했습니다.

Signing JAR: C:\Users\c\p\dist\lib\xmlbeans-2.6.0.jar to C:\Users\c\p\dist\lib\xmlbeans-2.6.0.jar as nb-jfx 
jarsigner: unable to sign jar: java.util.zip.ZipException: duplicate entry: org/apache/xmlbeans/xml/stream/Location.class 
Enter Passphrase for keystore: Enter key password for nb-jfx: 
C:\Users\c\p\nbproject\jfx-impl.xml:1465: The following error occurred while executing this line: 
C:\Users\c\p\nbproject\jfx-impl.xml:2968: The following error occurred while executing this line: 
C:\Users\c\p\nbproject\jfx-impl.xml:1940: jarsigner returned: 1 

나는 이것이 무엇 일지 모르지만 나를 미치게합니다.

+0

해결 했습니까? –

+0

나는 지금이 문제를 간신히 기억하고 있지만, 오래 전 이었지만, APACHE POI의 이전 버전을 사용하는 것으로 끝났다. 이게 도움이 되길 바란다. – chanklor

+0

여전히 POI의 최신 버전에서 발생합니다. –

답변

13

XMLBEANS Jira에서이 문제점을 정의한 버그가 있습니다. https://issues.apache.org/jira/browse/XMLBEANS-499이고 의견 중 하나가 수정 사항을보고합니다. 나는 아직 시도하지 않았지만 그렇게하고있다. 확인 해봐.

업데이트 : 해결되었습니다. 뒤늦은 견해에서 .jar가 제대로 생성 되었다면 해결은 분명하지만 고통스럽게 불필요합니다. Unzip (간단히 .jar 확장자를 .zip으로 변경하고 계속 진행) .jar은 중복 .class 파일 (이 경우 8 개)을 제거한 다음 jar 도구를 사용하여 .jar 파일을 다시 작성합니다. 명령은 "jar cf (path) \ xmlbeans-2.6.0.jar -C (압축이 풀린 폴더 경로)"입니다. 명령이 끝날 때 마침표를 잊지 마십시오. 그런 다음 새 xmlbeans-2.6.0.jar을 lib 디렉토리에 복사 했으므로 모두 잘되었습니다. 희망이 다른 사람을 도와주세요! :-)

0

maven을 사용하는 경우 xmlbeans 종속성의 압축을 풀어 볼 수 있습니다.

<executions> 
<execution> 
    <id>unpack-dependencies</id> 
    <phase>package</phase> 
    <goals> 
     <goal>unpack</goal> 
    </goals> 
    <configuration> 
     <artifactItems> 
      <artifactItem> 
       <groupId>org.apache.xmlbeans</groupId> 
       <artifactId>xmlbeans</artifactId> 
       <version>2.6.0</version> 
       <type>jar</type> 
       <overWrite>true</overWrite> 
       <outputDirectory>${project.build.directory}/classes</outputDirectory> 
       <excludes>**/*test.class</excludes> 
      </artifactItem> 
     </artifactItems> 
    </configuration> 
</execution> 
</executions> 
관련 문제