Hi I am facing issue in cross origin requests at server side when trying to open file which is retrieved from database using java.I am unaware of this cross orgin requests.When file is clicked then it is giving error as
jquery.min.js:4 XMLHttpRequest cannot load file:///C:/Users/JR00432239/Desktop/trial/src/temp/filetest1.docx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Can anyone please help me to resolve this issue.
Here is my java code:
package fileretrieve;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import org.apache.tomcat.util.http.fileupload.IOUtils;
import dbConnection.Dbconn;
#MultipartConfig
public class FileRetrieve extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
String onelevel=request.getParameter("onelevel");
Connection conn = null; // connection to the database
String message = null;
Statement st = null;// message will be sent back to client
try {
// connects to the database
conn = Dbconn.getConnection();
st = conn.createStatement();
PreparedStatement ps=conn.prepareStatement("select data from files1 where board=?");
ps.setString(1,onelevel);
//out.print("<table width=25% border=1>");
// out.print("<center><h1>Result:</h1></center>");
ResultSet rs=ps.executeQuery();
/* Printing column names */
ResultSetMetaData rsmd=rs.getMetaData();
int count=0;
while(rs.next())
{
count=count+1;
FileOutputStream fos = new FileOutputStream("C:\\Users\\JR00432239\\Desktop\\trial\\src\\temp\\filetest"+count+".docx");
fos.write(rs.getBytes(1));
fos.close();
// out.print("<tr>");
// out.print("<td>"+rsmd.getColumnName(1)+"</td>");
// out.print("<td>"+count+"</td></tr>");
// getServletContext().getRequestDispatcher("/home.html").forward(request, response);
System.out.println("writing...");
response.getWriter().write("{\"name\":\""+count+"\",\"path\":\"C:/Users/JR00432239/Desktop/trial/src/temp/filetest"+count+".docx\"}");
}
// out.print("</table>");
//
}catch (Exception e2)
{
e2.printStackTrace();
}
finally{
// request.setAttribute("data", data);
// RequestDispatcher rd =request.getRequestDispatcher("userview.jsp");
//
out.close();
}
// forwards to the message page
// getServletContext().getRequestDispatcher("/home.html").forward(request, response);
}
}
Here is my html code:
Submit
Here is my javascript page:
$("#retrieve").click(function(){
$.ajax({
url : 'FileRetrieve',
method:"POST",
data : {
onelevel : $('#onelevel').val()
},
crossDomain: true,
success : function(responseText) {
var data=JSON.parse(responseText)
$("#files_data").html('')
$("#files_data").html('<table><tr><td><button onclick="getFile()">'+data.name+'</button></td></tr></table>')
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Status: " + textStatus); alert("Error: " + errorThrown);
}
});
return false;
});
If you're using chrome, as a simple solution try a chrome extention like Allow-Control-Allow-Origin:*
https://chrome.google.com/webstore/detail/nlfbmbojpeacfghkpbjhddihlkkiljbi?utm_source=chrome-app-launcher-info-dialog
if not fixed,
run chrome using command line with the flag
path/to/chrome.exe --allow-file-access-from-files
or just switch to firefox and check whether the issue is still there
this would be a quick-fix only in the development
EDIT
As far as I know, best thing you can do is make the files available in http server and access them using http protocol.
Related
This is my very first post here, so please don't blame me if I'm not as complete and clear as I have to be.
The issue
I am new to React native and I recently began to develop a react native app which could read my incoming SMS's aloud. I already achieved to retrieve the incoming messages and to read them aloud... But only if the app is the foreground.
So, could you please advise me some libraries or tutorials on the subject ?
I'm working on a Nokia 5 with Android 9.
I currently use the following libraries :
React-native-android-sms-listener to retrieve the incoming messages.
React-native-tts to read the content aloud.
What I already tried
I'm searching the Internet for more than a week now (includig Stack Overflow and this example question) and I can't find what I'm looking for. I already tried React-native-background-timer and React-native-background-job. But I couldn't never get a background timer working and React-native-background-job allows tasks to be executed every 15 minutes only (due to the Android limitations).
So I read many articles like this one explaining how to use Headless JS and other libraries until I found this codeburst tutorial today, explaining how to develop a background service to record audio calls. I tried to adapt it, but the background service never starts.
My code
I must tell you that I don't have any knowledge in Java, so the native code below may contain mistakes, even if it is based on tutorials and the React native documentation.
Currently, when the app is launched, the service IncomingSMSService is called. This service, developed following the Codeburst tutorial referenced above, relies on Headless JS and a JS function that listen to the incoming messages and then read them aloud thanks to React-native-tts.
Here is these two files :
IncomingSMSService.java
package com.ava.service;
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.HeadlessJsTaskService;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.jstasks.HeadlessJsTaskConfig;
public class IncomingSMSService extends HeadlessJsTaskService {
#Override
protected HeadlessJsTaskConfig getTaskConfig(Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null) {
return new HeadlessJsTaskConfig(
"HandleIncomingSMS",
Arguments.fromBundle(extras),
5000,
true
);
}
return null;
}
}
HandleIncomingSMS.js
import { AppRegistry } from 'react-native';
import SmsListener from 'react-native-android-sms-listener';
import Tts from 'react-native-tts';
const HandleIncomingSMS = async (taskData) => {
SmsListener.addListener(message => {
Tts.getInitStatus().then(() => {
Tts.speak(`New message from number ${message.originatingAddress} : ${message.body}`);
});
});
}
AppRegistry.registerHeadlessTask('HandleIncomingSMS', () => HandleIncomingSMS));
These pieces of code are called in a BroadcastReceiver here (IncomingSMSReceiver.java) :
package com.ava.receiver;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.ava.service.IncomingSMSService;
import com.facebook.react.HeadlessJsTaskService;
import java.util.List;
public final class IncomingSMSReceiver extends BroadcastReceiver {
#Override
public final void onReceive(Context context, Intent intent) {
if (!isAppOnForeground((context))) {
Intent service = new Intent(context, IncomingSMSService.class);
context.startService(service);
HeadlessJsTaskService.acquireWakeLockNow(context);
}
}
private boolean isAppOnForeground(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> appProcesses =
activityManager.getRunningAppProcesses();
if (appProcesses == null) {
return false;
}
final String packageName = context.getPackageName();
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
if (appProcess.importance ==
ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
appProcess.processName.equals(packageName)) {
return true;
}
}
return false;
}
}
I also requested the good permissions in my AndroidManifest file, and I registered the service like so :
<service
android:name="com.ava.service.IncomingSMSService"
android:enabled="true"
android:label="IncomingSMSService"
/>
<receiver android:name="com.ava.receiver.IncomingSMSReceiver">
<intent-filter android:priority="0">
<action android:name="android.provider.Telephony.SMS_RECEIVED"/>
</intent-filter>
</receiver>
What am I doing wrong ? I don't even see service in the Running services tab of the Android Developer options... Any ideas ?
Thanks in advance for your help.
UPDATE (01/06/2019)
After reading or watching several tutorials like this one or this video, I managed to get my app working in the foreground. It now displays a persistent notification.
BUT, I don't know how I can "link" my service and my Broadcsat Receiver to this notification (for now, the service is called only if the app is in foreground).
Here is my updated code :
// IncomingSMSService
package com.ava.service;
import android.graphics.Color;
import android.app.Notification;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.ContextWrapper;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import com.facebook.react.HeadlessJsTaskService;
import com.ava.MainActivity;
import com.ava.R;
public class IncomingSMSService extends Service {
private NotificationManager notifManager;
private String CHANNEL_ID = "47";
private int SERVICE_NOTIFICATION_ID = 47;
private Handler handler = new Handler();
private Runnable runnableCode = new Runnable() {
#Override
public void run() {
Context context = getApplicationContext();
Intent myIntent = new Intent(context, IncomingSMSEventService.class);
context.startService(myIntent);
HeadlessJsTaskService.acquireWakeLockNow(context);
handler.postDelayed(this, 2000);
}
};
#Override
public IBinder onBind(Intent intent) {
return null;
}
#Override
public void onCreate() {
super.onCreate();
createNotificationChannel();
}
#Override
public void onDestroy() {
super.onDestroy();
}
public void createNotificationChannel() {
NotificationChannel notificationChannel = new NotificationChannel(CHANNEL_ID, "General", notifManager.IMPORTANCE_HIGH);
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.RED);
notificationChannel.setShowBadge(true);
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
getManager().createNotificationChannel(notificationChannel);
}
#Override
public int onStartCommand(Intent intent, int flags, int startId) {
this.handler.post(this.runnableCode);
Intent notificationIntent = new Intent(this, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID)
.setContentTitle("Ava")
.setContentText("Listening for new messages...")
.setSmallIcon(R.mipmap.ic_launcher_round)
.setContentIntent(contentIntent)
.setOngoing(true)
.build();
startForeground(SERVICE_NOTIFICATION_ID, notification);
return START_NOT_STICKY;
}
private NotificationManager getManager() {
if (notifManager == null) {
notifManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
}
return notifManager;
}
}
My headlessJS task :
// HandleIncomingSMS.js
import SmsListener from 'react-native-android-sms-listener';
import Tts from 'react-native-tts';
import Contacts from 'react-native-contacts';
import { text } from 'react-native-communications';
module.exports = async () => {
// To lower other applications' sounds
Tts.setDucking(true);
// Prevent the TTS engine from repeating messages multiple times
Tts.addEventListener('tts-finish', (event) => Tts.stop());
SmsListener.addListener(message => {
Contacts.getAll((err, contacts) => {
if (err) throw err;
const contactsLoop = () => {
contacts.forEach((contact, index, contacts) => {
// Search only for mobile numbers
if (contact.phoneNumbers[0].label === 'mobile') {
// Format the contact number to be compared with the message.oritignatingAddress variable
let contactNumber = contact.phoneNumbers[0].number.replace(/^00/, '+');
contactNumber = contactNumber.replace(/[\s-]/g, '');
// Phone numbers comparison
if (contactNumber === message.originatingAddress) {
if (contact.familyName !== null) {
Tts.speak(`Nouveau message de ${contact.givenName} ${contact.familyName} : ${message.body}`);
} else {
// If the contact doesn't have a known family name, just say his first name
Tts.speak(`Nouveau message de ${contact.givenName} : ${message.body}`);
}
} else if (contactNumber !== message.originatingAddress && index === contacts.length) {
// If the number isn't recognized and if the contacts have been all checked, just say the phone number
Tts.speak(`Nouveau message du numéro ${message.originatingAddress} : ${message.body}`);
}
}
});
}
contactsLoop();
// Redirect to the SMS app
text(message.originatingAddress, message = false);
});
});
}
I also added the good permissions in my AndroidManifest.xml file like the following :
...
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
...
I made some progress but I am still stuck, so if you have any idea, please share them ! Thank you !
After I click submit button, my form and page refreshes, and nothing is sent to datebase.
Code in subforum.js
$(document).on('click','#submit',function(e) {
var user = JSON.parse(sessionStorage.getItem("ulogovan"));
console.log("usao u submit");
alert("Usao");
var dataObject = JSON.stringify({
'title': $('#titleSubforum').val(),
'description': $('#descriptionSubforum').val(),
'iconPath': $('#pictureSubforum').val(),
'mainModerator': user.username,
'rules': $('#rulesSubforum').val()
});
alert($('#rulesSubforum').val());
$.ajax({
type : 'POST',
url : "../WebProjekat/rest/subforums/create",
contentType : 'application/json',
dataType : "json",
data: dataObject,
success : function(data) {
console.log("USAO U CUVANJE ");
alert("all good");
window.location.href = "index.html";
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
alert("something wrong");
console.log(textStatus);
console.log(user);
}
});
});
code in SubforumController.java
package controllers;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import beans.Subforum;
import services.SubforumService;
#Path("/subforums")
#Consumes(MediaType.APPLICATION_JSON)
#Produces(MediaType.APPLICATION_JSON)
public class SubforumController {
private SubforumService subforumService = new SubforumService();
#GET
public List<Subforum> getSubforums() {
return subforumService.getAllSubforums();
}
#POST
#Path("/create")
public Subforum createSubforum(Subforum subforum) {
System.out.print(subforum.getTitle());
return subforumService.createSubforum(subforum);
}
And code in SubforumService.java
package services;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import datebase.DatebasePath;
import beans.Subforum;
public class SubforumService {
public SubforumService() {
}
private Map<String, Subforum> subforums = DatebasePath.getSubforums();
public Subforum createSubforum(Subforum subforum) {
subforums.put(subforum.getTitle(), subforum);
DatebasePath.saveData(DatebasePath.subforumsPath);
return subforum;
}
public List<Subforum> getAllSubforums() {
return new ArrayList<Subforum>(subforums.values());
}
}
DatebasePath is good, becouse I hardcoded subforum object, and writed down to .txt file. I think that problem is between subforum.js and SubforumController.java
After I click submit button, my form and page refreshes
this is frequently caused by the form post ocuring rather than your custom $.ajax POST code.
and nothing is sent to database.
As $.ajax POST occurs asynchronously, the form's post occurs first, refreshing your page and thus not hitting your own submit handler.
There are two relatively easy options for this:
e.preventDefault in the handler
eg
$(document).on('click','#submit',function(e) {
e.preventDefault();
// remaining code
don't submit on the button
Change
<input type='submit' id='submit'>submit</input>
to
<input type='button' id='submit'>submit</input>
I want to convert byt[] to image in client side. I have tried the below code but it isn't working. I receive the data1 value but not able to convert it to image.
Client Side :
function getPic(name) {
$.post("/Chat/ProfliePic", {
name : name+".png"
}, function(data1, status) {
alert(data1);
$("#profImg").attr("src","data:image/png;base64," + data1);
});
}
Server Side :
package servlets;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
#WebServlet("/ProfliePic")
public class ProfliePic extends HttpServlet {
private static final long serialVersionUID = 1L;
public ProfliePic() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name=request.getParameter("name");
File f = new File("/Users/shilu/MyProject/Chat/Photo/" + name);
byte[] data = new byte[(int) f.length()];
DataInputStream in = new DataInputStream(new java.io.FileInputStream(f));
in.readFully(data);
in.close();
response.setContentType("image/png");
ServletOutputStream out = response.getOutputStream();
out.write(data);
out.flush();
out.close();
}
Please tell me where I went wrong...
package controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gson.Gson;
import com.sun.corba.se.spi.orbutil.fsm.Action;
import bean.Video;
import dao.Dao;
import daoimpl.daoImpl;
public class DisplayVideo extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Dao dao=new daoImpl();
String action=request.getParameter("action");
if(action.equals("display")){
ArrayList<Video>al=dao.getAllVideo();
//PrintWriter pw=response.getWriter();
Gson gson=new Gson();
String json = gson.toJson(al);
System.out.println(json);
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
response.getWriter().write(json);
}
}
}
This is my servlet where im getting data in json format.
<html>
<head>
<script type="text/javascript" src='js/jquery.min.js'></script>
<script type='text/javascript'>
$(document).ready(function() {
alert("on document ready");
$('#video').click(function(event) {
alert("on click");
$.post("Controller?action=display",
function (data) {
alert("key"+data);
var json = data;
alert("value"+json);
$.each(json, function(key,value) {
alert("key1"+value);
var v ="<a href=${pageContext.request.contextPath}/videos/"+value.videoUrl+"target='blank'>"+value.videoUrl+"</a>";
$(v).appendTo($content);
});
});
});
});
</script>
</head>
<body>
<div id='content'>
<button id="video">Play</button>
</div>
</body></html>
This my sucess.jsp file from here control goes to servlet and get data in json format from database i have only save video name c.mp4,java.mp4 and cpp.mp4 in database also i have create a folder named videos in my webcontent folder in my project and save videos in that folder also.Response getting properly but after printing alert inside each their is nothing print on screen.my requirment is print that all names of video and onclick of link play video in iframe or in popup window.please help me i didnt know the tags which are used.Thanks in Advance.
I am trying to create a java program that retrieves a METARs from the stations like this:
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class metar{
public static void main(String[] args) throws IOException {
URL aURLGlobal=null;
Document doc;
String fichier ="stations.txt";
try {
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
// need http protocol
String ligne;
while ((ligne=br.readLine())!=null){
URL aURL = new URL( "https://www.aviationweather.gov/adds/metars/?station_ids="+ligne+"&std_trans=standard&chk_metars=on&hoursStr=most+recent+only&submitmet=Submit");
// System.out.println("******************city num"+aURL.toString()+"**************************");
doc = Jsoup.connect(aURL.toString()).get();
String element= doc.select("FONT").first().ownText();
System.out.println(element);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
stations.txt :
LSGG
LFMD
LFMN
LFQB
LFMK
LFCR
LFML
LFMI
LFMY
LFRK
result :
LSGG 201620Z 22018KT 7000 -RA FEW014 SCT025 OVC045 13/10 Q1010 TEMPO 4000 RA BR
LFMD 201600Z AUTO 23017G28KT 200V280 CAVOK 18/10 Q1008
LFMN 201600Z 07015KT CAVOK 17/12 Q1007 TEMPO WS ALL RWY
LFQB 201600Z AUTO 32006KT 9999 -RA BKN004/// BKN035/// BKN042/// ///TCU 08/08 Q1005
LFMK 201600Z AUTO 28015KT 240V300 CAVOK 20/03 Q1018
LFCR 201600Z AUTO 25015KT 9999 OVC018 13/10 Q1018
LFML 201530Z 25017KT CAVOK 17/10 Q1016 NOSIG
LFMI 201600Z AUTO 29014KT CAVOK 17/09 Q1016
LFMY 201600Z AUTO 28012KT 250V310 CAVOK 17/09 Q1016
LFRK 201600Z AUTO 29012KT 9999 BKN036 OVC044 09/08 Q1009
I am now looking to parse a json file METARs,
I found a metar.js script to parse any metar
http://epeli.github.io/metar.js/
My question is (I do not know too in json): did i can use it to parse all of my METARs and copied in one json file, that is to say call the file parser.js from java.
someone can help me please..
Edit :
THANKS A LOT FOR YOUR IDEA
CODE:
package tests;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class test {
public static void main(String[] args) throws IOException, ScriptException, NoSuchMethodException {
URL aURLGlobal=null;
Document doc;
String fichier ="stations.txt";
try {
InputStream ips=new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(ips);
BufferedReader br=new BufferedReader(ipsr);
// need http protocol
String ligne;
while ((ligne=br.readLine())!=null){
URL aURL = new URL( "https://www.aviationweather.gov/adds/metars/?station_ids="+ligne+"&std_trans=standard&chk_metars=on&hoursStr=most+recent+only&submitmet=Submit");
// System.out.println("******************city num"+aURL.toString()+"**************************");
doc = Jsoup.connect(aURL.toString()).get();
String element= doc.select("FONT").first().ownText();
System.out.println(element);
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("JavaScript");
// read script file
engine.eval(Files.newBufferedReader(Paths.get("C:\\metar.js"), StandardCharsets.UTF_8));
Invocable inv = (Invocable) engine;
// call function from script file
inv.invokeFunction("parseMETAR", element);
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}}
error :
LSGG 201620Z 22018KT 7000 -RA FEW014 SCT025 OVC045 13/10 Q1010 TEMPO 4000 RA BR
Exception in thread "main" java.lang.NoSuchMethodException: No such function parse
at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:197)
at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:381)
at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:187)
at tests.test.main(test.java:52)
as I told you, json is a black box for me, it is the parse function to be used in metar.js, and I put my metar parameter recevid from the previous step,
Thanks for your help