Red.xml - я получаю эту ошибку при загрузке jav-файлов jar с помощью кнопки Добавить библиотеку Java.
Файл спецификации библиотеки не создан для библиотеки 'Library.class.name'
Попробовал следующие шаги,
- Автоматически удалено сборкаиз Eclipse и сделал Project -> Clean
- Повторно экспортировал файл jar из файлов классов java.
Примечание. При сборке из сценария Shell я смог собрать и выполнитьтот же код успешно.Где-то при создании файлов классов эта проблема возникает.Но не знаете, как ее исправить.
При перезагрузке файла класса библиотеки, на который имеется ссылка, получена следующая ошибка:
Проблема создания спецификации библиотеки
Problem occurred during generating libdoc for 'com.KTOC.TRB.testautomation.ObjectRepository.pg_SF_Login' library located at '/Users/roja/Automation/Jars-For-KTOC/TRBJars1.jar'.
RED python session problem. Following exception has been thrown by python service:
Traceback (most recent call last):
File "/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/robot_session_server.py", line 38, in inner
result['result'] = func(*args, **kwargs)
File "/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/robot_session_server.py", line 84, in inner
return to_call(*args, **kwargs)
File "/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/robot_session_server.py", line 116, in inner
return to_call(*args, **kwargs)
File "/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/robot_session_server.py", line 59, in inner
return func(*args, **kwargs)
File "/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/robot_session_server.py", line 305, in create_libdoc
return red_libraries.create_libdoc(libname, format)
File "/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/red_libraries.py", line 64, in create_libdoc
raise Exception(result)
Exception: Importing test library 'com.KTOC.TRB.testautomation.ObjectRepository.pg_SF_Login' failed: NoClassDefFoundError: Could not initialize class com.KTOC.TRB.testautomation.ObjectRepository.pg_SF_Login
java.lang.NoClassDefFoundError:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at robot.utils.importer$py._import$14(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py:167)
at robot.utils.importer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py.import_$32(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py:274)
at robot.utils.importer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py._import_class_or_module$5(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py:77)
at robot.utils.importer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py)
at robot.utils.importer$py.import_class_or_module$4(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py:74)
at robot.utils.importer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/importer.py)
at robot.libdocpkg.robotbuilder$py.build$2(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdocpkg/robotbuilder.py:40)
at robot.libdocpkg.robotbuilder$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdocpkg/robotbuilder.py)
at robot.libdocpkg$py.LibraryDocumentation$1(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdocpkg/__init__.py:47)
at robot.libdocpkg$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdocpkg/__init__.py)
at robot.libdoc$py.main$4(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdoc.py:163)
at robot.libdoc$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdoc.py)
at robot.utils.application$py._execute$10(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/application.py:94)
at robot.utils.application$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/application.py)
at robot.utils.application$py.execute$9(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/application.py:79)
at robot.utils.application$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/utils/application.py)
at robot.libdoc$py.libdoc$9(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdoc.py:223)
at robot.libdoc$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages/robot/libdoc.py)
at red_libraries$py._create_libdoc_with_stdout_redirect$5(/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/red_libraries.py:83)
at red_libraries$py.call_function(/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/red_libraries.py)
at red_libraries$py.create_libdoc$4(/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/red_libraries.py:66)
at red_libraries$py.call_function(/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502/red_libraries.py)
at SimpleXMLRPCServer$py._dispatch$15(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py:422)
at SimpleXMLRPCServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py)
at SimpleXMLRPCServer$py._marshaled_dispatch$10(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py:276)
at SimpleXMLRPCServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py)
at SimpleXMLRPCServer$py.do_POST$19(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py:535)
at SimpleXMLRPCServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SimpleXMLRPCServer.py)
at BaseHTTPServer$py.handle_one_request$7(/usr/local/Cellar/jython/2.7.1/libexec/Lib/BaseHTTPServer.py:345)
at BaseHTTPServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/BaseHTTPServer.py)
at BaseHTTPServer$py.handle$8(/usr/local/Cellar/jython/2.7.1/libexec/Lib/BaseHTTPServer.py:352)
at BaseHTTPServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/BaseHTTPServer.py)
at SocketServer$py.__init__$47(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py:659)
at SocketServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py)
at SocketServer$py.finish_request$13(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py:334)
at SocketServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py)
at SocketServer$py.process_request$11(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py:322)
at SocketServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py)
at SocketServer$py._handle_request_noblock$8(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py:298)
at SocketServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py)
at SocketServer$py.serve_forever$5(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py:241)
at SocketServer$py.call_function(/usr/local/Cellar/jython/2.7.1/libexec/Lib/SocketServer.py)
PYTHONPATH:
/Users/roja/Automation/Jars-For-KTOC/TRBJars1.jar
/private/var/folders/dv/nnfc_k29377bv7s34kng7qgh0000gn/T/RobotTempDir8808901746972554502
/usr/local/Cellar/jython/2.7.1/libexec/Lib
__classpath__
__pyclasspath__/
/usr/local/Cellar/jython/2.7.1/libexec/Lib/site-packages
CLASSPATH:
../../../../usr/local/Cellar/jython/2.7.1/libexec/jython.jar
.
Try --help for usage information.
Ниже кода в Xls_Reader.Java-файл
/**
*
*/
package com.KTOC.TRB.testautomation.Utilities;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Hashtable;
public class Xls_Reader {
public String path;
public FileInputStream fis = null;
private static XSSFWorkbook workbook = null;
private static XSSFSheet sheet = null;
public XSSFRow row = null;
private XSSFCell cell = null;
public static Xls_Reader xlsx;
public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL";
Xls_Reader (String path) {
ClassLoader classloader = getClass().getClassLoader();
try {
InputStream fis = classloader.getResourceAsStream(path);
workbook = new XSSFWorkbook(fis);
sheet = workbook.getSheetAt(0);
fis.close();
} catch (Exception e) {
}
}
String getCellData(String sheetnam, int colnum, int rownum) {
try {
if (rownum <= 0) {
return "";
}
int index = workbook.getSheetIndex(sheetnam);
if (index == -1) {
return "";
}
sheet = workbook.getSheetAt(index);
row = sheet.getRow(rownum - 1);
if (row == null) {
return "";
}
cell = row.getCell(colnum);
if (cell == null) {
return "";
}
} catch (Exception ignored) {
}
return cell.toString();
}
// returns the row count in a sheet
public int getRowCount(String sheetName) {
int index = workbook.getSheetIndex(sheetName);
if (index == -1) {
return 0;
} else {
sheet = workbook.getSheetAt(index);
return sheet.getLastRowNum() + 1;
}
}
// returns number of columns in a sheet
public int getColumnCount(String sheetName) {
sheet = workbook.getSheet(sheetName);
row = sheet.getRow(0);
if (row == null) {
return -1;
}
return row.getLastCellNum();
}
public static String getData(String SheetName, String TestCase, String parameter)
{
String parametervalue = null;
Xls_Reader xlsx = new Xls_Reader("../Users/roja/eclipse-workspace/KTOC_TestMethods/src/testautomation/TestData/KTOCData.xlsx");
Hashtable<String, String> hTable = getDatafromXlsx(TestCase, xlsx, SheetName);
parametervalue = (String) hTable.get(parameter);
return parametervalue;
}
public static Hashtable<String, String> getDatafromXlsx(String testcaseName, Xls_Reader xls, String sheetname)
{
int testcaseStartrow = 1;
while (!xls.getCellData(sheetname, 0, testcaseStartrow).equals(testcaseName))
{
testcaseStartrow++;
}
int testDataStartrownum = testcaseStartrow + 2;
int rows = 0;
while (!xls.getCellData(sheetname, 0, testDataStartrownum + rows).equals(""))
{
rows++;
}
int colStartRownum = testcaseStartrow + 1;
int cols = 0;
while (!xls.getCellData(sheetname, cols, colStartRownum).equals(""))
{
cols++;
}
Hashtable<String, String> table = null;
for (int rNum = testDataStartrownum; rNum < testDataStartrownum + rows; rNum++) {
table = new Hashtable<String, String>();
for (int cNum = 0; cNum < cols; cNum++) {
String key = xls.getCellData(sheetname, cNum, colStartRownum);
String value = xls.getCellData(sheetname, cNum, rNum);
table.put(key, value);
}
}
return table;
}
}