I have a table with many, many fields. When trying to insert data with jt400 (flei00.write(newrec);) I get error CPF5035 Data mapping error on member FLEI00.. Even when trying to insert empty or nearly empty record, the error message is the same. Is there a way to get know, which field is causing the problem? I've been fighting with it a whole day and have no more idea what to check :-(. Any help (e.g. where to look for more info) will be appreciated.
On IBM i, the job log is THE place to find details about errors occurring in a given job. In the case of JT400 jobs, the JT400 app connects via sockets to a server job. Typically, there are a bunch of these jobs 'prestarted', waiting for a connection. This can be difficult to navigate if you're not accustomed to the 5250 interface.
Here's a JT400 program that gets the job log messages for you. If you run this in the same session that you are getting the error in you should see the details about what field is causing the issue.
import java.util.*;
import com.ibm.as400.access.*;
public class TestJobLog {
public static void main(String[] args) {
int i = 0;
try {
AS400 system = new AS400();
JobLog jobLog = new JobLog(system);
// what attributes?
jobLog.clearAttributesToRetrieve();
jobLog.addAttributeToRetrieve(JobLog.MESSAGE_WITH_REPLACEMENT_DATA);
jobLog.addAttributeToRetrieve(JobLog.MESSAGE_HELP_WITH_REPLACEMENT_DATA);
// load the messages
jobLog.load();
// Create a list and subset it
Enumeration list = jobLog.getMessages();
System.out.println("There are " + Integer.toString(jobLog.getLength()) + " messages.");
while (list.hasMoreElements()) {
i++;
QueuedMessage message = (QueuedMessage) list.nextElement();
String text = message.getID() +
" " + message.getType() +
" " + message.getText() + "\n" +
" " + message.getMessageHelpReplacement() + "\n";
System.out.println(Integer.toString(i) + " " + text);
}
jobLog.close();
System.exit(0);
} catch (Exception e) {
System.out.println(e);
}
}
}
Related
We have a chat application which is using Smack, XMPP, ejabberd. I'm wondering if it's possible to achieve something like below:
A chat is open between 2 users.
User1 is typing some message.
User2 is able to see the message typed by User1 as he types it.
I have done a bit of research but couldn't find anything related.
Please let me know how to achieve this use case.
Thanks in advance!
That is not possible. You can send the text as user types but each piece will go as independent message. If you want that one you might want to have your own way to do so. XMPP have no way to do so!
With Smack it is easy, whenever the user changes the text you send a typing stanza to the other person using the ChatStateExtension:
private void sendTypingStatus(final String toJid) {
//you must have a valid xmpp connection of course
if (null == mConnection)
return;
try {
Message message = new Message(JidCreate.from(toJid));
message.addExtension(new ChatStateExtension(ChatState.composing));
message.setType(Message.Type.chat);
mConnection.sendStanza(message);
} catch (InterruptedException | SmackException.NotConnectedException | XmppStringprepException ex) {
Log.w(TAG, "sendTypingStatus error", ex);
}
}
The other person should be prepared to receive the stanza and use it correctly. The best option is to use ChatStatesStanzaListener for that:
public class ChatStatesStanzaListener implements StanzaListener {
private static final String TAG = ChatStatesStanzaListener.class.getSimpleName();
#Override
public void processStanza(Stanza packet) {
Message message = (Message) packet;
if (message.hasExtension(ChatStateExtension.NAMESPACE)) {
ChatStateExtension chatStateExtension = (ChatStateExtension) message.getExtension(ChatStateExtension.NAMESPACE);
ChatState chatState = chatStateExtension.getChatState();
String fromJid = message.getFrom().asBareJid().toString();
if (message.getType().equals(Message.Type.chat)) {
Log.v(TAG, "got chat state " + fromJid + " " + message.getType() + " " + chatState);
//you got youe information here, call a callback or broadcast an event, whatever
} else if (message.getType().equals(Message.Type.groupchat)) {
//out of your question
}
}
}
}
Don't forget to add the stanza listener to your xmpp connection once it's established:
1. Set the stanza filter:
// set up a stanzalistener and filter chatstates messages only
StanzaFilter chatStatesStanzaFilter = stanza -> {
// filter for chatstates message only
return stanza.hasExtension(ChatStateExtension.NAMESPACE);
};
Use it once you initialize the xmpp connection:
mConnection.addAsyncStanzaListener(new ChatStatesStanzaListener(), chatStatesStanzaFilter);
I hope it helps :)
I'm working on a Kinvey project right now, and I'm having some Problems with reading the Username or special Attributes from a User instance. I first tried it the same way getting _User.ID by calling _User.UserName, but this didnt return anything(But ID did curiously). I also searched on Google, but there weren't any articles about it. Hope you can help, would be greatly appreciated!
For special attributes, use the .Attributes array on the User class.
Like this code:
Console.WriteLine ("custom attribute is: " + kinveyClient.User ().Attributes["myAttribute"]);
For username, try .UserName() but it seems you must do an explicit retrieval of the User object before this field is populated
User retrieved;
try {
retrieved = await kinveyClient.User().RetrieveAsync();
} catch (Exception e) {
Console.WriteLine("{0} caught exception: ", e);
retrieved = null;
}
Console.WriteLine ("logged in as: " + retrieved.Username );
Console.WriteLine ("custom attribute is: " + retrieved.Attributes["myAttribute"]);
Documentation: http://devcenter.kinvey.com/xamarin/guides/users#UserClass
(answer applies to SDK version 1.6.11)
I have created a simple SOAP web service for a remote DB which is working fine in WebLogic 12c server and also in Jdeveloper HTTP analyzer. When I am using the same web service in the code below, I am getting the following error (I have included the System.out.println outputs in ref. to the flow of the code) I am using Jdeveloper 12C MAF 2.0.0.0.41 on Mac OSx 10.9.
Chk #0
Processing row# 1
Chk #1
Chk #2
[SEVERE - oracle.adfmf.framework - AmxBindingContext - loadDataControlById] Unable to read DataControl Usages, on loadDataControl for id: WLFNewActWS.
[SEVERE - oracle.adfmf.framework - SynchronizationDC - syncDataFromOfflineToOnline] [Ljava.lang.StackTraceElement;#467c53d3
public void syncDataFromOfflineToOnline() {
Trace.log(Utility.FrameworkLogger, Level.INFO, this.getClass(), "syncDataFromOfflineToOnline",
"Executing syncDataFromOfflineToOnline Method");
try {
Connection conn = DBConnectionFactory.getConnection();
conn.setAutoCommit(false);
String select = "SELECT * FROM DEPARTMENTS";
PreparedStatement pStmt = conn.prepareStatement(select);
ResultSet rs = pStmt.executeQuery();
System.out.println("Chk #0");
int rowcount = 0;
while (rs.next()) {
rowcount++;
System.out.println("Processing row# " + rowcount);
List namesList = new ArrayList(1);
List paramsList = new ArrayList(1);
List typesList = new ArrayList(1);
Department dept = new Department();
dept.setDeptId(rs.getInt("DEPARTMENT_ID"));
dept.setDeptName(rs.getString("DEPARTMENT_NAME"));
dept.setMgrId(rs.getInt("MANAGER_ID"));
dept.setLocId(rs.getInt("LOCATION_ID"));
System.out.println("Chk #1");
GenericType gtDept =
GenericTypeBeanSerializationHelper.toGenericType("WLFNewActWS.Types.persistDepartments.arg0", dept);
System.out.println("Chk #2");
namesList.add("arg0");
paramsList.add(gtDept);
typesList.add(GenericType.class);
AdfmfJavaUtilities.invokeDataControlMethod("WLFNewActWS", null, "persistDepartments", namesList,
paramsList, typesList);
System.out.println("Chk #3");
}
} catch (SQLException e) {
Trace.log(Utility.FrameworkLogger, Level.SEVERE, this.getClass(), "syncDataFromOfflineToOnline",
e.getMessage());
} catch (Exception e) {
Trace.log(Utility.FrameworkLogger, Level.SEVERE, this.getClass(), "syncDataFromOfflineToOnline",
e.getStackTrace());
}
}
This may not be the answer to this question, but it may be the answer for someone searching for "Unable to read DataControl Usages, on loadDataControl for id"
In my case it is with Oracle MAF, but this also applies to Oracle ADF.
Your web service needs to be in your DataBindings.cpx file.
Something like:
<dataControlUsages>
<dc id="WLFNewActWS " path="mobile.WLFNewActWS "/>
</dataControlUsages>
I cheat and drag something from the WS into a one of pages and have jdeveloper add the record in DataBindings.cpx for me.
This occurs of the binding issue. Please create a reference/binding to 'WLFNewActWS' in your amx page. It will solve your problem...!
I want to design a web project, when users upload file to hadoop hdfs,users can see their upload status via web. Is there any simple java api?
Can anyone help?
Right now I only know the way,how to use api to upload file to hdfs.
public synchronized static void upload(FileSystem fs, String local,
String remote) {
// Path home = fs.getHomeDirectory();
Path workDir = fs.getWorkingDirectory();
Path dst = new Path(workDir + "/" + remote);
Path src = new Path(local);
try {
fs.copyFromLocalFile(false, true, src, dst);
log.info("upload " + local + " to " + remote + " successed. ");
} catch (Exception e) {
log.error("upload " + local + " to " + remote + " failed :"
+ ExceptionUtils.getFullStackTrace(e));
}
}
You might find FileStatus class useful. Through this class you can get almost all the necessary information which your user might wanna know, like getting the access time of the file, modification time of the file, length of the file etc etc.
And, since you are talking about a web app, I would recommend you to have a look at the WebHDFS REST API. It allows you to submit a GET HTTP request which will send a FileStatus JSON object in response. You could then easily use this JSON object to present the status to your user through a web page.
HTH
In JavaFx I can attach a listener to the load worker for a webEngine like this:
webEngine.getLoadWorker().stateProperty().addListener(
new ChangeListener<Worker.State>() {
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) {
System.out.println("webEngine result "+ newState.toString());
}
});
However if I try to load a document at an https address such as:
https://SomeLocalMachine.com:9443/jts/admin#action=com.ibm.team.repository.manageUsers
all I get printed out on the console is:
webEngine result READY
webEngine result SCHEDULED
webEngine result RUNNING
webEngine result FAILED
(The same https address in Firefox or Chrome gets me a login page)
Does anyone know how I can get more detailed reports out of the JavaFx WebEngine. I don't want to just know that it failed - I need to know why. I can guess my error is SSL/certificate/HTTPS related but currently I'm quite in the dark as to which part of SSL caused it to 'FAIL'
You can use com.sun.javafx.webkit.WebConsoleListener. Downside is that it is JRE internal API.
WebConsoleListener.setDefaultListener(new WebConsoleListener(){
#Override
public void messageAdded(WebView webView, String message, int lineNumber, String sourceId) {
System.out.println("Console: [" + sourceId + ":" + lineNumber + "] " + message);
}
});
The best we ever got was:
if (webEngine.getLoadWorker().getException() != null && newState == State.FAILED) {
exceptionMessage = ", " + webEngine.getLoadWorker().getException().toString();
}
but that didn't help.
(Our error was caused by a missing CookieStore, it seems you don't get one for free - and have to set a default one: http://docs.oracle.com/javase/7/docs/api/java/net/CookieHandler.html)
Have you tried the following:
engine.getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() {
#Override
public void changed(ObservableValue<? extends Throwable> ov, Throwable t, Throwable t1) {
System.out.println("Received exception: "+t1.getMessage());
}
});