RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-406556

Evendie's questions

Martin Hope
Evendie
Asked: 2022-07-12 19:29:50 +0000 UTC

(Java) javafx 不在 treeTableView 中显示数据

  • 1

我有一个 treeTableView 元素,我想在其中显示字符串类型的元素树。

为此,我通过 javafx(通过带有 main.fxml 中的参数的文件)创建了一个 treeTableView,然后我想用数据填充这棵树。

为此,我使用以下代码:

public void init(){
    
    //Получить treeTableViewFileName
    TreeTableView<String> treeTableViewFileName = controller.getTreeTableViewFileName();
    
    //Creating tree items
    TreeItem<String> childNode1 = new TreeItem<>("Child Node 1");
    TreeItem<String> childNode2 = new TreeItem<>("Child Node 2");
    TreeItem<String> childNode3 = new TreeItem<>("Child Node 3");
    
    //Creating the root element
    TreeItem<String> root = new TreeItem<>("Root");
    root.setExpanded(true);
    
    //Adding tree items to the root
    root.getChildren().setAll(childNode1, childNode2, childNode3);        

    //В колонку добавить CellValueFactory
    TreeTableColumn<String, String> column1 = controller.getTreeColumnFileName();
    column1.setCellValueFactory(new TreeItemPropertyValueFactory<>("name"));
    
    treeTableViewFileName.setRoot(root); //Добавить root
    treeTableViewFileName.setShowRoot(true); //Разрешить отображение root   

    //Запретить возможность менять размер колонки
    column1.setResizable(false);

    //Запретить возможность сортировать значения в колонке
    column1.setSortable(false);
    
    System.out.println("stop");
}

原来表已创建,但什么也没有显示:

在此处输入图像描述

同时,我在其他各种网站上看到了基于根元素创建 treeTableView 的示例,如下所示:

TreeTableView<String> treeTableView = new TreeTableView<>(root);

这不适合我,因为创建是通过 main.fxml 文件进行的,并且我需要在程序运行时添加数据本身。在我看到的所有示例中,正是这种方法:基于根创建表。

main.fxml 中的部分代码:

<Pane fx:id="pane3" prefHeight="280.0" prefWidth="917.0">
     <children>
        <TreeTableView fx:id="treeTableViewFileName" layoutX="14.0" layoutY="16.0" prefHeight="240.0" prefWidth="227.0">
          <columns>
            <TreeTableColumn fx:id="treeColumnFileName" prefWidth="199.0" text="FileName" />
          </columns>
        </TreeTableView>
     </children>
  </Pane>

告诉我在我的案例中如何组织数据的显示?非常感谢您提前。

java javafx
  • 1 个回答
  • 26 Views
Martin Hope
Evendie
Asked: 2022-07-04 15:40:07 +0000 UTC

Java - 如何在 Javafx 中动态调整 TableView 的大小

  • 0

在 Windows 应用程序中创建 TableView 时,我像这样初始化元素:

//Получить контроллер окна main
Controller_MainGUI controller = this.loader.getController();
        
//Получить tableViewFileName
TableView tableViewFileName = controller.getTableViewFileName();
        
//Получить колонки таблицы
ObservableList<TableColumn<HashMap<String, String>, String>> record = tableViewFileName.getColumns();

//В колонку добавить MapValueFactory
TableColumn<HashMap<String, String>, String> column1 = record.get(0);
MapValueFactory map1 = new MapValueFactory<>("name");
column1.setCellValueFactory(map1);   

同时,在初始化tableView元素的时候,可以设置column-column1属性,该属性负责改变column的大小:

setResizable(true/false)

同时,如果我们想拉伸它,那么没有类似的东西会负责调整 tableView 的大小,但找不到。

tableView 有一个有趣的方法:

setColumnResizePolicy();

同样,他负责处理列并调整它们的大小,但这不适用于 tableView 的大小。

在这种情况下,我的主要想法是,如果您拖动表格对象的边缘,您可以在工作过程中调整 tableView 的大小。例如,拖动图中所示的边框。

在此处输入图像描述

如果您在操作系统中拖动窗口的边缘,可以看到类似的东西。

附录 1:我的表 - tableView 位于 AnchorPane 元素中的表单上。图中显示了更完整的层次结构。

在此处输入图像描述


告诉我如何设置 tableView 属性,该属性负责调整此元素的大小。也许还有其他机制或机制来影响这一点。非常感谢您提前。

java javafx
  • 1 个回答
  • 46 Views
Martin Hope
Evendie
Asked: 2022-09-15 18:11:25 +0000 UTC

如何将 autoconf、automake、libtools 添加到 msys (Windows)?

  • 0

要在 msys 中运行./autogen.sh命令,您需要另外安装autoconf、automake、libtool。我已经下载了这些库:

autoconf-2.61-MSYS-1.0.11-1.tar.bz2 
automake-1.10-MSYS-1.0.11-1.tar.bz2 
libtool1.5-1.5.25a-20070701-MSYS-1.0.11-1.tar.bz2

但是不知道需要将它们解压到msys的哪个文件夹中,这样系统才能看到这些库的出现,并且可以执行./autogen.sh命令。


例如,我将autoconf-2.61-MSYS-1.0.11-1.tar.bz2解压到该文件夹​​根目录下的 msys 中。我重新启动程序并出现以下消息:

You must have automake installed to call autogen.sh.
Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz
(or a newer version if it is available)

**Error**: You must have `libtool' installed to call autogen.sh.
Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz
(or a newer version if it is available)

你能告诉我在哪里解压这些库吗?

c++
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-09-15 15:44:55 +0000 UTC

是否可以在 Windows 上安装和使用自动工具?

  • 0

有一个任务是在关闭的情况下用 C++ 构建 clucene 库。地点:

http://clucene.sourceforge.net/

说明说要使用库构建系统 - GNU autotools。简要说明:

Requirements:
GNU autotools is required. I have the following versions installed:
Autoconf 2.57
Automake 1.72
Libtool 1.5a

If you use significantly older versions, I can almost guarantee
issues.  This is because each of the autotools is constantly changing
with little regard to backward compatability or even compatiability
with the other autotools.

Run the autogen.sh file in the root directory of clucene to run the necessary commands.

Building

The following will get you building assuming that you have suffciently
recent buld tools installed.  
1.) unpack tarball 
2.) cd into clucene
3.) if you downloaded a tar version skip to 5
4.) run ./autogen.sh
5.) run ./configure
6.) run make
7.) things will churn for a very long time, the clucene library will
be built as well as the examples.
8.) check the src/demo, test and src directory

完整的说明是这里的说明:

https://ru.stackoverflow.com/questions/1328068/qt-%d0%9a%d0%b0%d0%ba-%d0%b4%d0%be%d0%b1%d0%b0%d0%b2%d0%b8%d1%82%d1%8c-%d0%b1%d0%b8%d0%b1%d0%bb%d0%b8%d0%be%d1%82%d0%b5%d0%ba%d1%83-clucene-%d0%b2-%d1%81%d0%b2%d0%be%d1%8e%d0%b9-%d0%bf%d1%80%d0%be%d0%b5%d0%ba%d1%82?noredirect=1#comment2348000_1328068

以前,我没有机会使用 autotools,我阅读并查看了这个构建系统,但所有文档都归结为 Linux,而我有 Windows。


您能告诉我如何在 Windows 下安装用于构建 autotools 库的系统吗?提前致谢。

c++
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-08-26 14:28:58 +0000 UTC

如何通过spring处理http请求?

  • 0

我有一个任务来形成这样的查询:

POST /foo HTTP/1.1
Content-Length: 68137
Content-Type: multipart/form-data; boundary=---------------------------974767299852498929531610575

-----------------------------974767299852498929531610575
Content-Disposition: form-data; name="description"

some text
-----------------------------974767299852498929531610575
Content-Disposition: form-data; name="myFile"; filename="1.txt"
Content-Type: text/plain

(content of the uploaded file 1.txt)
-----------------------------974767299852498929531610575--

这样它由两部分组成:来自文件的文本和数据。

为了形成这样的请求,我在客户端上执行以下代码:

public void sendPOSTRequest(String url, String authData, String attachmentFilePath, String outputFilePathName) {
        
        String charset = "UTF-8";
        File binaryFile = new File(attachmentFilePath);
        String boundary = "------------------------" + Long.toHexString(System.currentTimeMillis()); // Just generate some unique random value.
        String CRLF = "\r\n"; // Line separator required by multipart/form-data.
        int responseCode = 0;

        try {
            //Set POST general headers along with the boundary string (the seperator string of each part)
            URLConnection connection = new URL(url).openConnection();
            connection.setDoOutput(true);
            connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
            //connection.addRequestProperty("User-Agent", "CheckpaySrv/1.0.0");
            //connection.addRequestProperty("Accept", "*/*");
            //connection.addRequestProperty("Authentication", authData);

            OutputStream output = connection.getOutputStream();
            PrintWriter writer = new PrintWriter(new OutputStreamWriter(output, charset), true);

            writer.append("--" + boundary).append(CRLF);
            writer.append("Content-Disposition: form-data;").append(CRLF);
            writer.append("Content-Type: application/json").append(CRLF);// + URLConnection.guessContentTypeFromName(binaryFile.getName())).append(CRLF);
            writer.append("{\"a\":\"asda\"}").append(CRLF);// + URLConnection.guessContentTypeFromName(binaryFile.getName())).append(CRLF);
            writer.append(CRLF);
            
            // Send binary file - part
            // Part header
            writer.append("--" + boundary).append(CRLF);
            writer.append("Content-Disposition: form-data; name=\"file\"; filename=\"" + binaryFile.getName() + "\"").append(CRLF);
            writer.append("Content-Type: application/octet-stream").append(CRLF);// + URLConnection.guessContentTypeFromName(binaryFile.getName())).append(CRLF);
            writer.append(CRLF);
            writer.flush();

            // File data
            Files.copy(binaryFile.toPath(), output);
            output.flush();

            // End of multipart/form-data.
            writer.append(CRLF).append("--" + boundary + "--").flush();

            //Отправить запрос и ожидать ответ от сервера
            responseCode = ((HttpURLConnection) connection).getResponseCode(); 
 
            if (responseCode != 200) //We operate only on HTTP code 200
            {
                return;
            }

            InputStream Instream = ((HttpURLConnection) connection).getInputStream();

            // Write PDF file 
            BufferedInputStream BISin = new BufferedInputStream(Instream);
            FileOutputStream FOSfile = new FileOutputStream(outputFilePathName);
            BufferedOutputStream out = new BufferedOutputStream(FOSfile);

            int i;
            while ((i = BISin.read()) != -1) {
                out.write(i);
            }

            // Cleanup
            out.flush();
            out.close();

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

我尝试在服务器上使用以下代码处理此请求:

@RequestMapping(value = "/test6", method = RequestMethod.POST, consumes = { MediaType.MULTIPART_FORM_DATA_VALUE })
    public String test6(@RequestPart String part1) {
        System.out.println("data1: "+part1);
        System.out.println("Stop");
        return "string1";
    }

在向地址:http://localhost:8080/test6 发送 post 请求的过程中,在服务器上我收到以下消息:

WARN 2356 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : 
Resolved [org.springframework.web.multipart.support.MissingServletRequestPartException: 
Required request part 'part1' is not present]

告诉我如何使用 multipart/form-data 类型处理这样的 post 请求?

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-07-29 17:54:45 +0000 UTC

Java 清空内存

  • 3

例如,我有以下对象:

AutoDetectParser parser = new AutoDetectParser();
ParseContext pc = new ParseContext(); 
CustomBodyContentHandler ch = new CustomBodyContentHandler(-1);

为了给它们分配内存,我在右边写了new运算符,它是相等的,而这样的对象是在一个线程中创建的,所以如果有很多线程,那么就有很多这样的对象。

当线程完成它的工作时,你需要清除分配的内存,你想了解是否需要这样写:

mimeType = null;
parser = null;
pc = null;
ch = null;

或者 GC 本身将删除所有内容,因为没有对这些对象的引用。


告诉我该怎么做?是不是一定要写null清空内存,同时清空?!预先感谢您的理解。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-07-03 19:51:37 +0000 UTC

Lucene 如何在 StandardAnalyzer 中禁用 toLowerCase?

  • 1

我想使用标记器从我的文本中获取标记。

我的代码:

        ArrayList<String> toTextWord = new ArrayList<>(); 
        Analyzer analyzer = new StandardAnalyzer();

        try (TokenStream stream = analyzer.tokenStream("tags", new StringReader(iterStr))) {

            stream.addAttribute(CharTermAttribute.class);
            stream.reset();
            while (stream.incrementToken()) {
                CharTermAttribute token = stream.getAttribute(CharTermAttribute.class);
                System.out.println(token.toString());
                toTextWord.add(token.toString());
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

但是 StandardAnalyzer() 默认情况下使用单词的小写翻译,我怎样才能关闭它的 toLowerCase?或者在这种情况下还能尝试什么?提前致谢!

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-07-01 19:56:44 +0000 UTC

Lucene如何将文本中单词的位置与IndexWriter给出的位置匹配?

  • 0

我将文本存储在 fileContent 变量中:

created: 2003-09-22T19:01:14Z
Author: be590_guest

GUERRILLA WAR, COUNTERINSURGENCY, AND STATE 

FORMATION IN OTTOMAN YEMEN 
 

如果用空格分隔符将其拆分成单词,并翻译成TextWord类的一个对象,然后尝试显示内容,可以看到:


TextWord[0]: created:
TextWord[1]: 2003-09-22T19:01:14Z
Author:
TextWord[2]: be590_guest



TextWord[3]: 
GUERRILLA
TextWord[4]: WAR,
TextWord[5]: COUNTERINSURGENCY,
TextWord[6]: AND
TextWord[7]: STATE
TextWord[8]: 

FORMATION
TextWord[9]: IN
TextWord[10]: OTTOMAN
TextWord[11]: YEMEN

在 fileContent 变量上创建索引后:

//Создание индекса по данным из файла
    public void createIndex(String content) throws IOException {
        
        IndexWriterConfig indexWriterConfig = new IndexWriterConfig(new StandardAnalyzer());
        try (IndexWriter writer = new IndexWriter(this.memoryIndex, indexWriterConfig)) {
            Document doc = new Document();
            FieldType type = new FieldType();
            type.setStoreTermVectors(true);
            type.setStoreTermVectorPositions(true);
            type.setStoreTermVectorOffsets(true);
            type.setStored(true);
            type.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
            Field fieldStore = new Field("tags", content, type); //В поле "tags" записываются данные из переменной content
            doc.add(fieldStore);
            writer.addDocument(doc);
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }

为此,我使用新的 StandardAnalyzer()。

创建索引后,我想使用此创建的索引在文本文件内容中找到“状态”一词:

        String query_pattern = "state"; //Что хочу найти в тексте
        
        DirectoryReader reader = DirectoryReader.open(this.memoryIndex); //Взять индекс из памяти
        IndexSearcher searcher = new IndexSearcher(reader); //Создать поисковик по индексу

        //Поиск по одному слову
        Query query = new QueryParser("tags", analyzer).parse(query_pattern.toLowerCase()); //Запрос на поиск слова по полю tags
        TopDocs results = searcher.search(query, 1); //Результат поиска
        
        for (ScoreDoc scoreDoc : results.scoreDocs) { //Если слово было найдено, то...

            Fields termVs = reader.getTermVectors(scoreDoc.doc);
            Terms f = termVs.terms("tags");

            BytesRef ref = new BytesRef(query_pattern.toLowerCase()); //Шаблон в байтах для проверки

            TermsEnum te = f.iterator();
            PostingsEnum docsAndPosEnum = null;
            if (te.seekExact(ref)) { //Если нашли такое слово из шалона, то...

                //Узнать позицию и число повторений этого слова
                docsAndPosEnum = te.postings(docsAndPosEnum, PostingsEnum.ALL);
                int nextDoc = docsAndPosEnum.nextDoc();
                assert nextDoc != DocIdSetIterator.NO_MORE_DOCS;
                final int freg = docsAndPosEnum.freq();
                final int pos = docsAndPosEnum.nextPosition();
                final int o = docsAndPosEnum.startOffset();

                System.out.println("Word: " + ref.utf8ToString());
                System.out.println("[1] of [" + freg + "] Position: " + pos + ", startOffset: " + o + " length: " + ref.length + " Freg: " + freg);

                if (freg > 1) { //Число повторений слова в тексте
                    int i = 2;
                    for (int iter = 1; iter <= freg - 1; iter++) {
                        final int posNext = docsAndPosEnum.nextPosition();
                        System.out.println("[" + i + "] of [" + freg + "] Possition: " + posNext);
                        i++;
                    }
                }
            }
        }

单词被定位并显示其位置:

Word: state
Position: 12

我转到我的 TextWord 并且位置 12 没有这样的词,或者没有这样的位置,然后我显示索引中的所有术语及其位置,按顺序排列它们:

            Fields termVs = reader.getTermVectors(scoreDoc.doc);
            Terms f = termVs.terms("tags");
            TermsEnum te = f.iterator();
            PostingsEnum docsAndPosEnum = null;
            BytesRef bytesRef;

            while ((bytesRef = te.next()) != null) { //Пройтись по всем словам из индекса

                docsAndPosEnum = te.postings(docsAndPosEnum, PostingsEnum.ALL);
                int nextDoc = docsAndPosEnum.nextDoc();
                assert nextDoc != DocIdSetIterator.NO_MORE_DOCS;
                final int fr = docsAndPosEnum.freq();
                final int pos = docsAndPosEnum.nextPosition();
                final int o = docsAndPosEnum.startOffset();

                System.out.println("Word: " + bytesRef.utf8ToString());
                System.out.println("Position: " + pos + ", startOffset: " + o + " length: " + bytesRef.length + " Freg: " + fr);
                sortIndexWord.put(bytesRef.utf8ToString(), pos);

                if (fr > 1) {
                    for (int iter = 1; iter <= fr - 1; iter++) {
                        int posNext = docsAndPosEnum.nextPosition();
                        //System.out.println("Possition: " + posNext);
                        sortIndexWord.put(bytesRef.utf8ToString()+String.valueOf(iter), posNext);
                    }

                }

            }

我得到了这个数据:

IndexWord: [0]: created
IndexWord: [1]: 2003
IndexWord: [2]: 09
IndexWord: [3]: 22t19
IndexWord: [4]: 01
IndexWord: [5]: 14z
IndexWord: [6]: author
IndexWord: [7]: be590_guest
IndexWord: [8]: guerrilla
IndexWord: [9]: war
IndexWord: [10]: counterinsurgency
IndexWord: [12]: state
IndexWord: [13]: formation
IndexWord: [15]: ottoman
IndexWord: [16]: yemen

可以看出他从位置 11 中去掉了 And 这个词,State 变成了 12,但是如果我只是尝试显示标记,使用与新的 StandardAnalyzer() 索引相同:

public List<String> analyze(String text, Analyzer analyzer) throws IOException {
        List<String> result = new ArrayList<String>();
        TokenStream tokenStream = analyzer.tokenStream("tags", text);
        CharTermAttribute attr = tokenStream.addAttribute(CharTermAttribute.class);
        tokenStream.reset();
        while (tokenStream.incrementToken()) {
            result.add(attr.toString());
        }
        return result;
    }

    List<String> list = analyze(myContent, new StandardAnalyzer());
    for(int ik = 0 ; ik <= list.size()-1; ik++){
        System.out.println("ListWord["+ik+"]: "+list.get(ik));
    }

可以看出:

ListWord[0]: created
ListWord[1]: 2003
ListWord[2]: 09
ListWord[3]: 22t19
ListWord[4]: 01
ListWord[5]: 14z
ListWord[6]: author
ListWord[7]: be590_guest
ListWord[8]: guerrilla
ListWord[9]: war
ListWord[10]: counterinsurgency
ListWord[11]: state
ListWord[12]: formation
ListWord[13]: ottoman
ListWord[14]: yemen

And这个词又被删除了,但同时我还有其他索引,我猜不出他删除了哪些词,哪些没有。


问题是,如何将文本中单词的位置与 IndexWriter 给出的位置相匹配?请告诉我如何,提前谢谢。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-06-28 21:17:35 +0000 UTC

什么可以在代码中用迭代器代替 Lucene?

  • 0

这个想法是这样的:

  1. 在文本中搜索单词
  2. 如果找到了这个词,那么我想在文本中找到它的位置(而不是在索引中)

我的代码:

    
public void methodFromStack() throws Exception {
        
    Directory directory = new RAMDirectory();
    IndexWriterConfig indexWriterConfig = new IndexWriterConfig(new StandardAnalyzer());
    IndexWriter writer = new IndexWriter(directory, indexWriterConfig);

    Document doc = new Document();
    FieldType type = new FieldType();
    type.setStoreTermVectors(true);
    type.setStoreTermVectorPositions(true);
    type.setStoreTermVectorOffsets(true);
    type.setStored(true);
    type.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
    Field fieldStore = new Field("tags", "Kite good world.", type);
    doc.add(fieldStore);
    writer.addDocument(doc);
    writer.close();
    
    DirectoryReader reader = DirectoryReader.open(directory);
    IndexSearcher searcher = new IndexSearcher(reader);
    
    //Поиск по словосочетанию с учетом отступа
    QueryParser queryParser = new QueryParser("tags", new StandardAnalyzer());
    Query query = queryParser.parse("\"Kite World\"~1");
    TopDocs results = searcher.search(query, 1);
    
    for ( ScoreDoc scoreDoc : results.scoreDocs) {

        Fields termVs = reader.getTermVectors(scoreDoc.doc);
        Terms f = termVs.terms("tags");

        TermsEnum te = f.iterator();
        PostingsEnum docsAndPosEnum = null;
        BytesRef bytesRef;
        while ((bytesRef = te.next()) != null) {
            docsAndPosEnum = te.postings(docsAndPosEnum, PostingsEnum.ALL);
            int nextDoc = docsAndPosEnum.nextDoc();
            assert nextDoc != DocIdSetIterator.NO_MORE_DOCS;
            final int fr = docsAndPosEnum.freq();
            final int p = docsAndPosEnum.nextPosition();
            final int o = docsAndPosEnum.startOffset();
            
            System.out.println("Word: " + bytesRef.utf8ToString());
            System.out.println("Position: "+ p + ", startOffset: " + o + " length: " + bytesRef.length + " Freg: " + fr);
        
            if(fr > 1){
                for(int iter = 1; iter <= fr-1; iter++) {
                    System.out.println("Possition: "+ docsAndPosEnum.nextPosition());
                }
          
            }


        }
    }
}
  

我知道在 Lucene 版本 3 之后,当切换到版本 4 时,API 发生了变化,并且类 TermFreqVector 和类 TermPositionVector 被删除,而我正在寻找任何其他方法来获得我的单词或术语,但在所有情况下我都是提供使用迭代器并传递索引中的所有术语。


告诉我如何替换迭代器?是否有可能在不通过所有元素的情况下以某种方式找到我的结果术语?

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-06-28 18:22:50 +0000 UTC

编译Java时,代码要java 7或更高,但我有8,怎么办?

  • 0

编译时,显示以下消息:

com/javacodegeeks/jstringsearch/Main2.java:[133,57] underscores in literals are not supported in -source 1.6
  (use -source 7 or higher to enable underscores in literals)
com/javacodegeeks/jstringsearch/file/LuceneWriteIndexFromFileExample.java:[120,13] try-with-resources is not supported in -source 1.6
  (use -source 7 or higher to enable try-with-resources)
com/javacodegeeks/jstringsearch/memoryIndex/InMemoryLuceneIndex.java:[110,30] multi-catch statement is not supported in -source 1.6
  (use -source 7 or higher to enable multi-catch statement)

我有版本 8。

在此处输入图像描述

告诉我该怎么做,还是我混淆了什么?如何解决这样的问题?

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-05-24 04:09:45 +0000 UTC

从 NetBeans 启动程序时出错 - JavaFX

  • 0

我通过 NetBeans 运行程序:

package com.mycompany.analyzeresumer;

import java.io.IOException;
import java.util.Objects;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class AnalyzeResumer extends Application{
     
    public static void main(String[] args) {
         
        launch(args);
    }
     
    @Override
    public void start(Stage stage) throws IOException {

        Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("sample.fxml")));
        stage.setTitle("Resume analyzer");
        stage.setScene(new Scene(root));
        stage.show();
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.analyzeresumer;

/**
 *
 * @author Sergei
 */
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.scene.control.Button;

public class Controller {

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button b1;

    @FXML
    private Button b2;

    @FXML
    void initialize() {
        b1.setOnAction(event -> {
        
            System.out.println("Wow");
        });
    }
}

并显示以下错误:


 Exception in Application start method
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:873)
Caused by: java.lang.RuntimeException: Exception in Application start method
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
    at java.util.Objects.requireNonNull(Objects.java:203)
    at com.mycompany.analyzeresumer.AnalyzeResumer.start(AnalyzeResumer.java:22)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:863)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:187)
    ... 1 more
Exception running application com.mycompany.analyzeresumer.AnalyzeResumer
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  4.536 s
Finished at: 2021-05-23T22:02:04+03:00
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project AnalyzeResumer: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


在此处输入图像描述

如果我通过Idea运行它,那么一切正常,但是我需要通过NetBeans运行它,请告诉我是否有人知道如何解决这个问题,非常感谢你提前。(请在精神上不加评论,转用IntelliJ IDEA,提前感谢您的帮助和理解)

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-22 17:00:31 +0000 UTC

Java 如何在我的程序中使用 2 或 3 个版本的 slf4j?

  • 0

我正在通过 Maven 构建一个项目,使用 Windows8 和 NetBeans。我有代码:

           try (InputStream is = new BufferedInputStream(new FileInputStream(newStr))){
                
                String mimeType = tika.detect(is); //определяем mimeType нашего документа
                metadata.set(Metadata.CONTENT_TYPE, mimeType);//устанавливаем mimeType
                
                AutoDetectParser parser = new AutoDetectParser();
                ParseContext pc = new ParseContext(); 
                ContentHandler ch = new BodyContentHandler(-1); 
                parser.parse(is, ch, metadata, pc); //разбор файла на части

           } catch (IOException | SAXException | TikaException ex) {

                System.out.println("Exception of Tika");

           } catch (Throwable th) {
               System.out.println(th.getMessage());
                th.printStackTrace();
                System.out.println("catch");

对一行执行操作时 - parser.parse(is, ch, metadata, pc)。程序无法处理文件并开始进入 catch。以前,她总是因为 Tika 自己抛出的异常而进入第一次捕获,在我添加一些库或更改 pom.xml 中的某些内容后,她没有从 tika 捕获异常,而是进入第二次捕获并捕获另一个异常. 我阅读了 th.printStackTrace() 并看到了这条消息:

org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
    at org.apache.commons.logging.impl.SLF4JLocationAwareLog.debug(SLF4JLocationAwareLog.java:131)
    at org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupTable(GlyphSubstitutionTable.java:263)
    at org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupList(GlyphSubstitutionTable.java:231)
    at org.apache.fontbox.ttf.GlyphSubstitutionTable.read(GlyphSubstitutionTable.java:80)
    at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:353)
    at org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)

...

然后我查看了 mav dependency:tree 并看到 slf4j 的某些版本相互冲突。某些库希望使用比我在 pom.xml 中指定的版本更旧的版本。


我的新 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>StackExp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <tika>1.2</tika>
    </properties>
    
    <dependencies>
        
        <!-- catch-throwable для отлавливания exception-->
        <dependency>
            <groupId>eu.codearte.catch-exception</groupId>
            <artifactId>catch-throwable</artifactId>
            <version>1.4.4</version>
        </dependency>       

        <!-- commons-lang3: для замера времени-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.11</version>
        </dependency>
        
        <!-- jdom: для чтения файла task.xml-->
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
            <type>jar</type>
        </dependency>
        
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.25</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika</artifactId>
            <version>1.25</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.apache.Tika</groupId>
            <artifactId>Tika-serialization</artifactId>
            <version>1.25</version>
        </dependency> 
        <dependency>     
            <groupId>org.apache.Tika</groupId>
            <artifactId>tika-app</artifactId>
            <version>1.25</version>
        </dependency>  
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>1.25</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-app</artifactId>
            <version>2.0.21</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
            <version>2.2.1</version>
        </dependency>     
        <dependency>
            <groupId> org.apache.cassandra</groupId>
            <artifactId>cassandra-all</artifactId>
            <version>0.8.1</version>
        </dependency>
        
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>biz.aQute</groupId>
            <artifactId>bndlib</artifactId>
            <version>1.50.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>jbig2-imageio</artifactId>
            <version>3.0.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>fontbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        
        <!-- Test dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.28</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.28</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.28</version>
        </dependency>
        
        <!-- New1-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>1.7.28</version>
        </dependency>
        <!-- New2 -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.28</version>
        </dependency>


        
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-core</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-jpeg2000</artifactId>
            <version>1.4.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.jai-imageio</groupId>
                    <artifactId>jai-imageio-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>xmpbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-tools</artifactId>
            <version>2.0.19</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-debugger</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>ome</groupId>
            <artifactId>bio-formats</artifactId>
            <version>5.0.0-rc2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>preflight</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>jempbox</artifactId>
            <version>1.8.16</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.7.0</version>
            <scope>test</scope>
        </dependency>


        <!-- Helper's dependencies -->
        <dependency>
            <groupId>org.gagravarr</groupId>
            <artifactId>vorbis-java-tika</artifactId>
            <version>0.1</version>
        </dependency>
        
        
        <dependency>
            <groupId>com.jolira</groupId>
            <artifactId>onejar-maven-plugin</artifactId>
            <version>1.4.4</version>
        </dependency>
        
        
    </dependencies>

    <build>
        <plugins>
               
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.mycompany.stackexp.Parser</mainClass>
                       
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
                      
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.mycompany.stackexp.Parser</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

例如在 mvn dependency:tree 我可以看到:

[INFO] |  |  |  +- com.intellij:annotations:jar:12.0:compile
[INFO] |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.6:compile - omitted for conflict with 1.7.28)
[INFO] |  |  +- (commons-cli:commons-cli:jar:1.4:compile - omitted for conflict with 1.1)
[INFO] |  +- (org.slf4j:slf4j-log4j12:jar:1.7.28:compile - omitted for conflict with 1.7.25)
[INFO] |  +- (org.gagravarr:vorbis-java-tika:jar:0.8:compile - omitted for conflict with 0.1)
[INFO] |  +- org.tallison:jmatio:jar:1.5:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.25:compile - omitted for conflict with 1.7.28)
[INFO] |  +- com.epam:parso:jar:2.0.12:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for conflict with 1.7.25)
[INFO] |  +- (org.apache.pdfbox:pdfbox:jar:2.0.21:compile - omitted for conflict with 2.0.22)
[INFO] |  +- (org.apache.pdfbox:pdfbox-tools:jar:2.0.21:compile - omitted for conflict with 2.0.19)
[INFO] |  +- (org.apache.pdfbox:preflight:jar:2.0.21:compile - omitted for conflict with 2.0.22)
[INFO] |  +- (org.apache.pdfbox:jempbox:jar:1.8.16:compile - omitted for duplicate)
[INFO] |  +- (org.apache.pdfbox:xmpbox:jar:2.0.21:compile - omitted for conflict with 2.0.22)
[INFO] |  +- org.tallison:isoparser:jar:1.9.41.4:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.30:compile - omitted for conflict with 1.7.25)
[INFO] |  +- com.rometools:rome:jar:1.15.0:compile
[INFO] |  |  +- com.rometools:rome-utils:jar:1.15.0:compile
[INFO] |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - omitted for conflict with 1.7.25)
[INFO] |  |  +- (org.jdom:jdom2:jar:2.0.6:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - omitted for conflict with 1.7.25)
[INFO] |  +- com.github.junrar:junrar:jar:7.4.0:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.9:runtime - omitted for conflict with 1.7.25)
[INFO] |  +- (org.slf4j:slf4j-api:jar:1.7.28:compile - omitted for conflict with 1.7.25)
[INFO] |  |  +- (net.jcip:jcip-annotations:jar:1.0:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.28)
[INFO] |  +- edu.ucar:grib:jar:4.5.5:compile
[INFO] |  |  +- (edu.ucar:cdm:jar:4.5.5:compile - omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.7:compile - omitted for conflict with 1.7.28)

这棵树的完整信息可以在文件中看到 - https://dropmefiles.com/SMjrP


那么问题来了,你如何使用这个 slf4j 的 2 或 3 个库,或者你如何给这些链接的库提供他们需要的 slf4j 库的版本?一般来说,这样的版本冲突情况如何解决呢?请让我知道解决此问题的最佳方法是什么。预先感谢您的理解。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-22 02:39:28 +0000 UTC

java构建项目并在线程“main”java.lang.StackOverflowError中抛出异常

  • 1

我正在构建一个 Maven 项目,它可以工作并且我可以使用它。但是在组装之后,我通常会在控制台中看到类似这样的消息:

Exception in thread "main" java.lang.StackOverflowError
at java.io.FileOutputStream.write(FileOutputStream.java:326)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at java.io.PrintStream.write(PrintStream.java:482)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)
at java.io.PrintStream.write(PrintStream.java:527)
at java.io.PrintStream.print(PrintStream.java:583)
at org.fusesource.jansi.FilterPrintStream.write(FilterPrintStream.java:99)
at org.fusesource.jansi.FilterPrintStream.write(FilterPrintStream.java:107)
at org.fusesource.jansi.FilterPrintStream.print(FilterPrintStream.java:156)
at org.fusesource.jansi.FilterPrintStream.println(FilterPrintStream.java:231)
at org.slf4j.impl.SimpleLogger.write(SimpleLogger.java:318)
at org.slf4j.impl.SimpleLogger.log(SimpleLogger.java:295)
at org.slf4j.impl.SimpleLogger.info(SimpleLogger.java:480)
at org.apache.maven.cli.logging.Slf4jLogger.info(Slf4jLogger.java:59)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:464)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)
at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:467)

我的主要功能代码:

public static void main(String[] args) throws IOException, SAXException, TikaException, InterruptedException, FileNotFoundException, JDOMException {
        
        numberQueue = 0; //Кол-во элементов в очереди
        //Если запускать из среды: путь до файла config.xml
        linkFileConfig = "D:\\Programs\\Qt\\Units\\MyJavaProjects\\"
                + "Qt-Java\\build-JavaQt-Desktop_Qt_5_9_1_MSVC2015_64bit-Profile\\"
                + "release\\config.xml";
//Использование logging---------------------------------------------------------
   
        //Путь к файлу Log.txt
        String linkLogFile = linkFileConfig.replace("config.xml", "Log.txt");
        //Поток4 - Запись ошибок в файл Log.txt
        threadWriteLog = new LogWritter(linkLogFile);
        new Thread(threadWriteLog, "threadWriteLog").start();
//------------------------------------------------------------------------------        
//Новое место для чтения файла config.xml с новыми параметрами------------------
        //Начальная инициализация
        oldCores = 0;
        threadPool = new LinkedBlockingQueue<Runnable>();
        serviceOne = new ThreadPoolExecutor(0, 10, 0L, TimeUnit.MILLISECONDS, threadPool);
        //При первом запуске прочитать config.xml 
        //И сохранить директории
        File configFile = new File(linkFileConfig);
        Path = readConfig(configFile);
//------------------------------------------------------------------------------
        
        //Открывается порт сервера для соединения
        serverSocket = new ServerSocket(8000);  //для отправки результата
        
        //Открывается порт сервера для соединения
        serverSocket2 = new ServerSocket(8001); //для отправки очереди
        
        //Открывается порт сервера для соединения
        serverSocket3 = new ServerSocket(8002); //для отправки очереди
        
        //Сообщение: ждем соединения
        System.out.println("Waiting for connected...");
        
        //Ждем соединения с клиентом Qt
        clientSocket = serverSocket.accept();   //для результата
        //Ждем соединения с клиентом Qt
        clientSocket2 = serverSocket2.accept(); //для очереди 
        writerSocketQueue = new OutputStreamWriter(clientSocket2.getOutputStream());
        
        //Ждем соединения с клиентом Qt
        clientSocket3 = serverSocket3.accept(); //для завершения Java
        readSocket = new BufferedReader(
            new InputStreamReader(clientSocket3.getInputStream()));
        writeSockQt = new OutputStreamWriter(clientSocket3.getOutputStream());
        
        //Поток5 - получаем сообщение от Qt для закрытия Java
        Thread threadCloseJava = new Thread(new Closer());
        threadCloseJava.start();
        
        //Если соединились, тогда обрабатываем и отправляем статус
        //Если соединения нет, то ожидаем его
        while(clientSocket.isConnected()){ 
            sendQueue(numberQueue); //Отправить текущее значение очереди
            //Старый пути (in, out, task)
            oldPath = Path;
            //Поток1 - отслеживаем изм. файла config.mxl
            Thread threadConfig = new Thread(new configThread(linkFileConfig));
            threadConfig.start();
            
            //Поток2 - отслеживаем изм. кол-ва файлов .dat 
            MyThread myThread = new MyThread(linkFileConfig);
            new Thread(myThread, "MyThlread").start();
            
            //Поток3 - отслеживаем изм. кол-ва файлов task.xml
            ReadByte myThreadByte = new ReadByte(linkFileConfig);
            new Thread(myThreadByte, "ReadByte").start();
            boolean isWhile = true; //Для вечного чикла
            while (isWhile) {
                Thread.sleep(10); 
                
                //В файле config.xml был изменен путь до in директории 
                if (isChangeConfig) {
                    System.out.println("File config.xml has been changed by user");
                    
                    //Изменяю флаг в файле MyThread.java
                    myThread.isStop();
                    //File newFile = new File(oldPath[0] + "/in.bat");
                    //Создаю файл (в старой папке) in директории для триггера
                    File newFile = new File(oldPath[0] + File.separator + "in.bat");
                    newFile.createNewFile();
                    
                    //Изменяю флаг в class ReadByte
                    myThreadByte.isStopTask();
                    
                    //Создаю файл в старой папке task для триггера
                    File newSysFileTask = new File(oldPath[2] + File.separator+ "task.bat");
                    newSysFileTask.createNewFile();
                    
                    if(isRead == true){
                    
                        //Прочитать файл заново
                        Path = readConfig(configFile);
                        isRead = false;
                    }
                    
                    
                    //Чтобы ниже не прочитывали конфиг файл
                    isChangeConfig = false;
                    
                    //Равен ли новый in старому in?
                    boolean isEqually = Path[0].equals(oldPath[0]);
                    //не был изменен    = true
                    //был изменен       = false
                    
                    if (isEqually == false) { //в конфиге был изменен in путь
                        isFront = true; //Чтобы зайти в нижний блок
                    }
                    else{ //в конфиге не был изм. in путь 
                    
                        //Чтобы не заходить в нижний блок
                        //Для исключения повторной обработки файлов
                        isFront = false; 
                        isRead = true; 
                    }
                    
                    newFile.delete();        //Удалить файл in.bat
                    newSysFileTask.delete(); //Удалить файл task.bat
                    
                    //Перезаписать старые пути
                    oldPath = Path;
                    
                } //if(isChangeConfig)
                //Если не изменилась, то исп. старый Path[0]  
                File dir = new File(Path[0]); //Директория выборки
                //Filter для выборки только файлов psp
                FileFilter filter = new FileFilter() {
                    @Override
                    public boolean accept(File dir) {
                        return dir.getName().endsWith("dat");
                    }
                }; // конец Filter
                //Сохранить в массив файлы .psp, исходя из Filter
                File[] files = dir.listFiles(filter); //(00001.psp, 00001.dat) 
                int i = 0;
                //Если файлов нет, то будет проход выше
                if (files.length == 0) {
                    //Разрешить в верхнем блоке читать конфиг
                    isRead = true;
                    isFront = false;
                }
                
                if (isFront) {
                    
                    //Начинаем проход по файлам того массива
                    for (File file : files) {
                        // Получить абсолютное имя файла (psp & dat)     
                        String fileDat = file.getAbsolutePath(); //00001.psp
                        if (isChangeConfig) { //Если файл изменился, то
                            //Прочитываю файл config.xml
                            Path = readConfig(configFile);
                            
                            //Равен ли новый путь старому
                            boolean isEqually = Path[0].equals(oldPath[0]);
                            
                            //не был изменен    = true
                            //был изменен       = false
                            
                            if(isEqually == false){ //в конфиге был изменен in путь
                                //Уже прочитали конфиг, 
                                //не разрешаем еще раз его читать                                
                                isRead = false;
                                //Выйти из for и перейти на проверку в while
                                break;
                            }
                            else{ //в конфиге не был изменен in путь
                                //Изменяю флаг в class ReadByte
                                myThreadByte.isStopTask();
                                //Создаю файл в папке task для триггера
                                File newSysFileTask = new File(oldPath[2] + File.separator + "task.bat");
                                newSysFileTask.createNewFile();
                                //Удалить файл task.bat
                                newSysFileTask.delete();
                                
                                //Перезапись старого in
                                oldPath = Path;
                                
                                //Чтобы не заходить в секцию еще раз
                                isChangeConfig = false;
                                
                                System.out.println("Текущий файл идет на обработку: " + file.getName());
                                
                                serviceOne.submit(new Task(fileDat));
                                numberQueue++; //Изменить значение очереди
                                i++; //Какой сейчас файл в цикле
                               
                                sendQueue(numberQueue); //Отправить это значение
                            }
                            
                        } else {//Если не изменился конфиг файл, то создать поток обработки
                            System.out.println("Текущий файл идет на обработку: " + file.getName());
                            
                            serviceOne.submit(new Task(fileDat));
                            numberQueue++; //Изменить значение очереди
                            i++; //Какой сейчас файл в цикле 
                            
                            sendQueue(numberQueue); //Отправить это значение
                        }
                        //Если обработали последний файл, то уже не идем на обработку
                        if ((files.length) == i) {
                            //System.out.println("Последний файл");
                            isFront = false;
                            
                            //Разрешаем в верхнем блоке чтение конфига 
                            isRead = true;
                            
                            //Чтобы лишний раз не идти на проверку for
                            break;
                        }
                    } //for - по файлам массива
                }//if
                
            }//while (isWhile)
        } //while(clientSocket.isConnected())
        
    }//main

我阅读并发现 StackOverFlow 出现在堆栈溢出时。但是我仍然无法理解异常出现的原因。我无法理解这些行如何导致溢出。你能告诉我如何在这种情况下,可以看什么来解决它?也许还有其他方法?在此先感谢,任何建议将不胜感激。


我当前的 pom.xml,通过 maven 构建:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
            <archive>
                <manifest>
                   <addClasspath>true</addClasspath>
                   <classpathPrefix>lib/</classpathPrefix>
                   <mainClass>com.mycompany.stackexp.Parser</mainClass>
                   
                   <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
               <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                </manifest>
            </archive>
            <source>1.5</source>
            <target>1.5</target>
            </configuration>
        </plugin>
                  
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                       <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.mycompany.stackexp.Parser</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id> <!-- this is used for inheritance merges -->
                    <phase>package</phase> <!-- bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> 
    </plugins>
</build>
java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-21 17:09:37 +0000 UTC

Java如何修复库版本不兼容错误?

  • 0

在一个项目中,我正在使用 Apache Tika 处理一个文件。在解析函数上:

        try (InputStream is = new BufferedInputStream(new FileInputStream(newStr))){
            
            String mimeType = tika.detect(is); //определяем mimeType нашего документа
            metadata.set(Metadata.CONTENT_TYPE, mimeType);//устанавливаем mimeType
            
            AutoDetectParser parser = new AutoDetectParser();
            ParseContext pc = new ParseContext(); 
            ContentHandler ch = new BodyContentHandler(-1);
            parser.parse(is, ch, metadata, pc); //разбор файла на части

输出以下错误:

在此处输入图像描述

我尝试了命令:mvn依赖:树。她给了:

см. файл по ссылке-https://dropmefiles.com/826tG

在某些行中,有一个题词“因冲突而省略”。写的是版本冲突,但不清楚我的库版本应该被替换。告诉我该怎么做?也许还有其他想法如何解决我的问题。提前致谢。我将不胜感激对此的任何想法。


这是产生与答案相同的版本时的新 pom.xml。新的依赖树可以在文件中看到:https ://dropmefiles.com/3ZfrF

  <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mycompany</groupId>
    <artifactId>StackExp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <tika>1.2</tika>
    </properties>
    
    <dependencies>
        
        <!-- catch-throwable для отлавливания exception-->
        <dependency>
            <groupId>eu.codearte.catch-exception</groupId>
            <artifactId>catch-throwable</artifactId>
            <version>1.4.4</version>
        </dependency>       

        <!-- commons-lang3: для замера времени-->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.11</version>
        </dependency>
        
        <!-- jdom: для чтения файла task.xml-->
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>1.0</version>
            <type>jar</type>
        </dependency>
        
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>1.25</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika</artifactId>
            <version>1.25</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.apache.Tika</groupId>
            <artifactId>Tika-serialization</artifactId>
            <version>1.25</version>
        </dependency> 
        <dependency>     
            <groupId>org.apache.Tika</groupId>
            <artifactId>tika-app</artifactId>
            <version>1.25</version>
        </dependency>  
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>1.25</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-app</artifactId>
            <version>2.0.21</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-app</artifactId>
            <version>1.2</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.6.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
            <version>2.2.1</version>
        </dependency>     
        <dependency>
            <groupId> org.apache.cassandra</groupId>
            <artifactId>cassandra-all</artifactId>
            <version>0.8.1</version>
        </dependency>
        
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>biz.aQute</groupId>
            <artifactId>bndlib</artifactId>
            <version>1.50.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>jbig2-imageio</artifactId>
            <version>3.0.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>fontbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        
        <!-- Test dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>

        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-core</artifactId>
            <version>1.4.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.jai-imageio</groupId>
            <artifactId>jai-imageio-jpeg2000</artifactId>
            <version>1.4.0</version>
            <exclusions>
                <exclusion>
                    <groupId>com.github.jai-imageio</groupId>
                    <artifactId>jai-imageio-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.34.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>xmpbox</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-tools</artifactId>
            <version>2.0.19</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>pdfbox-debugger</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>ome</groupId>
            <artifactId>bio-formats</artifactId>
            <version>5.0.0-rc2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>preflight</artifactId>
            <version>2.0.22</version>
        </dependency>
        <dependency>
            <groupId>org.apache.pdfbox</groupId>
            <artifactId>jempbox</artifactId>
            <version>1.8.16</version>
        </dependency>
        <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.7.0</version>
        <scope>test</scope>
    </dependency>


    <!-- Helper's dependencies -->
        <dependency>
            <groupId>org.gagravarr</groupId>
            <artifactId>vorbis-java-tika</artifactId>
            <version>0.1</version>
        </dependency>
        
        
        <dependency>
            <groupId>com.jolira</groupId>
            <artifactId>onejar-maven-plugin</artifactId>
            <version>1.4.4</version>
        </dependency>
        
        
    </dependencies>

    <build>
        <plugins>
               
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                <archive>
                    <manifest>
                       <addClasspath>true</addClasspath>
                       <classpathPrefix>lib/</classpathPrefix>
                       <mainClass>com.mycompany.stackexp.Parser</mainClass>
                       
                       <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                   <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                    </manifest>
                </archive>
                <source>1.5</source>
                <target>1.5</target>
                </configuration>
            </plugin>
                      
            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                       <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
            
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.mycompany.stackexp.Parser</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
                        <phase>package</phase> <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin> 
            
            
        </plugins>
    
    </build>
    
  
</project>
java
  • 2 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-20 00:08:01 +0000 UTC

java如何动态改变活动线程数?

  • 0

我有 ExecutorService serviceOne。当我创建一个线程池对象时,我声明了我的执行程序中的线程数:

serviceOne = Executors.newFixedThreadPool(numberActiveThreads);

在程序工作的某个时刻,需要更改这些流的数量,以增加/减少它们。


我没有在这个类中找到必要的功能。告诉我如何使它在运行程序的过程中改变线程池中的活动线程数。提前致谢。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-15 18:41:15 +0000 UTC

Java 当我读取 xml 时无法访问内容

  • 0

我有一个 xml 视图:

<?xml version='1.0' encoding='utf-8'?>
<tasks>
    <task file_id="3406" cont_name="D:\Data\cont\con1.dat">
        <offset cont_offset="596672" file_size="16209"></offset>
        <offset cont_offset="3" file_size="5"></offset>
        <offset cont_offset="34534" file_size="3234"></offset>
    </task>
    <task file_id="3608" cont_name="D:\Data\cont\con2.dat"> 
        <offset cont_offset="39199605" file_size="101394"/></offset>
    </task>
    <task file_id="13435" cont_name="D:\Data\cont\con3.dat"> 
        <offset cont_offset="28936" file_size="14900"/></offset>
    </task> 
</tasks>

我的xml阅读代码:

        //Находим нужные параметры из task.xml------------------------------------------
        SAXBuilder parser = new SAXBuilder();
        org.jdom2.Document xmlDoc = parser.build(new File("D:\\Data\\task\\taskMas.xml"));
        
        //Получить все подэлементы <task>
        List children = xmlDoc.getRootElement().getChildren();
        Iterator i = children.iterator(); 
        
        while(i.hasNext()){ //Проход по всем подэлементам <task>
        
            Element nowTask = (Element) i.next();  //Текущий child элемента <task>

            String[] paramsXml = new String[2]; //Параметры для чтения контейнера
            System.out.println(nowTask.getName());
            
            //Параметры строчки <task...>
            paramsXml[0] = nowTask.getAttributeValue("file_id");       
            paramsXml[1] = nowTask.getAttributeValue("cont_name"); 
            
            //List из offset и отступов
            List<Content> offsetContent = nowTask.getContent();
            
        } //Переход на другую строчку

我可以访问任务根元素,并获取任务元素:

//Получить все подэлементы <task>
List children = xmlDoc.getRootElement().getChildren();

然后我逐个元素地遍历迭代器。我有任务元素的当前子元素

Element nowTask = (Element) i.next();  //Текущий child элемента <task>

但我无法从嵌套在任务中的 xml 中获取行

        <offset cont_offset="596672" file_size="16209"></offset>
        <offset cont_offset="3" file_size="5"></offset>
        <offset cont_offset="34534" file_size="3234"></offset>

为此,我尝试使用

//List из offset и отступов
            List<Content> offsetContent = nowTask.getContent();

但是我无法将内容作为元素访问以获取属性和值。同时,我知道这些嵌套的行作为内容存储在 nowTask 中。(见图)

在此处输入图像描述


告诉我如何访问这些嵌套元素并获取它们的属性?也许最初,我做错了什么,告诉我怎么做,提前谢谢。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-09 19:55:44 +0000 UTC

如何处理 QSystemTrayIcon 上的悬停?

  • 0

如何处理托盘图标上的鼠标悬停。我在 QSystemTrayIcon 类的描述中没有找到这样的信号。

到目前为止,我可以跟踪主窗口的“最小化”按钮的点击,也可以跟踪图标本身的信号:

void MainWindow::changeEvent(QEvent *event)
{
...
}

//Ф-ция для реагирования на DoubleClick по tray icon
void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
{
    switch (reason)
    {
        case QSystemTrayIcon::Trigger:
        case QSystemTrayIcon::DoubleClick:

            //Вывести информационное окно
            this -> trayActionExecute();
            break;

        default:
            break;
    }
}


但这是一个窗口事件,我需要跟踪鼠标移动事件。告诉我你的想法是什么?也许您只需要以不同的方式做所有事情,请告诉我该怎么做,在此先感谢。

qt
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-04-01 03:54:46 +0000 UTC

Java 无法读取 xml

  • 0

我有一个 xml 文件。它有这样的结构:

<?xml version='1.0' encoding='utf-8'?>
<tasks>
    <task file_id="3406" cont_name="D:\Data\cont\con1.dat" cont_offset="596672" file_size="16209"/>
    <task file_id="3608" cont_name="D:\Data\cont\con2.dat" cont_offset="39199605" file_size="101394"/>
    <task file_id="13435" cont_name="D:\Data\cont\con3.dat" cont_offset="28936" file_size="14900"/>
</tasks>

我的任务是读取这个文件并获取属性值:

file_id
cont_name
cont_offset
file_size

为了阅读,我使用以下代码:

File task_xml = new File("D:"+File.separator+
                                 "Data"+File.separator+
                                 "task"+File.separator+
                                 "task2.xml");

        if(task_xml.exists()){
        
            System.out.println("File exist");
        }
        
        DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

        // Создается дерево DOM документа из файла
        Document document = documentBuilder.parse(task_xml);

        // Получаем корневой элемент
        Node root = document.getDocumentElement();
        System.out.println(root.getNodeName());
        System.out.println(root.getNodeValue());
        
        //Сохраняем все подэлементы корневого - т.е. task
        NodeList tasks = root.getChildNodes();
        //task равен null
         
        //Проходим по всем подэлементам root
        for (int i = 0; i < tasks.getLength(); i++) {
            
            Node task = tasks.item(i); 
            System.out.println(task.getNodeName()); //Текущая строчка <task....>

            //Сохранить все атрибуты этой строчки
            NamedNodeMap taskMap = task.getAttributes();
            
            //Пройтись по всем этим атрибутам
            for (int k = 0; k < taskMap.getLength(); k++) { 
            
                Node curAtribute = taskMap.item(i);
                System.out.println(curAtribute.getNodeName());
                System.out.println(curAtribute.getNodeValue());
                
            }
            
            //Перейти а след.строчку <task ...>

        } //Конец прохода по всем строчкам

我可以读取主要元素 - 根等于任务,如果我想得到它的孩子,那么就行了:

        //Сохраняем все подэлементы корневого - т.е. task
        NodeList tasks = root.getChildNodes();

tasks 为 null,就好像没有子元素一样。但是有几行:

    <task file_id="3406" cont_name="D:\Data\cont\con1.dat" cont_offset="596672" file_size="16209"/>
    <task file_id="3608" cont_name="D:\Data\cont\con2.dat" cont_offset="39199605" file_size="101394"/>
    <task file_id="13435" cont_name="D:\Data\cont\con3.dat" cont_offset="28936" file_size="14900"/>


告诉我如何访问这些嵌套的字符串并获取它们的属性值?我寻找了如何应用它的方法,但没有找到合适的选择。或者,也许您首先需要另一种方式,请告诉我该怎么做,非常感谢您。

java
  • 2 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-03-30 20:01:27 +0000 UTC

Java无法重命名文件

  • 0

我有一个字节数组,我创建一个文件并将字节数组写入该文件,然后关闭记录。由于条目已关闭,我想重命名文件扩展名。

我的代码:

FileOutputStream newFile = new FileOutputStream(rb_Path[0]+"\\"+file_id+".d"); //было .dat

//Записать массив полученных байт в новый файл .dat
newFile.write(byteNewFile);
newFile.flush();

//Закрываем создание нового файла
newFile.close();

File file_d = new File(rb_Path[0]+"\\"+file_id+".d");     
//File file_dat = new File(rb_Path[0]+"\\"+file_id+".dat"); 

//file.d переименовать в file.dat
boolean isRenamed = file_d.renameTo(new java.io.File(rb_Path[0] + "\\" + file_id + ".dat"));
System.out.println(isRenamed);

但我得到虚假。结果,该文件没有被重命名(1234.d 到 1234.dat)。

也试过这样:

File file_d = new File(rb_Path[0]+"\\"+file_id+".d");     //Создан 
File file_dat = new File(rb_Path[0]+"\\"+file_id+".dat"); //Не создан, служит объектом для rename

//file.d переименовать в file.dat
boolean isRenamed = file_d.renameTo(file_dat);
System.out.println(isRenamed);

但是将扩展名从 .d 更改为 .dat 仍然不起作用。

  • rb_Path[0]- 没有无效字符。
  • file_id是一个 int,例如 1234

所以我什至不知道该怎么办。


请告诉我如何解决这个问题。也许你应该做不同的事情?谁有解决方案?非常感谢您提前。

java
  • 1 个回答
  • 10 Views
Martin Hope
Evendie
Asked: 2022-03-29 16:26:40 +0000 UTC

qt QFileDialog::getExistingDirectory 阻止套接字操作

  • 0

我有一个套接字,它在一个单独的类中并在一个单独的线程中运行。它接收数据并将其发送到主窗口,然后转到表单。问题是在调用线路时:

preIn = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);

在另一个设置窗口中,会打开一个模式窗口,阻止显示通过套接字接收的数据。

告诉我如何使 QFileDialog 不会阻止接受套接字中的数据?


补充:代码

void draw::sockReady(){

if(socket->waitForConnected(500))
{
    socket->waitForReadyRead(500);

    Data = socket->readAll();
    if(Data != ""){

        qDebug() << Data;

        emit emitSocket(Data);

    }
}

}

为此,我使用:

connect(socket, SIGNAL(readyRead()), this, SLOT(sockReady()));

为套接字创建单独线程的新增功能:

这是 draw.cpp 代码:

#include <QDebug>
#include <QEventLoop>

#include "draw.h"


draw::draw()
{
    socket = new QTcpSocket(this);
    connect(socket, SIGNAL(readyRead()), this, SLOT(sockReady()));
    connect(socket, SIGNAL(disconnected()),this, SLOT(sockDisc()));

    //Соединяемся через TCP
    socket->connectToHost("127.0.0.1", 8000);

}

draw::~draw()
{
    socket->disconnectFromHost();
    socket->close();
}

//Отсоединение
void draw::sockDisc()
{
    socket->deleteLater();
}

//Ф-ция получения данных и отправка их в главное окно
void draw::sockReady(){

    if(socket->waitForConnected(500))
    {
        socket->waitForReadyRead(500);

        Data = socket->readAll();
        if(Data != ""){

            qDebug() << Data;

            emit emitSocket(Data);

        }
    }
}

void draw::run(){

    qDebug() << "draw: Закончить выполнение потока";
}





现在draw.h代码:

#ifndef DRAW_H
#define DRAW_H

#include <QThread>
#include <Windows.h>
#include <QTcpSocket>

class draw : public QThread
{
    Q_OBJECT

public:
    draw();
    ~draw();

    void run();
    
    QTcpSocket* socket;
    QByteArray Data;

public slots:
    void sockDisc();
    void sockReady();

signals:
    void emitSocket(QByteArray);

private:


};

#endif // DRAW_H

我通过 main 进行启动://启动线程以连接 socket1 myDraw.start();

c++
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5