Simple program wont run  java.lang.NoClassDefFoundError

Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: Simple_Server/Server)
i am new to java and i made this simple script to accept connections then pass them on to HandleClient.
but when i run it i get this output
Exception in thread "main" java.lang.NoClassDefFoundError: Server (wrong name: Simple_Server/Server)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$000(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)here is the source code
package SMTP_Server;
import java.io.*;
import java.net.*;
public class Server {
    ServerSocket serverSocket = null;
    boolean listening = true;
    public Server(){
     System.out.println("New Server Created");
    public void main(String[] args) {
        try {
            this.serverSocket = new ServerSocket(4444);
        } catch (IOException e) {
            System.err.println("Could not listen on port: 4444.");
            System.exit(1);
     while(listening){
         try{
          new HandleClient(this.serverSocket.accept()).start();
         } catch (IOException e) {
          System.err.println("Caught IOException: " + e.getMessage());
}I thought it might be that main() is not static but it wont work if make it static because it cannot access the listening or serverSocket fields
Thanks for all the help
Scott.

The directory hierarchy of your .class files must mirror the package hierarchy of your classes.
So if you've got a class "Foo" in a package "p1" (i.e. a class with the fully qualified name of "p1.Foo") and a clas "Bar" in a package "p2" (i.e. a class with the fully qualified name of "p2.Bar"), then you need a file hierarchy such as this:
p1/Foo.class
p2/Bar.classAnd the directory in your classpath needs to be the directory that contains p1 and p2.
So what you need to do is go to a directory that contains a directory called "Simple_Server" (your source file mentions SMTP_Server, but I assume you changed it at some point).
That directory Simple_Server must contain a file called Server.class.
Then execute "java Simple_Server.Server".
Also please follow common naming conventions, as your code will become harder to understand if you don't. An important rule in those conventions is that package names should be in all-lowercase and not contain any non-letter characters if possible (i.e. use "smtpserver" instead of "SMTP_Server").

Similar Messages

  • Executing HelloWorld program in EJB java.lang.NoClassDefFoundError-help plz

    Hi
    I am a tyro to Weblogic 8.1 server with EJB. I am Running a simple HeloWorld program ,but it throws No class def found err. Below i listed my program.help needed.
    Home interface
    package examples;
    import java.rmi.*;
    import javax.ejb.*;
    public interface HelloWorldHome extends EJBHome {
    public HelloWorld create() throws CreateException,RemoteException;
    Remote interface:
    package examples;
    import java.rmi.*;
    import javax.ejb.*;
    public interface HelloWorld extends EJBObject
    public String getHelloWorldMsg () throws RemoteException;
    HelloWorldLocal-- Remote
    package examples;
    import javax.ejb.*;
    public interface HelloWorldLocal extends EJBLocalObject
    public String getHelloWorldMsg();
    HelloWorldLocalHome:
    package examples;
    import javax.ejb.*;
    public interface HelloWorldLocalHome extends EJBLocalHome
    HelloWorldLocal create() throws CreateException;
    HelloWorldBean:
    package examples;
    import javax.ejb.*;
    import javax.SessionContext;
    public class HelloWorldBean implements SessionBean
    public HelloWorldBean() {}
    private void log(String s) {
    if (true) System.out.println(s);
    public void ejbActivate() {}
    public void ejbPassivate() {}
    public void ejbRemove() {
    log("ejbRemove() called");
    public void setSessionContext(SessionContext ctx) {
    log("setSessionContext called");
    this.ctx = ctx;
    public void ejbCreate() throws CreateException {
    log("ejbCreate() called");
    public String getHelloWorldMsg () {
    log("Bean Method called");
    return ("Stateless SessionBean says Hello World");
    Client program
    package examples;
    import java.rmi.*;
    import javax.rmi.PortableRemoteObject;
    import javax.naming.*;
    import java.util.*;
    import examples.HelloWorldHome;
    import examples.HelloWorld;
    * This class is an example of client code that calls
    * methods on a simple stateless session bean.
    public class HelloWorldClient {
    private static Context createJNDIContext()
    throws NamingException, RemoteException {
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL,"t3://localhost:7001");
    Context context = new InitialContext( env );
    return context;
    * Main method to unit test the HelloWorld API
    public static void main(String[] args) {
    try
    // use JNDI to look up the home interface for HelloWorld
    Context context = createJNDIContext();
    // You could use the following statement to retrieve
    // the HelloWorld home
    /* HelloWorldHome home =
    (HelloWorldHome)
    context.lookup("examples.HelloWorldHome"); */
    // However, using javax.rmi.PortableRemoteObject
    // allows you to narrow the scope
    // to the home interface
    HelloWorldHome home = (HelloWorldHome )
    PortableRemoteObject.narrow(
    context.lookup("examples.HelloWorldHome"),
    examples.HelloWorldHome.class ) ;
    HelloWorld hello = home.create();
    * The EJBObject will delegate the call to the HelloWorld
    * session bean, receive the result, and return it to this client.
    System.out.println(hello.hello());
    * Remove the EJBObject.
    * The container will mark the EJBObject for destruction.
    hello.remove();
    catch( Exception err )
    System.err.println( err.toString() );
    and also i put Class path in sys variables.I don't know reason y not running .help needed.
    bye

    Client program , No class def found exception.Create an ejb-client.jar containing only the home and remote interfaces for the EJB and add them to the classpath while executing the client code. You could also copy the EJB JAR for that.

  • Can't Run Java Programs -- java.lang.NoClassDefFoundError Error

    I am running 10.4.11. For some reason I can no longer run Java programs. (I could in the past)
    For example. I create a simple Hello World program as follows and save it as Hello.java:
    class HelloWorld
    public static void main (String args[])
    System.out.println("Hello, world!");
    Then I compile it:
    Javac Hello.java
    Then I try to run it:
    java Hello
    But I get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: Hello
    I think it must be a CLASSPATH problem but normally you do not need to worry about ClassPATH. Apple sets it up for you out of the box.
    What is wrong?

    I totally forgot that the class name should be the same as the filename.
    After I renamed the file to HelloWorld.java and recompiled, I could run "java HelloWorld"
    Rob

  • Java/lang/NoClassDefFoundError when trying to run my program in Eclipse

    I have a problem when using Eclipse. I can compile my classes in Eclipse without problems, but when I try to run the main class I get the following error message:
    Error occurred during initialization of VM
    java/lang/NoClassDefFoundError: java/lang/Object
    I have the same classpath setup when compiling and running the program. I am using JDK 1.3.1 and also have no problem running the program using javaw from a command prompt.
    Please answer if you have encountered this problem or have any idea what the problem might be.

    I start Eclipse using the exe file eclipse.exe with no special arguments.
    I use a JRE installed in e:\jdk1.3.1_01 so on the JRE page in the launch dialog box I have added a JRE with e:\jdk1.3.1_01\jre as the JRE home directory. This means that the JRE system library contain e:\jdk1.3.1_01\jre\lib\rt.jar. On the classpath page this JAR file is also listed as well as some other JAR files I use in my project.

  • Why i get error msg when i run my program? (java.lang.NoClassDefFoundError)

    i have compile and run my program. First time the program can run. But after that when i run, come out error messege as below:
    java.lang.NoClassDefFoundError: FormPoster (wrong name: search/FormPoster)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    Exception in thread "main"
    what can i do? thank very much

    Hello,
    i have compile and run my program. First time theprogram can run.
    But after that when i run, come out error messegeas below:
    java.lang.NoClassDefFoundError: FormPoster (wrongname: search/FormPoster)
    Check your FormPoster class: the classname has to be
    the same as
    the file name and the class should be stored in its
    correct directory
    (the sub directory structure should reflect the
    package name).
    kind regards,
    JosYou should also check your clsspath if you are using packages.

  • Java.lang.NoClassDefFoundError: HelloWorld when running SQLJ program

    i can compile the program but i can't run it. when i try to run ( java HelloWorld) it gives java.lang.NoClassDefFoundError: HelloWorld error message. i have set the classpath, path and oracle_home accordingly to the oracle SQLJ documentation. i'm using win2000 and j2sdk 1.4.0. please help.
    this is my sqlj's code:
    import java.sql.Date;
    import java.sql.SQLException;
    import oracle.sqlj.runtime.Oracle;
    public class HelloWorld
         public static void main(String [] args)
              java.sql.Date current_date;
              try
                   Oracle.connect(
                        "jdbc:oracle:thin:nicole:1521:kwanyee",
                        "y2net",
                        "y90583008"
                   #sql { SELECT sysdate INTO :current_date FROM dual };
                   System.out.println( "Hello" + current_date);
              catch (SQLException e)
                   System.err.println("SQLException " + e);
              finally
                   try
                        Oracle.close();
                   catch (SQLException e)
                        System.err.println("SQLException " + e);
    }

    I am not too sure about sqlj ...if this suggestion doesn't work I can show you the statndard 'java' way to connect to Oracle. But try this, you probably need to add the oracle drivers to your classpath. Look for a file named classes12.zip ...and add that to the classpath settings like this (on my box):
    @SET CLASSPATH=%CLASSPATH%;G:\ORACLE\ORA81\JDBC\LIB\classes12.zip

  • Java.lang.NoClassDefFoundError running session bean client program

    hi
    I am using weblogic 8.1 server, while i run the client program it throws following exception. i am using standalone server.
    D:\Weblogicserver\user_projects\domains\mydomain\applications\statelessSession>a
    nt run
    Buildfile: build.xml
    run:
    [java] java.lang.NoClassDefFoundError: examples/ejb20/basic/statelessSessio
    n/Client
    [java] Exception in thread "main"
    BUILD FAILED
    file:D:/Weblogicserver/user_projects/domains/mydomain/applications/statelessSess
    ion/build.xml:76: Java returned: 1
    Plz guide me to rectify this exception.
    bye
    jaiganesh

    Hi,
    set the setWLSEnv in classpath and try again.
    Regards
    Anilkumar kari

  • Run time error - Exception in thread "main" java.lang.NoClassDefFoundError:

    Can can one help me with this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: TestEnv
    The program is a simple one
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.lang.String.*;
    //A Very Simple Example
    class TestEnv {
    public static void main(String[] args){
    System.out.println("Env is fine");
    Compile the program:
    javac TestEnv.java
    Run the program:
    java TestEnv
    Error: Exception in thread "main" java.lang.NoClassDefFoundError: TestEnv

    Try setting the classpath properly. It seems the runtime evironment is unable to find the compiled class files. Nothing else is wrong.
    --Anil                                                                                                                                                                                                                                                                                           

  • Java.lang.NoClassDefFoundError when running DBCA after fresh install

    Hello there.
    I have just installed Oracle 9i on a new server, since we are moving our database server from one machine to the other, and after going through the installation without any problems DBCA was going to run but I have got the following error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/help/Help
    at oracle.sysman.assistants.dbca.ui.UIHost.initializeHelp(UIHost.java:24
    5)
    at oracle.sysman.assistants.dbca.ui.UIHost.initialize(UIHost.java:228)
    at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:96)
    at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:161)
    I have checked the CLASSPATH, which currently is:
    "C:\Program Files\Oracle\jre\1.1.8\lib\rt.jar;C:\Program Files\Oracle\jre\1.1.8\lib\i18n.jar;%ORACLE_HOME%\assistants\dbca\jlib\dbca.jar;%ORACLE_HOME%\assistants\jlib\assistantsCommon.jar;%ORACLE_HOME%\jlib\ewt3.jar;%ORACLE_HOME%\jlib\ewtcompat-3_3_15.jar;%ORACLE_HOME%\jlib\share.jar;%ORACLE_HOME%\jlib\swingall-1_1_1.jar;%ORACLE_HOME%\jlib\oracle_ice5.jar;%ORACLE_HOME%\jlib\help3.jar;%ORACLE_HOME%\jlib\kodiak.jar;%ORACLE_HOME%\lib\xmlparserv2.jar;%ORACLE_HOME%\jlib\gss-1_1.zip;%ORACLE_HOME%\classes;%ORACLE_HOME%\jlib\oembase-9_2_0.jar;%ORACLE_HOME%\jlib\srvm.jar;%ORACLE_HOME%\jdbc\lib\classes111.zip;%ORACLE_HOME%\jlib\netcfg.jar;%ORACLE_HOME%\lib\vbjorb.jar;%ORACLE_HOME%\lib\vbjtools.jar;%ORACLE_HOME%\lib\vbjapp.jar;%ORACLE_OEM_CLASSPATH%"
    If you could please help I would appreciate it.
    Kind regards.

    Hello, rajeysh.
    Thank you for your reply, I have tried this method but it did not work, the problem remains the same.
    Please notice that with the reference you've quoted the error is java.lang.NoClassDefFoundError: oracle/sysman/emSDK/common/nls/MessageBundle while mine reports the error java.lang.NoClassDefFoundError: oracle/help/Help.
    So, if you have any other ideas I would appreciate it.
    Kind regards.

  • "java.lang.NoClassDefFoundError" error while run t-code SXMB_IFR in XI

    Hi
    When I am trying to run t-code <b>SXMB_IFR</b> in Xi it give me below error.
    <b>Exception Details
    Exception class: java.lang.NoClassDefFoundError
    Message
    java.lang.NoClassDefFoundError
    Stacktrace
    Thrown:
    java.lang.NoClassDefFoundError: null
         at com.sap.aii.ibrep.server.transport.api.RepTransportServiceStartup.startupIbrepTransportServices(RepTransportServiceStartup.java:22)
         at com.sap.aii.ibrep.server.applcomp.StartupCodeEntry.startup(StartupCodeEntry.java:426)
         at com.sap.aii.ib.core.applcomp.IStartupCodeEntry.startupIfNotAlreadyDone(IStartupCodeEntry.java:33)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponentImpl.startup(ExplicitApplicationComponentImpl.java:116)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponents.startup(ExplicitApplicationComponents.java:374)
         at com.sap.aii.ib.core.applcomp.ApplicationComponent.startup(ApplicationComponent.java:201)
         at jsp_Main1172666584171._jspService(jsp_Main1172666584171.java:21)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:467)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:181)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)</b>
    Reg,
    Hiren Patel

    Hi Hiren,
       Check these threads:
    Problem starting SXMB_IFR and J2EE Engine
    java.lang.NoClassDefFoundError
    Regards,
    Subhasha Ranjan

  • Java.lang.NoClassDefFoundError when running the Junit method

    Hi Friends
    I am stuck in this typical Junit problem for a copule of days but still not able to find any solution for it.The problem is as below.
    I have written Junit test case for 1 method that has been added in the session bean. the code is as below.
    public void testfindResponses() {
                   ClientManager cMgr = null;
                   Collection retvalue= new ArrayList();
                   try {
                   System.out.println("Before");
                   cMgr = EJBHomeUtilities.getClientManagerHome().create();
                   System.out.println("After" + cMgr.toString());
              //     retvalue=cMgr.findSurveyResponses(clientPk,startTime,endTime);
                   }catch (RemoteException e) {
                   //logger.error(e.getMessage());
                   throw new EJBException(e.getMessage());
                   } catch (CreateException e) {
                   // logger.error(e.getMessage());
                   throw new EJBException(e.getMessage());
                   } finally {
                   EJBHomeUtilities.removeSessionBean(cMgr);
              //return retvalue;
    when i run this using the Junit consol;e on the eclipse i am getting
    java.lang.NoClassDefFoundError
         at sun.reflect.GeneratedSerializationConstructorAccessor35.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.io.ObjectStreamClass.newInstance(ObjectStreamClass.java:869)
         at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1698)
         at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
         at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
         at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:120)
         at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
         at org.jboss.invocation.MarshallingInvokerInterceptor.invoke(MarshallingInvokerInterceptor.java:37)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
         at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:169)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
         at $Proxy0.create(Unknown Source)
         at com.march.hth.test.client.ClientManagerBeanTest.testfindSurveyResponses(ClientManagerBeanTest.java:3918)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    The remote reference that i get seems to not work atall.i tried to put debug statements to see if i am getting the remote reference,but the control seems to not go there itself.
    The same method if i write for another session bean it is working fine without any errors.
    Please let me know whats wrong here as i am stuck up with this issue for a long time .waiting for positive replies from your side.
    Thanks & Regards
    Vikram K

    I also came across this error . . . the exception message seemed to indicate a problem in the HTML file. In mine, I had the HEIGHT and WIDTH attributes set to 100% -- something that is nonsensical outside of a browser context. I changed those values to some number of pixels (800 and 600, say), and the exception did not reoccur. I suggest you try the same.
    --john                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error running Workbench -java.lang.NoClassDefFoundError: java/sql/Savepoint

    Hi,
    I have recently installed toplink. When I try to connect to the Oracle Server (same machine) I get the below error
    I am running 9i (DB) and I have Sun JDK 1.4.1_03. The classpath looks like this
    c:\oracle\ora92\toplink\core\lib\toplink.jar;c:\oracle\ora92\toplink\core\lib\xerces.jar;c:\oracle\ora92\toplink\core\lib\antlr.jar;C:\oracle\ora92\jdbc\lib\ojdbc14.jar;C:\oracle\ora92\jdbc\lib\nls_charset12.jar
    Assistance greatly appreciated.
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: java/sql/Savepoint
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at oracle.toplink.workbench.model.db.BldrDatabase.login(Unknown Source)
         at oracle.toplink.workbench.ui.BldrMainView.login(Unknown Source)
         at oracle.toplink.workbench.ui.BldrActionManager$32.actionPerformed(Unknown Source)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
         at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    Hi,
    I am using Oracle 10g Express Edition. I try to connect to oracle using Web Sphere Appserver. I am getting java.lang.NoClassDefFoundError: java/sql/Savepoint
    java.lang.NoClassDefFoundError: java/sql/Savepoint
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:547)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:347)
         at java.sql.DriverManager.getConnection(DriverManager.java:543)
         at java.sql.DriverManager.getConnection(DriverManager.java:194)
         at org.apache.jsp._index._jspService(_index.java:76)
         at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
    Could you please help me to solve this exception?
    Thanks,
    Siva

  • Simple but wierd java.lang.NoClassDefFoundError with jar file

    I'm using ant to jar my .class files. My final objective is to create an executable jar. When I run my jar file - "java -jar PM.jar" - I get:
    Exception in thread "main" java.lang.NoClassDefFoundError: pm/PMApp
    This at least tells me that java found my MANIFEST.MF class and that is the correct class it should be looking for, but it doesn't seem to find the class. But when I do - "jar -tf PM.jar" - I get:
    C:\mike\pm\execs>jar -tf PM.jar
    META-INF/
    META-INF/MANIFEST.MF
    pm/
    pm/EasterEgg.class
    pm/JMSMessageListener.class
    pm/PMApp.class
    pm/ReleasePlanTest.class
    pm/SystemArchitectureFrame$1.class
    pm/SystemArchitectureFrame$2.class
    pm/SystemArchitectureFrame$3.class
    pm/SystemArchitectureFrame$4.class
    pm/SystemArchitectureFrame$5.class
    pm/SystemArchitectureFrame$6.class
    pm/SystemArchitectureFrame$7.class
    pm/SystemArchitectureFrame$8.class
    pm/SystemArchitectureFrame.class
    pm/SystemArchitecturePanel.class
    Which shows me that the class is there. I suspected that it might have something to do with CLASSPATH at first because of the java.lang.NoClassDefFoundError, but now I am skeptical that that could be the problem. I even build a new jar file out of different classes to make sure my method was OK and that worked fine. Any ideas? Thanks for your help in advance.

    Here is my Manifest:
    Main-Class: pm.PMApp<carriage return>
    Class-Path: C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
    I noticed that if I leave the Class-Path variable unset it has no problem finding the class pm/PMApp, but I then get a class loader error concerning J2EE stuff. Am I missing something in my Class-Path? I tried to even specify the jar file I'm running here, but that didn't work either? I have also tried '.' and './', space delimited in my Class-Path, like this:
    Class-Path: . ./ C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
    Thanks for the replies, do you have any more suggestions?

  • 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
    help

    When 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.

  • How can I resolve java.lang.NoClassDefFoundError?

    I am new to Java and have installed it on my Linux Ubuntu 9.04 workstation in order to learn Java. Basic Java programs work, but I am having trouble connecting to a MySQL database. I installed these packages using Synaptic Package Manager, which I thought should cover everything I need for database connectivity: 1.gsfonts-x11; 2.java-common; 3.odbcinst1debian1; 4.sun-java6-bin; 5.sun-java6-jdk; 6.sun-java6-jre; 7.unixodbc.
    After these packages were installed, I was not sure if I needed to do this, but I downloaded the MySQL connector from http://www.mysql.com/products/connector/ and installed in a directory called /home/mark/mysql/.
    I edited /etc/environment" and added a CLASSPATH to where I installed the connector:
    {code}CLASSPATH="/home/mark/mysql/mysql-connector-java-5.1.7/mysql-connector-java-5.1.7-bin.jar"
    {code}
    I created a very simple Java program based on one I found on the internet. I named the program Jdbctest to test the connection,
    {code}import java.sql.*;
    public class Jdbctest {
    public static void main(String[] args){
    System.out.println("running Jdbctest.java");
    try {
    Statement stmt;
    //Register the JDBC driver for MySQL.
    Class.forName("com.mysql.jdbc.Driver");
    //Define URL of database server for database named mysql
    // on the localhost with the default port number 3306.
    String url = "jdbc:mysql://localhost:3306/mysql";
    //Get a connection to the database for a
    // user named root with password carrot.
    // This user is the default administrator
    // having full privileges to do anything.
    Connection con = DriverManager.getConnection(url,"root", "carrot");
    //Display URL and connection information
    System.out.println("URL: " + url);
    System.out.println("Connection: " + con);
    //Get a Statement object
    stmt = con.createStatement();
    //Select from a table
    stmt.executeQuery("SELECT host, user FROM mysql.user ");
    con.close();
    }catch( Exception e ) {
    e.printStackTrace();
    }//end catch
    }//end main
    }//end class Jdbctest{code}
    but I get this error:
    {code}Exception in thread "main" java.lang.NoClassDefFoundError: Jdbctest
    Caused by: java.lang.ClassNotFoundException: Jdbctest
         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: Jdbctest. Program will exit.{code}
    I don't really understand what this error message is telling me. I've Googled for an explanation, and it seems to indicate that my CLASSPATH is wrong, but I'm not sure what it should be and how to fix it. Any assistance would be greatly appreciated.

    Your class JdcbTest isn't in that JAR, is it? So you need the CLASSPATH to also specify where that is. Typical CLASSPATHs start with a dot and then some jars.

Maybe you are looking for

  • Account 'Contra account: Acquisition value' could not be found for area 01

    Hi, everyone! I am practicing in T-code ABZON. I created one asset and purchased it. When I use T-code ABZON to acquisition with automatic, I cannot post because it has error: Account 'Contra account: Acquisition value' could not be found for area 01

  • Good receipt without Invoice

    Hi all Let me know about Report for Goods receipt without Invoice for Purchase order? ie. PO pending for Invoice? If anybody a report, pls send it to me. I have used 101-102, 105-106 movement types? So any one send that reports?

  • Noob in OC4j

    Hi everyone, I'm having trouble with running .JSP in IIS. I already installed the OC4j standalone. The built-in sample .JSP pages works fine. My problem is how do i configure OPII.CONF to use OC4j. Links will be fine so i can have a clue. Another thi

  • Computer freezing up and slow

    my Mac Pro keeps freezin up, taking about 15 seconds to type on letter and it displays a round rainbow figure when I try to click out of things. Any ideas how to clean up my computer?? Thanks.

  • Keep getting update messages but the update won't download

    On clicking to update in the the update widow, it looks to be attempting to do something but nothing downloads. I get the message to update almost everyday (3.6.16 I think). Also Firefox 4 "yahoo" won't install. On opening the application/update, it