我正在尝试为我的应用程序调用Web服务。如果我在一个示例项目中调用它,它工作得非常好。但是当我将它与我的JavaFX合并时,它给了我太多的错误。Web服务客户端是使用Eclipse自动生成的。我只尝试调用这些方法。有人能帮我吗?
Error: **Correction** I have edited it and I am using now JAVASE-15 and JVAFX-SDK 11.0.2
The package javax.xml.namespace is accessible from more than one module: java.xml, jaxrpc
Correction Update 2: I have removed Java.xml dependencies and module-info file as well.
but the new error is this
**Error: Could not find or load main class gload.Main
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application**
and IF I keep the module info file it shows:
**Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.graphics not found, required by gload**
型号:
package gload.model;
import java.io.File;
import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.swing.JOptionPane;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import org.datacontract.schemas._2004._07.PE_PPER_MyPdmWebServiceClient_Data.CustomerItem;
import org.datacontract.schemas._2004._07.PE_PPER_MyPdmWebServiceClient_Data.Result;
import org.tempuri.IService;
import org.tempuri.ServiceLocator;
public class PdmData
{
public String scode;
public boolean state = false;
public static String CdfFile;
public static String pdflocation;
public static String Custom_Ci;
public static String Generic_Ci;
public static String Mp_ref;
public static String Interface;
public static String Comments;
public static String PersoAppli;
public static String Code;
public static String Revision;
public static String Customer_Name;
public static String Customer_reference;
public static String getCode() {
return Code;
}
public static void setCode(String code) {
Code = code;
}
public static String getRevision() {
return Revision;
}
public static void setRevision(String revision) {
Revision = revision;
}
public static String getCustomer_Name() {
return Customer_Name;
}
public static void setCustomer_Name(String customer_Name) {
Customer_Name = customer_Name;
}
public static String getCustomer_reference() {
return Customer_reference;
}
public static void setCustomer_reference(String customer_reference) {
Customer_reference = customer_reference;
}
public static String getPersoAppli() {
return PersoAppli;
}
public static void setPersoAppli(String persoAppli) {
PersoAppli = persoAppli;
}
public static String getGeneric_Ci() {
return Generic_Ci;
}
public static void setGeneric_Ci(String generic_Ci) {
Generic_Ci = generic_Ci;
}
public static String getCdfFile() {
return CdfFile;
}
public static void setCdfFile(String cdfFile) {
CdfFile = cdfFile;
}
public static String getPdflocation() {
return pdflocation;
}
public static void setPdflocation(String pdflocation) {
PdmData.pdflocation = pdflocation;
}
public String Cdffile(String reference) {
ServiceLocator locator = new ServiceLocator(); -------->Web Service Locator and call
try {
IService basicHttpBinding_IService = locator.getBasicHttpBinding_IService();
Result result = basicHttpBinding_IService.getFilebyDcode(reference);
//To download the files
String link = result.getLocation();
System.out.println(link);
File out = new File("C:\\TempDownload\\" + reference +".zip"); //Creating a zip file to store the contents of download file
new Thread(new Download(link,out)).start();
//To Unzip the file
Path source = Paths.get("C:\\TempDownload\\" + reference +".zip");
Path target = Paths.get("C:\\TempDownload\\Unzip");
try {
unzipFolder(source, target);
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
}
//Creating a File object for directory
File directoryPath = new File("C:\\TempDownload\\Unzip\\Pre Ppc" + reference + "A_Released");
//List of all files and directories
String[] contents = directoryPath.list();
System.out.println("List of files and directories in the specified directory:");
FilenameFilter pdffilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
String lowercaseName = name.toLowerCase();
if (lowercaseName.endsWith(".pdf")) {
return true;
} else {
return false;
}
}
};
String[] contents1 = directoryPath.list(pdffilter);
for(String fileName : contents1) {
System.out.println(fileName);
setCdfFile(fileName);
setPdflocation(directoryPath.toString());
}
//To extract the Data From PDF
File file = new File(getPdflocation() + "\\" + getCdfFile());
//FileInputStream fis = new FileInputStream(file);
PDDocument document = PDDocument.load(file);
PDFTextStripper pdfReader = new PDFTextStripper();
String docText = pdfReader.getText(document);
System.out.println(docText);
document.close();
//To extract details from document
String CI_Ref = "CI Ref";
int pos ;
pos = docText.indexOf(CI_Ref);
setGeneric_Ci(docText.substring(pos+7 , pos+15));
System.out.println("Generic CI: " + getGeneric_Ci());
//To get Details of CI
CustomerItem customerItem = basicHttpBinding_IService.getCiDetails(getGeneric_Ci());
setPersoAppli(customerItem.getPersoAppli());
setCode(customerItem.getCode());
setRevision(customerItem.getRevision());
setCustomer_Name(customerItem.getCustomerName());
setCustomer_reference(customerItem.getCustomerReference());
}catch (Exception e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null, "Unable to reach Service : " + e.getMessage());
}
return getPersoAppli();
}
模块信息文件
module gload {
requires javafx.controls;
requires javafx.fxml;
requires java.desktop;
requires java.rmi;
requires java.base;
requires axis;
requires jaxrpc;
requires org.apache.pdfbox;
opens gload;
opens gload.views.main;
opens gload.utils;
opens gload.model;
opens gload.controllers;
opens org.tempuri;
opens org.datacontract.schemas._2004._07.PE_PPER_MyPdmWebServiceClient_Data;
}
如果我将Jaxrpc保留在类路径而不是模块路径中,我会得到如下描述的错误类型javax。xml。rpc。无法解析ServiceException。它是从required间接引用的。类文件
好的,这并不是一个真正的答案,更多的相关问题和潜在的解决方法的指针。但我将把它作为一个答案发布,因为这样做可能比发表大量评论要好。
不幸的是,您有多个错误和问题,所以我将尝试单独处理其中的一些。
根据:
错误:
Error occurred during initialization of boot layer
java.lang.module.FindException:
Module X not found, required by Y
当--模块路径
错误且找不到模块时,可能会发生这种情况。也许,这至少是你的问题之一。链接的答案是Idea,我不使用Eclipse,所以我不知道如何在Eclipse中解决这个问题,但也许您可以做一些研究来找到答案。
关于:
The package javax.xml.namespace is accessible from more than one module
这里有一些关于正在发生的事情的信息:
这个修复对我来说似乎很棘手。请查看链接的问题和解决方案。看起来要么你需要要么
导致此问题的损坏库可能是您正在使用的jaxrpc
版本。我的猜测是,一些相关的XML库只是在Java9中添加到标准Java中的,但是您正在使用的jaxrpc库是在此之前开发的。因此,jaxrpc要么在其类中包含XML库,要么使用一个传递库来做同样的事情。这会导致冲突,因为XML库只能在项目中包含一次。
有关您的问题的更多信息请参见以下回答:
信息太难看了。你可以阅读答案,它可能会帮助你,也可能会让你泄气。
你可以做一些事情来帮助解决这个问题
对此应该怎么做有点棘手,这取决于你的技能水平以及你如何或是否能够解决它。我会就你可以做的一些事情提供一些建议,但还有其他选择。您比我更了解您的应用程序,因此您可以为您的应用程序提出更好的解决方案。
我建议把这些东西分开,作为故障排除的一种方式,得到一个可以与所有JavaFX组件一起工作的项目和一个可以与所有SOAP组件一起工作的项目,并确保它们构建并执行您想要的操作。然后尝试通过将两个项目集成到一个项目中或在两个项目之间进行通信的单独VM中运行它们来组合这两个项目(例如,通过添加的REST API,尽管这是一个更复杂的解决方案,所以在尝试之前要仔细考虑一下)。
另外,请升级至JavaFX的最新版本。我不认为它会解决您的问题,但这不会有什么坏处,而且最近的JavaFX版本中的一些改进可能会有助于缓解您的一些问题(尽管不是所有问题,因为您的一些问题源于模块化项目中的jaxrpc使用,这与JavaFX无关)。
而且,更重要的是,考虑使用不同的SOAP客户端框架,它与JAXRPC所具有的中断实现相比,更好地与模块化java 9交互。
至于你是否应该让你的应用程序模块化(是否包括模块信息),我真的不知道对你来说最好的方法。当然,无论你选择哪种方式,你都会遇到问题。但是,问题和如何解决它们将是不同的,这取决于所选择的解决方案路径(我想你已经在你的问题调查过程中发现)。
如有必要,将问题分解为单个单独的问题。如果您在解决每个单独的问题时需要帮助,请发布新的问题,这些问题具有最小的可复制示例代码来复制问题。请注意,如果您这样做,那么代码是绝对最小的,并且是完整的,因此它只复制并询问一个问题,不是一个以上的组合,并且问题是适当标记的-例如,如果问题是关于jaxrpc和模块化的,那么它应该包括jaxrpc和模块化标记,而不包括JavaFX代码或标记(反之亦然),如果这不是问题的一部分,则肯定在pdf代码或依赖项上。
问题内容: 我有一个非常大的程序,当前正在使用SWT。该程序可以在Windows,Mac和Linux上运行,它是一个包含许多元素的大型桌面应用程序。现在SWT有点老了,我想切换到Swing或JavaFX。我想听听您对三件事的想法。 我主要关心的是桌面GUI应用程序会更好吗?(我在网上看过,很多人认为JavaFX与Swing一样好,但是除了简单的见解大战之外,我没有看到很多有效的论点)。它必须在Wi
问题 你想通过网络提供持续的服务,与客户保持持续的联系。 解决方案 创建一个双向 TCP 客户机。 在 Node.js 中 net = require 'net' domain = 'localhost' port = 9001 ping = (socket, delay) -> console.log "Pinging server" socket.write "Ping"
我需要编写一个基于桌面的客户端应用程序,它在进行基于SAML的SSO身份验证后对SharePoint服务器进行一些Web服务方法调用。 我发现SAML SSO主要用于处理所有细节的浏览器。根据这个问题,SAML 2.0中似乎有一种技术称为ECP,专门用于启用非基于浏览器的客户端。 然而,SharePoint 2010/2013等一些应用程序仅支持SAML 1.1;在这种情况下可以使用什么?
我需要一个用于java spring应用程序的graphQL客户端,以与另一个基于graphQL API的微服务通信。我知道Apollo Android,但它似乎没有用maven实现(也许你知道maven的一些链接或示例等)。有什么想法和建议吗?提前感谢!
二面凉凉了。 1)空间中两个球,一个球以速度v0朝某个方向移动。怎么判断两个球是否发生碰撞,如果碰撞发生在什么时候。 2)虚拟内存是什么?为什么这么设计?用什么数据结构实现的 3)malloc和new有什么区别? 然后怼着malloc猛问,问了一大堆啥也不知道,记不清了 4)delete this 什么时候会使用? 5)3个文件 a.h class A; a.cpp class A{ void f