Agile PLM API
Hi All,
Version:9.3.5
Now, I am trying to get the “Rev Release Date” for one item using Agile API, but it shows the below error.
I am able to print the Part Number and Description without any issue. When I try to fetch the date it showing me the below error.
I have attached my program with this.
Could somebody help me to fix this?
Thank You.
Code
—-
package com.test;
import com.agile.api.*;
import java.util.*;
import java.text.*;
public class AdvancedQuery {
public static final String USERNAME = “xxx”;
public static final String PASSWORD = “xxx”;
public static final String URL = “xxx”;
public static IAgileSession session = null;
public static AgileSessionFactory factory;
public static IQuery query;
public static IAttribute[] attrs;
public static void main(String[] args) {
try {
// Create an IAgileSession instance.
session = connect(session);
query = (IQuery)session.createObject(IQuery.OBJECT_TYPE,
ItemConstants.CLASS_ITEM_BASE_CLASS);
query.setCaseSensitive(false);
query.setCriteria(“[Title Block.Number] contains ‘990-00001′”);
// Execute query and print results.
printQueryResult();
} catch (APIException e){
System.out.println(e.getErrorCode() + “, ” + e.getMessage());
System.out.println(e.getRootCause());
} catch (Exception e) {
e.printStackTrace();
} finally {
session.close();
}
}
private static void printQueryResult() throws APIException, ParseException {
Iterator i = query.execute().iterator();
// If there are no matching items, display an error message.
if (!i.hasNext()) {
System.out.println(“No Matching Items”);
return;
}
while (i.hasNext()) {
IRow row = (IRow)i.next();
String number = (String)row.getValue(
ItemConstants.ATT_TITLE_BLOCK_NUMBER);
String desc = (String)row.getValue(ItemConstants.ATT_TITLE_BLOCK_DESCRIPTION);
String dt = (String)row.getValue(ItemConstants.ATT_TITLE_BLOCK_REV_RELEASE_DATE).toString();
System.out.print(number);
System.out.println(desc);
System.out.println(dt);
}
}
private static IAgileSession connect(IAgileSession session)
throws APIException {
HashMap params = new HashMap();
params.put(AgileSessionFactory.USERNAME, USERNAME);
params.put(AgileSessionFactory.PASSWORD, PASSWORD);
factory = AgileSessionFactory.getInstance(URL);
session = factory.createSession(params);
return session;
}
}
Output:
WARNING: Illegal reflective access by weblogic.rjvm.MsgAbbrevInputStream to method java.io.ObjectInputStream.clear()
WARNING: Please consider reporting this to the maintainers of weblogic.rjvm.MsgAbbrevInputStream
WARNING: Use –illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
60029, Attribute “1,016” not found.
null
You are trying to retrieve the Rev Release Date from the IRow object for the search result. If the search result is not formatted to fetch those attributes, it wont give the result.
You can load the IDataObject from the IRow and use that object handle to retrieve all attributes of that Item.
IItem itemObj = (IItem)row.getReferent();
Hi Samalendu,
Thank You for your reply.
Yes. It is working fine. Also, it provides the below log4j error.
Do you have any idea why this error is occurring?
Thank You.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by weblogic.rjvm.MsgAbbrevInputStream to method java.io.ObjectInputStream.clear()
WARNING: Please consider reporting this to the maintainers of weblogic.rjvm.MsgAbbrevInputStream
WARNING: Use –illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
log4j:ERROR Could not parse url [file:/____RESOURCE_0____log4j.xml].
java.io.FileNotFoundException: \____RESOURCE_0____log4j.xml (The system cannot find the file specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at java.xml/javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:178)
at org.apache.log4j.xml.DOMConfigurator$2.parse(DOMConfigurator.java:690)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:789)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
at org.apache.log4j.Logger.getLogger(Logger.java:105)
at com.agile.pc.cmserver.base.CMLogger.setLogClass(CMLogger.java:41)
at com.agile.util.log.CMLogFactory.getLogger(CMLogFactory.java:61)
at com.agile.pc.cmserver.base.BaseRow.<clinit>(BaseRow.java:82)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1042)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:43)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:186)
at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1105)
at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1086)
at java.base/java.lang.reflect.Field.getLong(Field.java:630)
at java.base/java.io.ObjectStreamClass.getDeclaredSUID(ObjectStreamClass.java:1751)
at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:496)
at java.base/java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:484)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:484)
at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:381)
at java.base/java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:225)
at weblogic.rjvm.InboundMsgAbbrev$ServerChannelInputStream.resolveClass(InboundMsgAbbrev.java:114)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1886)
at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1772)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1581)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
at weblogic.rjvm.ClassTableEntry.readExternal(ClassTableEntry.java:36)
at java.base/java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:2136)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2085)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1594)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:430)
at weblogic.rjvm.InboundMsgAbbrev.readObject(InboundMsgAbbrev.java:67)
at weblogic.rjvm.InboundMsgAbbrev.read(InboundMsgAbbrev.java:39)
at weblogic.rjvm.MsgAbbrevJVMConnection.readMsgAbbrevs(MsgAbbrevJVMConnection.java:287)
at weblogic.rjvm.MsgAbbrevInputStream.init(MsgAbbrevInputStream.java:212)
at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:507)
at weblogic.rjvm.t3.MuxableSocketT3.dispatch(MuxableSocketT3.java:489)
at weblogic.socket.BaseAbstractMuxableSocket.dispatch(BaseAbstractMuxableSocket.java:359)
at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:970)
at weblogic.socket.SocketMuxer.readReadySocket(SocketMuxer.java:897)
at weblogic.socket.JavaSocketMuxer.processSockets(JavaSocketMuxer.java:344)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:30)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:147)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:119)