Exception in thread "main" java.lang.NoSuchMethodError: main (Error)
Hello,
I'm new to learning Java and I'm receiving the following error message whenever I try to run the following program. Can someone help?
//code
class Books {
String title;
String author;
class BooksTestDrive {
public static void main(String [] args) {
Books [] myBooks = new Books[3];
int x = 0;
myBooks[0] = new Books();
myBooks[1] = new Books();
myBooks[2] = new Books();
myBooks[0].title = "The Grapes of Java";
myBooks[1].title = "The Java Gatsby";
myBooks[2].title = "The Java Cookbook";
myBooks[0].author = "bob";
myBooks[1].author = "sue";
myBooks[2].author = "ian";
while (x < 3) {
System.out.print(myBooks[x].title);
System.out.print(" by ");
System.out.println(myBooks[x].author);
x = x + 1;
//end of code
Thanks,
H
1.) Use the code button when posting your code, it makes it more readable.
2.) You should have posted the error message in the text as well, it's slightly confusing this way.
NoSuchMethodError means that Java wanted to invoke a method that's not there. In this case it's called "main". So you tried to run a Java class that does not have a main method. How did you try to run your Program (exact command, please)?
Similar Messages
-
Exception in thread "Command" java.lang.NoSuchMethodError
Post Author: carolinabc
CA Forum: JAVA
Hi.I found that the problem is solved placing the libraries
ReportViewer.jar and jrcerom.jar at the top of the classpath.For
example:<?xml version="1.0" encoding="UTF-8"?>
<classpath><classpathentry kind="src"
path="src"/><classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/><classpathentry kind="lib"
path="lib/ReportViewer.jar"/><classpathentry kind="lib"
path="lib/jrcerom.jar"/><classpathentry kind="lib"
path="lib/commons- collections-3.1.jar"/><classpathentry kind="lib"
path="lib/commons-configuration-1.2.jar"/>
</classpath>
I hope you understand me, becose I don't speak english.
Regards
CAROLINAPost Author: partha.contact
CA Forum: JAVA
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Error loading C:/bea/weblogic81/samples/domains/workshop/cgServer/.wlnotdelete/extract/cgServer_TestingWeb_TestingWeb/TestingWeb.war!/../WEB-INF/TableGrid_KO.rpt -
Error code:-2147215356 Error code name:fileNotOpened,
The .rpt file is located in the /WEB-INF folder. why it is not opened? This is a common type error i have seen in other forum. I have followed the online help but getting this error. Please suggest me how to handle this exception.
<%@ page language="java" contentType="text/html;charset=UTF-8"%><%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%><%@ taglib uri="netui-tags-html.tld" prefix="netui"%><%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%><%@ taglib uri="/crystal-tags-reportviewer.tld" prefix="crviewer"%><%@ page import="com.crystaldecisions.sdk.occa.report.lib.*"%><html> <head> <title>Bandwidth Report page </title> </head> <body> <p> <crviewer:viewer viewerName="TableGrid_KO" reportSourceVar="_TableGrid_KO" reportSourceType="reportingComponent"> <crviewer:report reportName="../WEB-INF/TableGrid_KO.rpt"></crviewer:report> </crviewer:viewer>on Page
</p> <jsp:include page="TableGrid_KO.rpt"/> </body></html>
Please give me some solution, its very urjent, tomorrow is deadline. My mail ID [email protected] -
Program Compiles, but Exception in thread "main" error is thrown
Hello everybody,
I am getting the following error when I try to run my program. It compiles fine, but a Exception in thread "main" error is given when I try to run the program. This is the full error:
Exception in thread "main" java.lang.Error: Do not use KonnectHelpdeskFrame.add(
) use KonnectHelpdeskFrame.getContentPane().add() instead
at javax.swing.JFrame.createRootPaneException(JFrame.java:446)
at javax.swing.JFrame.addImpl(JFrame.java:472)
at java.awt.Container.add(Container.java:298)
at KonnectHelpdesk.main(KonnectHelpdesk.java:15)
Press any key to continue . . .The code that I beleive contributes to the error is below. I'm not sure what is causing the problem, so any help will be greatly appreciated. Thanks.
class VoiceMailEntryDialog extends JDialog
public VoiceMailEntryDialog(JFrame owner)
super(owner, "New Voicemail Entry", true);
Container contentPane = getContentPane();
GridBagLayout layout = new GridBagLayout();
contentPane.setLayout(layout);
JLabel numberLabel = new JLabel("Phone Number: ");
JLabel dayCalledLabel = new JLabel("Day Customer Called: ");
JLabel timeCalledLabel = new JLabel("Time Customer Called: ");
JLabel firstNameLabel = new JLabel("First Name: ");
JLabel lastNameLabel = new JLabel("Last Name: ");
JLabel messageLabel = new JLabel("Message: ");
JTextField phoneNumber = new JTextField(20);
JTextField firstName = new JTextField(20);
JTextField lastName = new JTextField(30);
JTextArea message = new JTextArea(8, 30);
message.setLineWrap(true);
message.setBorder(BorderFactory.createEtchedBorder());
JComboBox dayCalled = new JComboBox(new String[]
"Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday"
JComboBox timeCalled = new JComboBox(new String[]
"9:30am - 9:59am", "10:00am - 10:59am", "11:00am - 11:59am", "12:00pm - 12:59pm",
"1:00pm - 1:59pm", "2:00pm - 2:59pm", "3:00pm - 3:59pm", "4:00pm - 4:59pm",
"5:00pm - 5:59pm", "6:00pm - 6:59pm", "7:00pm - 7:59pm", "8:00pm - 8:59pm",
"9:00pm - 9:59pm", "10:00pm - 9:29am"
ActionListener noMsgListener = new NoMessageChecked();
JCheckBox noMessageCheckbox = new JCheckBox("Left no message");
noMessageCheckbox.addActionListener(noMsgListener);
JButton ok = new JButton("OK");
ok.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent evt)
setVisible(false);
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent evt)
setVisible(false);
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.weightx = 0;
constraints.weighty = 0;
add(numberLabel, constraints, 0, 0, 1, 1);
add(dayCalledLabel, constraints, 0, 2, 1, 1);
add(timeCalledLabel, constraints, 0, 4, 1, 1);
setSize(400, 700);
public void add(Component c, GridBagConstraints constraints, int x, int y, int w, int h)
constraints.gridx = x;
constraints.gridy = y;
constraints.gridwidth = w;
constraints.gridheight = h;
getContentPane().add(c, constraints);
private class NoMessageChecked implements ActionListener
public void actionPerformed(ActionEvent event)
}atmguy,
Thanks. It turns out the the line that was causing the problem was in the error message. I guess it helps to pay attention. You are correct in what the line says and changing it made the program run, but caused some other minor problems that I'll work out later. Thanks again for you help.
jerryrika -
Exception in thread "DoSManager" java.lang.OutOfMemoryError: nativeGetNewTLA
Hi,
We are facing this 'Exception in thread "DoSManager" java.lang.OutOfMemoryError: nativeGetNewTLA' exception in our production logs. Our JVM as part of WebLogic Server is BEA JRockit(R) Version R27.6.5-32_o-121899-1.6.0_14 and linux-x86_64.
This is how our JVM is configured:
a. Stack size(-Xss)
--This is not configured
b. Heap size
---Xms2048m -Xmx2048m
c. XXtlasize
---This is not configured
d. XXlargeobjectlimit
---This is not configured too
As I understand if we don't configure above parameters then default values will be considered. Our concern is whenever this exception occurs our application crashes obviously because JVM is not able to execute the code because of insufficient memory. Do we need to tune our JVM or do we need to fix issues in our code? My next task is actually to do the Heap Dump analysis on the Production heap dump which would have been taken when there is an 'OutOfMemoryError' outage for better analysis. For heap dump analysis we will be using MAT.
Any suggestions regarding this would be welcomed.i m getting Exception in thread "main"
java.lang.OutOfMemoryError,
please help meHow?
You are leaking memory or attempting to use to much. There is a bug in your code. -
Exception in thread "main" - error: Please help
I installed the Java 1.4.0 beta on my machine. I configured the JRE and the javac and java commands are responding well. Now I have written very simple classes which are compiling without errors. But now, if I use the java command to run the classes, I am getting the following message:
Exception in thread "main" java.lang.NoClassFoundError: ForTick/class ;
where ForTick is the name of my class for example. Where am I going wrong? Also, where do I find documentation for error messages like this - I have toured almost the whole java website and even the documentation that I downloaded -but I couldn't find it.
Please help me coz I am just stuck.Did you try
java ForTick.class ?
If so, please try
java ForTickHope this helps -
Exception in thread "main" error
I have a real problem. I am trying to write a hello world program in java using native code. my java code is as follow :
class HelloWorld {
static {
System.loadLibrary("Hello.so");
private native void print();
public static void main(String[] args) {
new HelloWorld().print();
System.out.println("Good bye Hello World!!");
my native c code is as follow :
#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
JNIEXPORT void JNICALL
print(JNIEnv *env,jobject obj) {
printf("Hello cruel world. Hope you can live through the Human Phase!.\n");
return ;
I use javac HelloWorld.java to get my HelloWorld.class file.
I use javah HelloWorld to het my HelloWorld.h file
i set my LD_LOBRARY_PATH to where my native code is.
i compile the c code using "
gcc -c -I /usr/java/j2sdk1.4.0/include -I /usr/java/j2sdk1.4.0/include/linux HelloWorld.c -o Hello.so
everything is good up to this point. But when i call java HelloWorld, i get the following error : "
Exception in thread "main" java.lang.UnsatisfiedLinkError: no Hello.so in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1370)
at java.lang.Runtime.loadLibrary0(Runtime.java:773)
at java.lang.System.loadLibrary(System.java:835)
at HelloWorld.<clinit>(HelloWorld.java:3)
Can any one help. I am using RedHat 7.2, kernel 2.4.10-17.
Thank you
Shafi Jourabchi [email protected]Thank you all who have responded. The solution to my problem was with the compile options. I was not using the right option to compile the shared lib object file.
the command i used ( and it worked ) was :
gcc -o libHello.so -shared -Wl, -soname,libHello.so -I /usr/java/j2sdk/include -I /usr/java/j2sdk/include/linux HelloWorldImp.c -static -Lc
Shafi jourabchi -
"exception in thread main" error while running "dbca"
Hi,
i am getting following kind of error while trying to run dbca in linux.
"exception in thread main"
i have the dispaly env var set. and xhost+ set too. but still dbca is not working.
i have pasted the contents of dbca file below. can someone have a look at the file and help me find the error.
it would be great if someone can paste their dbca file content, so i can compare and fix the error.
#!/bin/sh -f
# $Header: dbca.sh 12-may-2005.11:05:03 xuliu Exp $
# dbca.sh
# Copyright (c) 1997, 2005, Oracle. All rights reserved.
# NAME
# dbassist - Shell script to run Database Creation Assistant
# DESCRIPTION
# Runs Database Creation Assistion java application
# Run this script with -h or -help option to get the help.
# MODIFIED (MMDD/YY)
# npamnani 10/23/02 - add 1.3.1. java flag
# npamnani 10/09/02 - run with java instead jre
# dkapoor 07/05/2000 - Created
# Variables set by Oracle Universal Installer for dependent components.
# Define ORACLE_HOME -> OH
OH=/home/oracle/oracle/product/10.2.0/db_1
PLATFORM=Linux
ORACLE_HOME=$OH
export ORACLE_HOME;
# Version specific JAR files
JRE_FILE=rt.jar
I18_FILE=i18n.jar
EWT_FILE=ewt3.jar
JEWT_FILE=jewt4.jar
EWT_COMP_FILE=ewtcompat-3_3_15.jar
SHARE_FILE=share.jar
HELP_FILE=help4.jar
#ICE_BROWSER_FILE=oracle_ice5.jar
ICE_BROWSER5_FILE=oracle_ice5.jar
KODIAK_FILE=kodiak.jar
SWING_FILE=swingall-1_1_1.jar
XMLPARSER_FILE=xmlparserv2.jar
JDBC_FILE=classes12.zip
GDK_FILE1=orai18n.jar
GDK_FILE2=orai18n-mapping.jar
GDK_FILE3=orai18n-utility.jar
GDK_FILE4=orai18n-collation.jar
NETCFG_FILE=netcfg.jar
OJMISC_FILE=ojmisc.jar
PKI_FILE=oraclepki103.jar
LDAP_FILE=ldapjclnt10.jar
OPM_FILE=opm.jar
SRVM_FILE=srvm.jar
SRVMHAS_FILE=srvmhas.jar
SRVMASM_FILE=srvmasm.jar
ASSISTANTS_COMMON_FILE=assistantsCommon.jar
DBCA_FILE=dbca.jar
EMLITE_JAR=oemlt-10_1_0.jar
INSTALLER_FILE=OraInstaller.jar
PREREQ_JAR_FILE=OraPrereq.jar
PREREQ_CHECKS_JAR_FILE=OraPrereqChecks.jar
# Directory Variables
SRVM_JLIB_DIR=/home/oracle/oracle/product/10.2.0/db_1/jlib
JRE_DIR=/home/oracle/oracle/product/10.2.0/db_1/jdk/jre
LIB_DIR=$OH/lib
LIB32_DIR=$OH/lib32
JLIB_DIR=$OH/jlib
DBCA_JLIB_DIR=$OH/assistants/dbca/jlib
ASSISTANTS_JLIB_DIR=$OH/assistants/jlib
INSTALLER_JLIB_DIR=/home/oracle/oracle/product/10.2.0/db_1/oui/jlib
# Classpath
JRE_CLASSPATH=$JRE_DIR/lib/$JRE_FILE
I18_CLASSPATH=$JRE_DIR/lib/$I18_FILE
EWT_CLASSPATH=$JLIB_DIR/$EWT_FILE:$JLIB_DIR/$EWT_COMP_FILE
SHARE_CLASSPATH=$JLIB_DIR/$SHARE_FILE
HELP_CLASSPATH=$JLIB_DIR/$HELP_FILE:$JLIB_DIR/$JEWT_FILE
ICE_BROWSER_CLASSPATH=$JLIB_DIR/$ICE_BROWSER5_FILE
KODIAK_CLASSPATH=$JLIB_DIR/$KODIAK_FILE
SWING_CLASSPATH=$JLIB_DIR/$SWING_FILE
XMLPARSER_CLASSPATH=/home/oracle/oracle/product/10.2.0/db_1/lib/$XMLPARSER_FILE
JDBC_CLASSPATH=$OH/jdbc/lib/$JDBC_FILE
GDK_CLASSPATH=$JLIB_DIR/$GDK_FILE1:$JLIB_DIR/$GDK_FILE2:$JLIB_DIR/$GDK_FILE3:$JLIB_DIR/$GDK_FILE4
NETCFG_CLASSPATH=$JLIB_DIR/$NETCFG_FILE:$JLIB_DIR/$OJMISC_FILE:$JLIB_DIR/$PKI_FILE:$JLIB_DIR/$LDAP_FILE:$JLIB_DIR/$OPM_FILE
SRVM_CLASSPATH=$SRVM_JLIB_DIR/$SRVM_FILE:$SRVM_JLIB_DIR/$SRVMHAS_FILE:$SRVM_JLIB_DIR/$SRVMASM_FILE
EM_CLASSPATH=$OH/classes:$JLIB_DIR/$EMLITE_JAR:$JLIB_DIR/emca.jar:$OH/sysman/jlib/emCORE.jar:$OH/oc4j/j2ee/home/oc4j.jar:$OH/oc4j/j2ee/home/db_oc4j_deploy.jar:$JLIB_DIR/emConfigInstall.jar
ASSISTANTS_COMMON_CLASSPATH=$ASSISTANTS_JLIB_DIR/$ASSISTANTS_COMMON_FILE
DBCA_CLASSPATH=$DBCA_JLIB_DIR/$DBCA_FILE
INSTALLER_CLASSPATH=$INSTALLER_JLIB_DIR/$INSTALLER_FILE:$INSTALLER_JLIB_DIR/$PREREQ_JAR_FILE:$OH/inventory/prereqs/oui/$PREREQ_CHECKS_JAR_FILE:$INSTALLER_JLIB_DIR/$PREREQ_CHECKS_JAR_FILE
# Check for silent or help
SILENT="false"
for i in $*
do
if [ $i = "-silent" ] || [ $i = "-help" ] || [ $i = "-h" ]; then
SILENT="true"
break
fi
done
# Check for DISPLAY
if [ $SILENT = "false" ]; then
case $DISPLAY in
echo "DISPLAY not set."
echo "Set DISPLAY environment variable, then re-run."
exit;
esac
fi
# make sure others can not read/write any files created
umask 27
# The environment variable $TWO_TASK cannot be set during the installation
unset TWO_TASK
# The environment variable $JAVA_HOME cannot be set during the installation
unset JAVA_HOME
# Basic error checking
case $OH in
"") echo "*** ORACLE_HOME Not Set!"
echo " Set and export ORACLE_HOME, then re-run"
echo " ORACLE_HOME points to the main directory that"
echo " contains all Oracle products."
exit 1;;
esac
# Set the LD_LIBRARY_PATH to set the path for shared objects
# Do not set it on AIX
if [ $PLATFORM != IBM_AIX ]; then
LD_LIBRARY_PATH=$LIB32_DIR:$OH/network/lib32:$LIB_DIR:$OH/network/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH;
fi
# Set SHLIB_PATH for HP to use 32bit native libraries
SHLIB_PATH=$LIB32_DIR:$ORACLE_HOME/network/lib32:$SHLIB_PATH
export SHLIB_PATH;
# Set LIBPATH for AIX to use 32bit native libraries
LIBPATH=$LIB32_DIR:$ORACLE_HOME/network/lib32:$LIBPATH
export LIBPATH;
# Set Classpath for Database Creation Assistant
CLASSPATH=$JRE_CLASSPATH:$I18_CLASSPATH:$DBCA_CLASSPATH:$ASSISTANTS_COMMON_CLASSPATH:$EWT_CLASSPATH:$SHARE_CLASSPATH:$HELP_CLASSPATH:$ICE_BROWSER_CLASSPATH:$KODIAK_CLASSPATH:$SWING_CLASSPATH:$XMLPARSER_CLASSPATH:$GDK_CLASSPATH:$NETCFG_CLASSPATH:$JDBC_CLASSPATH:$SRVM_CLASSPATH:$EM_CLASSPATH:$INSTALLER_CLASSPATH
ARGUMENTS=""
NUMBER_OF_ARGUMENTS=$#
if [ $NUMBER_OF_ARGUMENTS -gt 0 ]; then
ARGUMENTS=$*
fi
# Run DBCA
$JRE_DIR/bin/java -Dsun.java2d.font.DisableAlgorithmicStyles=true -DORACLE_HOME=$OH -DDISPLAY=$DISPLAY -DJDBC_PROTOCOL=thin -mx128m -classpath $CLASSPATH oracle.sysman.assistants.dbca.Dbca $ARGUMENTS
Thanks,
Philip.I got this error also,.
After restart the computer, it runs ok. -
Java.lang.NoSuchMethodError: init when running in a Thread
I have a Java class that calls a C++ function (JNI) and the return of that function is a Java object:
There�s the problematic C++ code:
jclass taskDescriptorClass = env->FindClass("a/b/TaskDescriptor");
if (taskDescriptorClass == NULL) {
//Class cannot be found
return NULL;
jmethodID constructorMID = env->GetMethodID(taskDescriptorClass, "<init>", "void(V)");
if (constructorMID == NULL) {
return NULL;
}This code as always behaved as expected, running in a JUnit test. But now I�m calling the code inside a thread (new Thread(new Runnable() { public void run() { ...NATIVE CALL...), but now I�m getting an exception:
Exception in thread "thrd1" java.lang.NoSuchMethodError: <init>
at a.b.JTLs.createTask(Native Method)
at a.b.GrammarBuilder.build(GrammarBuilder.java:216)
at a.b.GrammarManager.getModel(GrammarManager.java:230)
at a.b.GrammarManager.getModel(GrammarManager.java:146)
at a.b.TestGrammarManager$1.run(TestGrammarManager.java:58)
at java.lang.Thread.run(Thread.java:595) I�m using J2SE 5 update 06
Does anyone know why is this happening?
ThanksHi,
This is the problem with the jaxws-rt.jar in my classpath.I have removed the jar from the class path then it started working
culprit here is ‘com.sun.xml.ws.util. JAXWSUtils’ which is defined in jaxws.rt.<version>.jar. Weblogic 10 uses glassfish.jaxws.rt_2.1.3.jar.
Could you please check in (ANT) classpath where in any other jaxws.rt.jar being referred which may not have ‘getEncodedURL’ method definition -
Doubt in AXIS-Exception in thread "main" . how can i run this program
hi
I am new to axis., I done few webservice program using Jwsdp
i can't resolve the reason for this exception.
I have set all the classpath and other path variable that is necessary for axis .,
I got this example from http://javaboutique.internet.com/tutorials/Axis/index.html
Can any one help to solve this problem.,
**************Code***************
import java.util.*;
public class NHLService {
HashMap standings = new HashMap();
public NHLService() {
// NHL - part of the standings as per 04/07/2002
standings.put("atlantic/philadelphia", "1");
standings.put("atlantic/ny islanders", "2");
standings.put("atlantic/new jersey", "3");
standings.put("central/detroit", "1");
standings.put("central/chicago", "2");
standings.put("central/st.louis", "3");
public String getCurrentPosition(String division, String team) {
String p = (String)standings.get(division + '/' + team);
return (p == null) ? "Team not found" : p;
package hansen.playground;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.namespace.QName;
import java.net.*;
public class NHLServiceClient {
public static void main(String [] args) throws Exception {
Service service = new Service();
Call call = (Call)service.createCall();
String endpoint = "http://localhost:8081/axis/NHLService.jws";
call.setTargetEndpointAddress(new URL(endpoint));
call.setOperationName(new QName("getCurrentPosition"));
String division = args[0];
String team = args[1];
String position =
(String)call.invoke(new Object [] {new String(division), new String(team)});
System.out.println("Got result : " + position);
}************ classpath***************
:/home/sujithkr/webservices/xml-axis/java:
/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/axis.jar
/home/sujithkr/webservices/xml-axis/lib/activation.jar
:/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/clutil.jar
:/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/commons-logging.jar
:/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/jaxrpc.jar
:/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/log4j-core.jar
:/home/sujithkr/webservices/xml-axis/webapps/axis/WEB-INF/lib/tt-bytecode.jar
********************Error Report*******************************
java hansen.playground.NHLServiceClient atlantic philadelphia
Exception in thread "main" Error while compiling: /usr/local/tomcat/webapps/axis//NHLService.java
at org.apache.axis.message.SOAPFaultBuilder.endElement(Unknown Source)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContextImpl.parse(Unknown Source)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at hansen.playground.NHLServiceClient.main(NHLServiceClient.java:21)
suse-1:/home/sujithkr/webservices # clear
suse-1:/home/sujithkr/webservices # java hansen.playground.NHLServiceClient atlantic philadelphia
Exception in thread "main" Error while compiling: /usr/local/tomcat/webapps/axis//NHLService.java
at org.apache.axis.message.SOAPFaultBuilder.endElement(Unknown Source)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContextImpl.parse(Unknown Source)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at org.apache.axis.client.Call.invoke(Unknown Source)
at hansen.playground.NHLServiceClient.main(NHLServiceClient.java:21)
thank you for helping me in your hectic schedule....Please post your code using code tags.
When I try to compile or build i cant.What is your question? Exactly what error message do you get? -
Exception in thread "main" during WL6.0SP1 update on AIX4.3.3
We are getting an Exception in thread "main" when trying to update
wlserver6.0 on AIX 4.3.3 with SP1 file.
We have tried with IBM or BEA JDK - same problem.
Can someone help please? Thank you in advance,
Jerome
PS:
java -cp wls60sp1_upgrade_generic.zip install -i console.....
Choose BEA Home Directory
1- Create a New BEA Home
2- Use Existing BEA Home
Enter a number: 2
1- /dcm/bea
Existing BEA Home: 1
Installing...
[==================|==================|==================|==================
[Exception in thread "main"
JAVA:
Java130.adt.debug 1.3.0.4 COMMITTED Java Application
Development
Java130.adt.includes 1.3.0.2 COMMITTED Java Application
Development
Java130.ext.commapi 1.3.0.0 COMMITTED Java Comm API Extension
Java130.ext.jaas 1.3.0.3 COMMITTED JAAS (Java Authentication &
Java130.ext.plugin 1.3.0.4 COMMITTED Java Plugin for Netscape
Java130.rte.bin 1.3.0.4 COMMITTED Java Runtime Environment
Java130.rte.lib 1.3.0.4 COMMITTED Java Runtime Environment
Java130.samples.demos 1.3.0.1 COMMITTED Java Sample Demos
MP KERNEL:
bos.mp 4.3.3.26 COMMITTED Base Operating System
Hi Luis
This can be a problem with the CLASSPATH. Have you checked the CLASSPATH. Do
you have your working directory in the classpath?
Anant
<Luis Martins> wrote in message news:[email protected]..
Has anyone resolved this? I have the exact same problem. No one on the web
seems to know the solution though a efw people have this problem. I'm
running Redhat 9 and installing Weblogic 6.1 in the same manner as Jerome.
I get the exact same "Exception in thread "main"" error...I installed JDK
1.3.1 and included the JDK_HOME/bin as the first entry in my $PATH
variable.
Can anyone please please help...this has been doing my head in. Thanks in
advance...:) -
Hi ..
i make a simple struts application for login check which when i try to run tomcat i got the following error
i have installed Apache Tomcat/5.5.17, jdk1.5.0_09, eclipse 3.2
please tell me whats wrong with configuration
becoz same code working fine well in different machin..........
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:272)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.NoSuchMethodError: javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZ)V
org.apache.jasper.compiler.TagLibraryInfoImpl.createAttribute(TagLibraryInfoImpl.java:576)
org.apache.jasper.compiler.TagLibraryInfoImpl.createTagInfo(TagLibraryInfoImpl.java:401)
org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:248)
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:162)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
org.apache.jasper.compiler.Parser.parse(Parser.java:126)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
Apache Tomcat/5.5.17Could you include the content of your JSP page?
-
Hi everyone,
Just now i tried to run the 'simple' example in an JAXRPC Security part in the JWSDP 1.4 tutorial but got the following error:
run-sample:
[echo] Running the simple.TestClient program....
[java] Service URL=http://localhost:8080/securesimple/Ping
[java] Exception in thread "main" java.lang.NoSuchMethodError: com.sun.xml.wss.configuration.SecurityConfigurationXmlReader.readJAXRPCSecurityConfigurationString(Ljava/lang/String;Z)Lcom/sun/xml/wss/configuration/JAXRPCSecurityConfiguration;
[java] at com.sun.xml.rpc.security.SecurityPluginUtil.<init>(SecurityPluginUtil.java:128)
[java] at simple.PingPort_Ping_Stub.<clinit>(PingPort_Ping_Stub.java:40)
[java] at simple.PingService_Impl.getPing(PingService_Impl.java:68)
[java] at simple.TestClient.main(TestClient.java:27)
Can anybody give me a clue?Vishal, thanks a lot for your reply. I used the App Server 2004Q4 beta and got the problem. When I switch to version 8.0.0_01 the things work well.
But now I'm trying to understand this example and creating my own simple web app using encryption feature. From the files in the example dicrectory I can figure out the security applied at client by examining client stub files generated by the wscompile in the asant gen-client task. But I wonder when security is added to the server side. Is it when we use wsdeploy with the model part specifiedin jaxrpc-ri.xml? What is the procedure to apply the security to the web service?
The last thing I want to ask is whether the deploytool bundled inside App Server can do the same things as ant task (eg. wsdeploy with some arguments). -
Exception in thread "main" java.lang.NoSuchMethodError?
This is the exact same error I recieved from running ListGames:
Exception in thread "main" java.lang.NoSuchMethodError: ListGames.getConnection(Ljava/lang/String;)Ljava/sql/Connection;
at ListGames.getGames(ListGames.java:21)
at ListGames.main(ListGames.java:7)
What's wrong?
ListGames.java:
import java.sql.*;
import java.text.NumberFormat;
import ...util.MysqlConnection; // purposely incomplete
public class ListGames {
static Connection conn = MysqlConnection.openMysqlConnection("ds_games");
public static void main(String args[]) {
NumberFormat cf = NumberFormat.getCurrencyInstance();
ResultSet games = getGames();
try {
while (games.next()) {
Game g = getGame(games);
String msg = Integer.toString(g.year) + ": " + g.title + " (" + cf.format(g.price) + ")";
System.out.println(msg);
} catch (SQLException e) {
e.printStackTrace();
conn = MysqlConnection.closeMysqlConnection(conn);
private static ResultSet getGames() {
try {
Statement s = conn.createStatement();
ResultSet rows = s.executeQuery("select title, year, price from my_ds_games order by year, price, title");
return rows;
} catch (SQLException e) {
e.printStackTrace();
conn = MysqlConnection.closeMysqlConnection(conn);
return null;
private static Game getGame(ResultSet games) {
try {
String title = games.getString("Title");
int year = games.getInt("Year");
double price = games.getDouble("Price");
return new Game(title, year, price);
} catch (SQLException e) {
e.printStackTrace();
conn = MysqlConnection.closeMysqlConnection(conn);
return null;
private static class Game {
public String title;
public int year;
public double price;
public Game(String title, int year, double price) {
this.title = title;
this.year = year;
this.price = price;
MysqlConnection.java:
package ...util; // purposely incomplete
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public final class MysqlConnection {
public static final Connection openMysqlConnection(String database) {
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + database, user, password); // username and password purposely uninitialized
} catch(SQLException e) {
System.out.println("SQLException: " + e.getMessage());
System.out.println("SQLState: " + e.getSQLState());
System.out.println("VendorError: " + e.getErrorCode());
} catch(Exception e) {
e.printStackTrace();
} finally {
return conn;
public static final Connection closeMysqlConnection(Connection conn) {
try {
if (conn != null) {
conn.close();
if (conn == null) {
System.out.println("Conection Closed");
} catch (SQLException e) {
e.printStackTrace();
} finally {
return null;
}Darkstar444 wrote:
I deleted ListGames.class, ListGames$Games.class, and MysqlConnection.class but still the same thing.Then you didn't delete the version of ListGames.class which is actually being used when you run your application. This suggests that your classpath is pointing to an old version as well as to the version produced currently by the compiler. Or that there's an old version which you put into the Java extensions directory. -
Exception in thread "main" java.lang.NoSuchMethodError: main -- Help
I am new to Java programming and I have been working out of a book trying to learn the language. I am working on a Ubuntu system using Eclipse. I get an error when I try to run this app. It is: Exception in thread "main" java.lang.NoSuchMethodError: main. I have Googled it and read different possible solutions, but none have helped. Can someone help me solve this?
Here is the code for battleshipGameTestDrive.java:_
import java.util.ArrayList;
public class battleshipGameTestDrive
public static void main(String[] args, ArrayList<String> locations)
int numOfGuesses = 0;
boolean isAlive = true;
GameHelper helper = new GameHelper();
battleshipGame ship = new battleshipGame();
for (int ctr = 1; ctr < 4; ctr++)
int randomNum = (int) (Math.random() * 5);
locations.add(Integer.toString(randomNum));
ship.setLocationCells(locations);
while (isAlive == true){
String userGuess = helper.getUserInput("Enter a number (1-7): ");
numOfGuesses++;
String result = ship.checkYourself(userGuess);
if (result.equals("kill")){
isAlive = false;
System.out.println("You took " + numOfGuesses + " guesses");
} // close result if
} //end while loop
}// end of main
}// end of battleshipGameTestDrive class
Here is the code for the battleshipGame class.java:_
import java.util.ArrayList;
public class battleshipGame {
private ArrayList<String> locationCells;
public void setLocationCells(ArrayList<String> loc){
locationCells = loc;
public String checkYourself(String userInput){
String result = "miss";
int index = locationCells.indexOf(userInput);
if (index >= 0){
locationCells.remove(index);
if (locationCells.isEmpty()){
result = "kill";
}else{
result = "hit";
}// close if
}// closer outer if
return result;
} //close method
} //close classHello,
I saw your short message youe sent to someone who had a problem : Exception in thread "main" java.lang.NoSuchMethodError :main
So I was thinking maybe you could help me I struggle with this code fro 3weeks, this is a code I save it later as
import java.awt.*;
import java.awt.event.*;
class Party {
public void makeInvitation(){
Frame f = new Frame();
Label l = new Label("Party at Tom's");
Button b = new Button("Sure");
Button c = new Button("Noo...");
Panel p = new Panel();
p.add(l);
I write this code in Notepad++ than I save it as java file with looks like this : Java source file (*.java)
- than in Command Prompt I write : javac Party.java as usual and it comes with this error below Exception in thread "main" .......
I have no idea what's wrong with it.Can you help me
Thank you in advance -
Exception in thread "main" java.lang.NoClassDefFoundError
Am using java 1.3.1 on Red Hat Linux 7.1
i get this error
Exception in thread "main" java.lang.NoClassDefFoundError
while running a simple program HelloWorld.java
helpWhen you use the "java" command, the only required argument is the name of the class that you want to execute. This argument must be a class name, not a file name, and class names are case sensitive. For example, "java HelloWorld.java" won't work because the class name isn't HelloWorld.java, it's HelloWorld. Similarly, "java helloworld" won't work because a class defined as "public class HelloWorld {" is not named helloworld due to case sensitivity. Finally, the .class file must be in a directory that is in the Classpath - that's where java.exe searches to find the file that contains the class.
-
HELP Needed with this error: Exception in thread "main" java.lang.NoClass
Folks,
I am having a problem connecting to my MSDE SQL 2000 DB on a WindowsXP pro. environment. I am learning Java and writing a small test prgm to connect the the database. The code compiles ok, but when I try to execute it i keep getting this error:
"Exception in thread "main" java.lang.NoClassDefFoundError: Test1"
I am using the Microsoft jdbc driver and my CLASSPATH is setup correctly, I've also noticed that several people have complained about this error, but have not seen any solutions....can someone help ?
Here is the one of the test programs that I am using:
import java.sql.*;
* Microsoft SQL Server JDBC test program
public class Test1 {
public Test1() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://LAPTOP01:1433","sa","sqladmin");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
} // Test
public static void main (String args[]) throws Exception {
Test1 test = new Test1();I want to say that there was nothing wrong
with my classpath config., I am still not sure why
that didn't work, there is what I did to resolved
this issue.You can say that all you like but if you are getting NoClassDefFound errors, that's because the class associated with the error is not in your classpath.
(For future reference: you will find it easier to solve problems if you assume that the problem is your fault, instead of trying to blame something else. It almost always is your fault -- at least that's been my experience.)
1. I had to set my DB connection protocol to TCP/IP
(this was not the default), this was done by running
the
file "svrnetcn.exe" and then in the SQL Server Network
Utility window, enable TCP/IP and set the port to
1433.Irrelevant to the classpath problem.
2. I then copied all three of the Microsoft JDBC
driver files to the ..\jre\lib\ext dir of my jdk
installed dir.The classpath always includes all jar files in this directory. That's why doing that fixed your problem. My bet is that you didn't have the jar file containing the driver in your classpath before, you just had the directory containing that jar file.
3. Updated my OS path to located these files
and....BINGO! (that simple)Unnecessary for solving classpath problems.
4. Took a crash course on JDBC & basic Java and now I
have created my database, all tables, scripts,
stored procedures and can read/write and do all kinds
of neat stuff.All's well that ends well. After a few months you'll wonder what all the fuss was about.
Maybe you are looking for
-
How to update DBtable in table control (MPP) for selected lines.
Hi Folks, I need to update DBtable from the table control after modification of only multiple selected rows. But my issue. any row if edited is being modified in DBtable. Client does not want me to use Check box so im using Selcolumn in module pool
-
I want to use dictionairy German in thunderbird but it will not intergrate with in Thunderbird. I can not place the download in Thunderbird. On your site you say I muss add it in extra but it will not work. I use Windows 8.1 please help me. Thanks
-
App level vs. user level scripts error
I am working on a trusted function to save a LiveCycle (pdf) file based on a field name. Upon research I have read that I am supposed to find the "app" and "user" folder level scripts. To find these scripts I should run the following script in the Ac
-
how to update my ipad 1
-
Which custom. steps for "Accounts Receivable Pledging Indicator" (KNB1)?
Hi All, Could anyone show me the customizing steps to set the "Accounts Receivable Pledging Indicator" (KNB1-CESSION_KZ)? Thanks Galdalf