I have a problem with an application war, the application was not made by me, the application works, but when import to eclipse and export with attaching tomcat and java libraries 1.8.0_321, it does not work, I do not change anything in the application, such as import, export, the error is the following:
INFO main org.quartz.impl.StdSchedulerFactory - Using default
implementation for ThreadExecutor ERROR main
org.quartz.impl.StdSchedulerFactory - Couldn't generate instance Id!
org.quartz.SchedulerException: No value for
'org.quartz.scheduler.instanceId' system property found, please
configure your environment accordingly!
attached systemprops.jsp:
<div id="page" style="float:left;position:relative;left:60px; top:10px;font-size:1.0em;font-weight: 300; font-family:Helvetica, Arial, sans-serif;">
<div id="javasys">
<%
out.println("<table width=600 border=0>");
out.println("<tr>");
out.println("<td width=150><b>PROPERTY</b></td>");
out.println("<td width=450><b>VALUE</b></td>");
out.println("</tr>");
out.println("<tr>");
Properties props = System.getProperties();
Enumeration as = props.propertyNames();
while (as.hasMoreElements()) {
Object o = as.nextElement();
String key = (String) o;
out.println("<td width=150><b>" + key + "</b></td>");
String val = props.getProperty(key);
StringTokenizer st = new StringTokenizer(val, ":");
out.println("<td width=450>");
while (st.hasMoreTokens()) {
String valind = st.nextToken();
out.println(valind + "<BR>");
}
out.println("</td>");
out.println("</tr>");
}
out.println("</table>");
%>
</div>
I'm not a programmer, but I think it can come from here: Enumeration as = props.propertyNames();
in eclipse it has a warning in Enumeration as = props.propertyNames(); with Enumeration is a raw type, References to generic type Enumeration should be parameterized, It is not the only part of the code that I have this error
As the documentation says:
org.quartz.scheduler.instanceId
Can be any string, but must be unique for all schedulers working as if
they are the same ‘logical’ Scheduler within a cluster. You may use
the value “AUTO” as the instanceId if you wish the Id to be generated
for you. Or the value “SYS_PROP” if you want the value to come from
the system property “org.quartz.scheduler.instanceId”.
The problem is that in quartz.properties org.quartz.scheduler.instanceId is set to SYS_PROP, but you haven't defined this setting as a system property. This is obvious from the error message you show in your post:
No value for 'org.quartz.scheduler.instanceId' system property found,
please configure your environment accordingly!
Related
I am in the process of migrating existing VMSS tomcat project to AKS. In VM, we use server.xml to provide environment variables using <Environment .../> tags. For Kubernetes, I am using env: field to replace these values.
In the project, there is code Config.java:
private Object getObject(String key) {
try {
log.debug("looking up key: " + key + " in environment context.");
Object rtn = getEnvContext().lookup(key);
log.debug("Found property for " + key + ": " + rtn);
return rtn;
} catch (NamingException e) {
log.debug("Unable to find key: " + key);
return null;
}
}
private Context getEnvContext() throws NamingException {
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
return envCtx;
}
From what is java:comp/env?, it says that java:comp/env is the node in the JNDI tree where you can find properties for the current Java EE component.
Here are my questions.
When tomcat starts, does it use server.xml <Environment .../> tag to create properties in the node in the JNDI tree? (thus, when .getObject(someString) is called, it can get the value defined in server.xml)
If I want to replace server.xml with Helm chart env field, will these properties (defined in Helm) be defined in the node in the JNDI tree? or do I need to define these beans in jndi.xml as JndiObjectFactoryBean?
I am sorry if I am not making sense at all here. I am very new to tomcat and concept of JNDI and JNDI tree. Please let me know if I need to clarify myself.
I am trying to improve an old application that uses Oracle ADF 12c.
I need to compute the file name before it will be downloaded.
Currently the download of the file is written like this.
<af:table value="#{DocListManagedBean.list}" var="row"
disableColumnReordering="true" varStatus="vs" id="t1"
columnStretching="column:c2" emptyText="#{PageLabels.emptyText}"
styleClass="AFStretchWidth">
<af:column width="100px" align="center">
<f:facet name="header">
<af:outputText value="#{PageLabels.document}"/>
</f:facet>
<af:commandImageLink shortDesc="#{PageLabels.downloadDocument} ID: #{row.idDocument}"
icon="/skin/images/icons/pdf_icon4.gif">
<af:setPropertyListener from="#{row.idDocument}"
to="#{DocListManagedBean.selectedIdDocument}" type="action"/>
<af:fileDownloadActionListener contentType="application/pdf"
filename="#{row.documentName}"
method="#{DocListManagedBean.downloadFileListener}"/>
</af:commandImageLink>
</af:column>
<af:column>
<f:facet name="header">
<af:outputText value="#{PageLabels.documentName}"/>
</f:facet>
<af:outputText value="#{row.documentName}"/>
</af:column>
</af:table>
And it should now be so that (based on the document id) the file name should be computed, i.e. concatenated from several elements that are not in the object, the list of which is presented in af:table.
I already have the method returning the new file name in managed bean (called generateDocumentFileName). This method based on selectedIdDocument field in DocListManagedBean computes the correct filename and saves it in another field DocListManagedBean named selectedDocumentNewFilename.
Is it possible (without changing - without adding another field to the type of object presented by af:table) before running the af:downloadFileListener method, to run another method in managed bean (my generateDocumentFileName) ? ... which would calculate the missing name, save it to the field selectedDocumentNewFilename in managed bean and then new filename will be available e.g. via
<af:fileDownloadActionListener contentType="application/pdf"
filename="#{DocListManagedBean.selectedDocumentNewFilename}"
method="#{DocListManagedBean.downloadFileListener}"/>
Where I should put a call to my generateDocumentFileName method in the code above or is it a stupid idea and I should have done it differently ?
Thanks for help,
koli
The idea is mostly correct. You can programmatically set the file name in the filename attribute of the af:fileDownloadActionListener. (no need to call another function before hand - so you can remove the af:setPropertyListener).
You can get value from any iterator binding using the resolveExpression from the JsfUtils library. (detailled here https://cedricleruth.com/how-to-retreive-the-value-of-an-iterator-binding-variable-programmatically-in-adf/) For example your #{DocListManagedBean.selectedDocumentNewFilename} could look like this :
private String selectedDocumentNewFilename;
public String getSelectedDocumentNewFilename(){
//Using below function you can easily get any of those value in your ADF Bean as follow :
Long currentIdDocument = (Long)resolveExpression("#{row.idDocument}");//if idDocument is a Long in your VO
String currentNameDocument= (String)resolveExpression("#{row.documentName}"); //for example
String anyOtherStringValueYouWant= (String)resolveExpression("#{bindings.YOUR_VO.YOUR_VO_ATTRIBUTE.inputValue}"); //for example
//add any function to do something with this ID
String generatedName = this.generateDocumentFileName(currentIdDocument);
return "" + currentIdDocument.toString() + "_" + currentNameDocument + ".pdf"; //format as you like
//or in your case : return "" + generatedName + ".pdf";
}
/**
* Method for taking a reference to a JSF binding expression and returning
* the matching object (or creating it).
* #param expression EL expression
* #return Managed object
* #author : Duncan Mills, Steve Muench and Ric Smith's JSFUtils class
*/
public static Object resolveExpression(String expression) {
FacesContext facesContext = getFacesContext();
Application app = facesContext.getApplication();
ExpressionFactory elFactory = app.getExpressionFactory();
ELContext elContext = facesContext.getELContext();
ValueExpression valueExp = elFactory.createValueExpression(elContext, expression, Object.class);
return valueExp.getValue(elContext);
}
I am trying to read current entity expansionDjdk.xml.entityExpansionLimit limit, but it is giving null.
I tried the following code
System.getProperty("Djdk.xml.entityExpansionLimit");
System.getProperty("jdk.xml.entityExpansionLimit");
System.getProperty("jdk.xml.entityExpansionLimit");
System.getProperty("-DentityExpansionLimit");
System.getProperty("-Djdk.xml.entityExpansionLimit");
System.getProperty("ENTITY_EXPANSION_LIMIT");
All are giving result as null
You run your program like
java Example -Djdk.xml.entityExpansionLimit=1234
and read this property like
System.getProperty("jdk.xml.entityExpansionLimit");
You can list out all properties and check its name:
Properties props = System.getProperties();
Enumeration keys = props.keys();
while (keys.hasMoreElements()) {
String key = (String)keys.nextElement();
String value = (String)props.get(key);
System.out.println(key + ": " + value);
}
If you can't see it, I think that property is not set before.
Hope this helps.
I've spent several frustrating days on this now and would appreciate some help. I have a Java agent in Lotus Domino 8.5.3 which is activated by a cgi:POST from my Lotusscript validation agent which is checking that customer has filled in the Billing and delivery address form. This is the code that parses the incoming data into a HashMap where field names are mapped to their respective values.
HashMap hmParam = new HashMap(); //Our Hashmap for request_content data
//Grab transaction parameters from form that called agent (CGI: request_content)
if (contentDecoded != null) {
String[] arrParam = contentDecoded.split("&");
for(int i=0; i < arrParam.length; i++) {
int n = arrParam[i].indexOf("=");
String paramName = arrParam[i].substring(0, n);
String paramValue = arrParam[i].substring(n + 1, arrParam[i].length());
hmParam.put(paramName, paramValue); //Old HashMap
if (paramName.equalsIgnoreCase("transaction_id")) {
transactionID = paramValue;
description = "Order " + transactionID + " from Fareham Wine Cellar";
//System.out.println("OrderID = " + transactionID);
}
if (paramName.equalsIgnoreCase("amount")) {
orderTotal = paramValue;
}
if (paramName.equalsIgnoreCase("deliveryCharge")) {
shipping = paramValue;
}
}
}
The block of code above dates back over a year to my original integration of shopping cart to Barclays EPDQ payment gateway. In that agent I recover the specific values and build a form that is then submitted to EPDQ CPI later on in the agent like this;
out.print("<input type=\"hidden\" name=\"shipping\" value=\"");
out.println(hmParam.get("shipping") + "\">");
I want to do exactly the same thing here, except when I try the agent crashes with a null pointer exception. I can successfully iterate through the hashMap with the snippet below, so I know the data is present, but I can't understand why I can't use myHashMap.Get(key) to get each field value in the order I want them for the html form. The original agent in another application is still in use so what is going on? The data too is essentially unchanged String fieldnames mapped to String values.
Iterator it = cgiData.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
out.println("<br />" + pairs.getKey() + " = " + pairs.getValue());
//System.out.println(pairs.getKey() + " = " + pairs.getValue());
}
I did two things that may have had an impact, in the process of trying to debug what was going on I needed these further imports;
import java.util.Iterator;
import java.util.Map;
Although I'm not iterating over the hashMap, I've left them in in case which gives me the option of dumping the hashMap out to my system audit trail when application is in production. In variations of the snippet below after it started working I was able to get to any of the data I needed, even if the value was Null, and toString() also seemed to be optional again, as it made no difference to the output.
String cgiValue = "";
cgiValue = hmParam.get("ship_to_lastname").toString();
out.println("<br />Lastname: " + cgiValue);
out.println("<br />Company name: " + hmParam.get("bill_to_company"));
out.println("<br />First name: " + hmParam.get("ship_to_firstname"));
The second thing I did, while trying to get code to work was I enabled the option "Compile Java code with debugging information" for the agent, this may have done something to the way the project was built within the Domino Developer client.
I think I have to put this down to some sort of internal error created when Domino Designer compiled the code. I had a major crash last night while working on this which necessitated a cold boot of my laptop. You also may find that when using Domino Designer 8.5.x that strange things can happen if you don't completely close down all the tasks from time to time with KillNotes
My Companys website is compatible only with IE. So i cannot use IDE for recording webdriver scripts.
There are HTML pages which has about 100 or 200(not exact count) of textboxes and Dropdowns.
Writing java code to automate this is very much tedious.
Can someone provide me with tool or utility to read the HTML file itself and generate the corresponding code ?
Or guide me how to develop a utility to meet my need ?
For example :
Consider an html file like this
<html>
<body>
<input name = "employee_name" />
<select id = "designation">
<option value = "MD">MD</option>
<option value = "programmer"> Programmer </option>
<option value = "CEO"> CEO </option>
</option>
<body>
</html>
If i give this file as input to utility it will generate me a java file like this
WebDriver driver = new InternetExplorerDriver();
WebElement employee_name = driver.findElement(By.name("employee_name"));
employee_name.sendKeys("...");
Select designation = new Select(driver.findElement(By.id("designation")));
designation.selectByVisibleText("...");
Thanks in Advance !
You should be using "Selenium Builder" rather than "Selenium IDE", BUT, in theory, you could get all similar elements from a page in a group like so:
List<WebElement> bodyinputs = driver
.findElements( By.xpath("//div[#class='body']/input") );
List<WebElement> footeranchors = driver
.findElements( By.xpath("//div[#class='footer']/a") );
Then, for each of these groups, you can loop through the lists and use a JavaScriptExecutor to evaluate and figure out the XPath for each element and store the XPath in a hashtable with each Element:
protected String getXPath() {
String jscript = "function getPathTo(node) {" +
" var stack = [];" +
" while(node.parentNode !== null) {" +
" stack.unshift(node.tagName);" +
" node = node.parentNode;" +
" }" +
" return stack.join('/');" +
"}" +
"return getPathTo(arguments[0]);";
return (String) driver.executeScript(jscript, webElement);
}
Then, the final step, you can auto-generate "By locators" using the HashTable as input.
But even if you do that you still need to write code to intelligently figure out which By locators get which inputs and which ones don't.