Grupos de Google ya no admite publicaciones ni suscripciones nuevas de Usenet. El contenido anterior sigue visible.

crash with java.lang.NoSuchMethodError:

5 vistas
Ir al primer mensaje no leído

Alan Porter

no leída,
18 dic 1997, 3:00:00 a.m.18/12/97
para

Does anyone have an insight into the following problem or can direct me
to someone that might?
Thanks,
Alan

I have a problem with a Java application (not applet) running on a Sun
system. This application runs
just fine under win32 where it was developed. I suspect that either I'm
missing something fundamental
or there is something special that motif needs in this case. As far a I
can discern there are no
obvious defects in the code. Below are the crash dumps and a snipet of
the code that was doing the
work.

The application has a main UI thread and an extra worker thread doing
some work reading unrelated
files while this crash occurs.


Facts:
The program was compiled and is running on the following equipment:
JDK 1.1.3 running on SUN Ultra-1 "Ultra Ax" ,Solaris 5.5.1 512MB
ram

The program works as specified but intermittently crashes in one of the
following situations.


1) The user has just pressed a button to bring up a text dialog that has
a single text edit control and two
buttons. As the dialog starts to initialize I get the following error:

java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.lang.StringBuffer: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)

2) After the dialog comes up another crash occurs intermittently when
the user scrolls through the text in
the edit control using the scroll bar on the edge of the window (there
must be more than one page of
text). The following error occurs:


java.lang.NoSuchMethodError: java.awt.event.MouseEvent: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.awt.event.MouseEvent: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)
java.lang.NoSuchMethodError: java.awt.event.MouseEvent: method
postEvent(Ljava/awt/AWTEvent;)V not found
at sun.awt.motif.ModalThread.run(MDialogPeer.java:147)


Often the entire Java system is brought down (but not always). The
following is an abreviated dialog class and
an example of the client code that envokes the dialog class:

////////////////////////////////////////////////////////////////////////////////////////////////////

//Example Client Class code: This class invokes the error dialog based
on a button press from a parent dialog
//
//class WindowActionClass implements java.awt.event.ActionListener
//{
// public void actionPerformed(java.awt.event.ActionEvent event)
// {
// Object object = event.getSource();
// if (object == m_menuAbout)
// {
// About_Action(event);
// return;
// }
// else if (object == m_menuFile)
// {
// Exit_Action(event);
// return;
// }
//
// //Got a button action?
// if
(object.getClass().getName().equalsIgnoreCase("java.awt.button")==true)
// { //yes
// Button obj = (Button) object;
// MachinePanel machObj = (MachinePanel)
obj.getParent(); ;
//
// //Pressing the Stop button?
// if (obj.getLabel().equals("Stop") ) {
//
// //We ignore the abort return value and make the
panel accessible again anyway
// abortScript(machObj);
// obj.setLabel("Start");
// return;
// }
//
// //Pressing the Start button?
// if (obj.getLabel().equals("Start") )
// {
// //Successfull launch?
// if (startupScript(machObj) == true)
// { //yes
// obj.setLabel("Stop");
// }
// return;
// }
//
// //Pressing the Error Log button?
// if (obj.getLabel().equals("Error Log") )
// {
// //Bring up the error log dialog
// ErrorLogDialog errorBox = new
ErrorLogDialog(MasStart.this /* parent */,
//
true); /* Modal */ ,
// errorBox.showDialog();
// errorBox=null;
// return;
// }
// }
// }
//}

/*
//////////////////////////////////////////////////////////////////////
File : ErrorLogDialog.java
Compiler : Java 1.1.5
Programmer: Alan Porter
Description: A basic extension of the java.awt.Dialog class which
displays a set of error files. Code has been cut from
a working class for this email and is not fully
functional
*/
//////////////////////////////////////////////////////////////////////

import java.awt.*;
import java.util.*;
import java.io.*;
import java.lang.*;
import MasStart.*;

/////////////////////////////////////////////////////////////////////////

public class ErrorLogDialog extends Dialog {


/////////////////////////////////////////////////////////////////////////

public ErrorLogDialog(MasStart parent ,
boolean modal )
{
super(parent, modal);
int nIndex;

setLayout(null);

setSize(getInsets().left + getInsets().right +
726,getInsets().top + getInsets().bottom + 582);
//m_label1 = new java.awt.Label(title);
//m_label1.setBounds(getInsets().left +
48,getInsets().top + 12,166,21);
//add(m_label1);
m_cancelButton = new java.awt.Button("Close");
m_cancelButton.setBounds(getInsets().left +
264,getInsets().top + 516,66,36);
add(m_cancelButton);
m_logMessage = new java.awt.TextArea();
m_logMessage.setBounds(getInsets().left +
48,getInsets().top + 36,660,468);
add(m_logMessage);

//open error files and fill the TextArea control
m_logMessage.setText( readFiles() );
m_logMessage.setColumns(80);

m_saveAsButton = new java.awt.Button("Save as File...");

m_saveAsButton.setBounds(getInsets().left +
384,getInsets().top + 516,156,36);
add(m_saveAsButton);
setTitle("Log Files: " + machObj.getSUTString());
setResizable(false);

//Create a window and action listener
m_WinListener = new WindowListenClass();
m_ActionListener = new CntlActionListenClass();
//Register the window listener with this dialog
this.addWindowListener(m_WinListener);
//Register the action listener with each button

m_cancelButton.addActionListener(m_ActionListener);
//Register this action listern locally
m_saveAsButton.addActionListener(m_ActionListener);
}

/////////////////////////////////////////////////////////////////////////

//Reads the error logs, concatenates them, and returns a String
containing
//all three (if they exist).
public String readFiles()
{
String buffer = new String("");
String line;
String openFileString;
openFileString = "somefile.somewhere";

if (openFileString != null)
{
try
{
//ORG: DataInputStream fileIn = new DataInputStream(new
FileInputStream(openFileString));
BufferedReader fileIn = new BufferedReader(new
InputStreamReader(new FileInputStream(openFileString)));

buffer += "FILE: ";
buffer += openFileString;
buffer += "\n";

//read contents of error log
while ((line = fileIn.readLine()) != null )
{
buffer += line;
buffer += "\n";
}

buffer +=
"-----------------------------------------------------------------------------\n";

fileIn.close();
}
catch (IOException e)
{
//problem
}
}


return buffer;
}


/////////////////////////////////////////////////////////////////////////

public synchronized void showDialog() {
Rectangle bounds = getParent().getBounds();
Rectangle abounds = getBounds();

setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
bounds.y + (bounds.height - abounds.height)/2);

super.setVisible(true);
}

//////////////////////////////////////////////////////////
private class WindowListenClass extends java.awt.event.WindowAdapter

{
//////////////////////////////////////////////////////////
public void windowClosing(java.awt.event.WindowEvent event)
{
Object object = event.getSource();
//Is this dialog closing?
if (object == ErrorLogDialog.this)
{ //yes
setVisible(false);
dispose(); //This dialog is not
persistant in this application
}
}
}


//////////////////////////////////////////////////////////
private class CntlActionListenClass implements
java.awt.event.ActionListener
{
//////////////////////////////////////////////////////////
public void actionPerformed(java.awt.event.ActionEvent
event)
{
Object object = event.getSource(); //Get source
of this action
//Was it the button on the dialog
if (object == m_cancelButton)
{ //yes
setVisible(false);
dispose();
}
if (object == m_saveAsButton)
{
saveAsButton_Clicked(event);
}

}
}

////////////////////////////////////////////////////////////////////////

// Creates a file 'save as' dialog and saves the contents of the
log
void saveAsButton_Clicked(java.awt.event.ActionEvent event) {
String directory;
String filename;
String message = m_logMessage.getText();
m_openFileDialog = new java.awt.FileDialog( (Frame)
getParent(),"Save",FileDialog.SAVE);
m_openFileDialog.setVisible(true);

filename = m_openFileDialog.getFile();
directory = m_openFileDialog.getDirectory();

if (filename == null)
{
return;
}

//finish constructing the full path to the selected file
directory += filename;

//Write log out
try {
FileOutputStream fileOut = new
FileOutputStream(directory);
fileOut.write( message.getBytes() );
fileOut.close();
}
catch (IOException e) {
//problem
}
}


///////////////////////////////////
/// Member Variables
//////////////////////////////////

private FileDialog m_openFileDialog = null;
private WindowListenClass m_WinListener;
private CntlActionListenClass m_ActionListener;

java.awt.Button m_cancelButton;
java.awt.TextArea m_logMessage;
java.awt.Button m_saveAsButton;
}


0 mensajes nuevos