Java.lang.NoClassDefFoundError: MyClass (wrong name: mypackage/MyClass)
Bit nervous about posting again got absolutely slagged by the "big boys" for being an idiot. But here goes anyway -
I'm getting the error in the subject line in an applet.
What I am slightly confused about is why the code compiles and runs fine in NetBeans but as soon as I upload the class to my site it gives this error.
I have read a lot about class paths being wrong on the computer and things in wrong directories, but how are the class paths wrong for a successfully compiled and built program?
I have all the classes from the package in the same directory on the website.
Any clues would be appreciated.
Cheers
Dan
Hi cotton
Thanks for the answer, I have tried a couple of variations in my applet tag.
I started off very simply and managed to get a "HelloWorldApplet" to run.
Then I simply tried embedding my programme, although not originally written for the web (it has a main class)
I added the "HelloWorld" message output to my main class to see if the my classes and code is working.
I fully expect the rest of the code to fall over elsewhere, however I did expect Java to find the "Main" class.
I have tried the following
<Applet code="flashcardserverside/Main.class" width="200" height="200"></applet>this gives the error-
java.lang.ClassNotFoundException: flashcardserverside.Main.class
also tried
<Applet code="Main.class" width="200" height="200"></applet>this produces - Main (wrong name: flashcardserverside/Main)
<Applet code="main.class" width="200" height="200"></applet>this returns - java.lang.ClassNotFoundException: main.class
(I expected this because my class is Main)
<Applet codebase = "http://www.mywebsite.co.uk" code="Main.class" width="200" height="200"></applet>giving- Main (wrong name: flashcardserverside/Main)
<Applet codebase = "http://www.mywebsite.co.uk" code="flashcardserverside/Main.class" width="200" height="200"></applet>java.lang.ClassNotFoundException: flashcardserverside.Main.class
I got the codebase tags from the following lesson:
http://www.case.edu/help/wilbur/ch8.html
Perhaps my problem is that I am trying to embed a program that I initially wrote as a non web application. Is it "illegal" to call a class Main when embedding applets.
Cheers
Dan
PS thanks for the other info on classpaths.
Similar Messages
-
Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong n
Please Help, I am giving up...
My PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jdk1.6.0_11\bin;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\JAVA DOCUMENTATION\BasicJava1\Code;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar
MY CLASSPATH: C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7\;C:\Program Files\Mysql Connector J\mysql-connector-java-5.1.7-bin
Before I set the ABOVE Path's I received the "com.mysql.jdbc.Driver" error. After adding the CLASS PATH as above I got the following Error
"com.mysql.jdbc.Driver"
After the ABOVE mentione PATH's Iam getting the following error:
C:\JAVA DOCUMENTATION>java connect
Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong name:
Connect)
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)
Could not find the main class: connect. Program will exit.
THIS IS MY CODE.....
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connect
public static void main (String[] args)
Connection conn = null;
try
String userName = "sampadm";
String password = "secret";
String url = "jdbc:mysql://localhost/sampdb";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection (url, userName, password);
System.out.println ("Database connection established");
catch (Exception e)
System.err.println ("Cannot connect to database server");
System.err.println("Exception: " + e.getMessage());
finally
if (conn != null)
try
conn.close ();
System.out.println ("Database connection terminated");
catch (Exception e) { /* ignore close errors */ }
PLEASE PLEASE HELP, AS I NEED TO GET PASSED THIS ERROR NOW. I NEED TO PROGRESS !!
THANKS TO ANYBODY THAT CAN ASSIST
FYI
JUDYJava is case sensitive. Connect != connect
-
Exception in thread "main" java.lang.NoClassDefFoundError: continue (wrong
class Continue {
public static void main(String[] args)
int i=0;
while(i>5) continue;
System.out.println("Count is: " + i);
i++;
when i run this program get an error i.e.,
Exception in thread "main" java.lang.NoClassDefFoundError: continue (wrong name:
Continue)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
so pls help me what my mistake in my progrm
iThe output of your program is
C:\rk>javac Continue.java
C:\rk>java Continue
Count is: 0
C:\rk>
Why is that you got that problem? Could you please tell me how did you tried compiling it? -
Ok, i made my own java compiler (well my friend made it for me), and I got this error when i ran the program.....
Here is the code in my compiler if you want to take a look at it.
@echo off
if exist "C:\Program Files (x86)\Java\" set programfiles=C:\Program Files (x86)
set pr=%programfiles%\Java\
:co1
set b=0
set t=7
goto co2
:co2
color %b%%t%
:menu
cls
title The Perfect Compiler version 1.9
echo Please choose an option below to do that function.
echo Keep posted on the Moparscape Tutorials section for
echo any updates that I post.
echo.
echo c - Compile your server.
echo r - To Run your server.
echo e - To exit out of the program.
echo jar - It will create your server into an executable Jar archive.
echo color - Change the Text and Backround colors of this compiler.
echo reset - Resets your Compiler Logs.
echo.
echo.
set /p c=Option:
if %c%==c goto c
if %c%==C goto c
if %c%==r goto r
if %c%==R goto r
if %c%==jar goto jar
if %c%==Jar goto jar
if %c%==JAR goto jar
if %c%==color goto color
if %c%==Color goto color
if %c%==COLOR goto color
if %c%==reset goto reset
if %c%==Reset goto reset
if %c%==RESET goto reset
if %c%==e goto e
if %c%==E goto e
if %c%==* goto er
goto er
:jar
title Jar Creator
cls
echo What will be the name of the Jar file?
echo.
set /p name=Name:
if exist *.class (del *.class)
set pro=%pr%jdk1.5.0
set pro2=%pr%jdk1.6.0
set jav=bin\javac.exe
set go=jar2
goto cj
:jar2
%java% -cp . *java
echo Manifest-Version: 1.0 >> manifest
echo Created-By: 1.5.0_04 (Sun Microsystems Inc.) >> manifest
echo Main-Class: server >> manifest
set pro=%pr%jdk1.5.0
set pro2=%pr%jdk1.6.0
set jav=bin\jar.exe
set go=jar3
goto cj
:jar3
if not exist *.class (goto jre)
%java% -cvfm %name%.jar manifest *.class
del runserver.bat
del manifest
del *.class
goto jl
:jar4
set pro=%pr%jre1.5.0
set pro2=%pr%jre1.6.0
set jav=bin\java.exe
set go=jar5
goto cj
:jar5
echo @echo off >> runserver.bat
echo title %name% >> runserver.bat
echo %java% -cp .;%name%.jar server >> runserver.bat
echo pause >> runserver.bat
cls
echo %name% Jar file successfully made. The runserver.bat will
echo now load the Jar file. If you have any errors while runnning
echo the Jar file, please post about it in Mod Taharok's 'Perfect
echo Compiler' topic on MoparScape.
pause
goto menu
set
:color
cls
echo Would you like to change the backround color, change
echo the text color, or reset it to default?
echo.
echo back - Change the backround color.
echo text - Change the text color.
echo def - Change all colors back to default.
echo.
echo.
set /p color=Option:
if %color%==back goto back
if %color%==BACK goto back
if %color%==text goto text
if %color%==TEXT goto text
if %color%==def goto co1
if %color%==DEF goto co1
if %color%==* goto er
goto er
:back
cls
echo Please select a color to change the backround to:
echo.
echo black
echo white
echo red
echo yellow
echo green
echo blue
echo purple
echo.
echo.
set /p back=Color:
if %back%== black (set b=0)
if %back%== white (set b=7)
if %back%== red (set b=4)
if %back%== yellow (set b=6)
if %back%== green (set b=2)
if %back%== blue (set b=1)
if %back%== purple (set b=5)
goto co2
:text
cls
echo Please select a color to change the text to:
echo.
echo black
echo white
echo red
echo yellow
echo green
echo blue
echo purple
echo.
echo.
set /p back=Color:
if %back%== black (set t=0)
if %back%== white (set t=7)
if %back%== red (set t=4)
if %back%== yellow (set t=6)
if %back%== green (set t=2)
if %back%== blue (set t=1)
if %back%== purple (set t=5)
goto co2
:c
cls
title Compiler
set pro=%pr%jdk1.5.0
set pro2=%pr%jdk1.6.0
set jav=bin\javac.exe
set go=c2
goto cj
:c2
if exist src (goto cl) else (goto c3)
:c3
if exist *.java (goto cl2) else (goto ce)
:c4
%java% -cp . *.java
echo Files Compiled Successfully!
pause
cls
goto menu
:c5
%java% -cp . .\src\*.java
echo Files Compiled Successfully!
pause
move .\src\*.class .\classes\
cls
goto menu
:ce
cls
echo You must have Java files for this Compiler to Compile.
pause
cls
goto menu
:r
cls
title Runserver
set pro=%pr%jre1.5.0
set pro2=%pr%jre1.6.0
set jav=bin\java.exe
set go=r2
goto cj
:r2
set rjava=%java% -Xmx1024m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.17-ga-bin.jar server
cls
goto r3
:r3
if exist .\classes\HelloJava.class (goto sl2) else (goto r4)
:r4
if exist .\server.class (goto sl) else (goto se)
:r5
%rjava%
pause
cls
goto menu
:r6
set rjava=
set rjava=%java% -cp .;./classes; Server
%rjava%
pause
cls
goto menu
:se
cls
title Error
echo You do not have a Server.class. Make sure that you have used the
echo compiler with your server BEFORE you try runing it.
pause
cls
goto menu
:er
cls
title Error
echo Invalid command. Please make sure the commands you type
echo in are correct.
pause
cls
goto menu
:e
cls
exit
:cj
if exist "%pro2%_01\%jav%" (goto sj)
if exist "%pro2%\%jav%" (goto sj2)
if exist "%pro%_10\%jav%" (goto sj3)
if exist "%pro%_09\%jav%" (goto sj4)
if exist "%pro%_08\%jav%" (goto sj5)
if exist "%pro%_07\%jav%" (goto sj6)
if exist "%pro%_06\%jav%" (goto sj7)
if exist "%pro%_05\%jav%" (goto sj8)
if exist "%pro%_04\%jav%" (goto sj9)
if exist "%pro%_03\%jav%" (goto sj10)
if exist "%pro%_02\%jav%" (goto sj11)
if exist "%pro%_01\%jav%" (goto sj12)
if exist "%pro%\%jav%" (goto sj13) else (goto je)
:sj
set java="%pro2%_01\%jav%"
goto %go%
:sj2
set java="%pro2%\%jav%"
goto %go%
:sj3
set java="%pro%_10\%jav%"
goto %go%
:sj4
set java="%pro%_09\%jav%"
goto %go%
:sj5
set java="%pro%_08\%jav%"
goto %go%
:sj6
set java="%pro%_07\%jav%"
goto %go%
:sj7
set java="%pro%_06\%jav%"
goto %go%
:sj8
set java="%pro%_05\%jav%"
goto %go%
:sj9
set java="%pro%_04\%jav%"
goto %go%
:sj10
set java="%pro%_03\%jav%"
goto %go%
:sj11
set java="%pro%_02\%jav%"
goto %go%
:sj12
set java="%pro%_01\%jav%"
goto %go%
:sj13
set java="%pro%\%jav%"
goto %go%
:je
cls
title Error
echo You do not have JDK 5.0 or JDK 6.0 or any JDK 5.0 and 6.0 updates.
echo Go to Mod Taharok's tutorial on the Moparscape Tuturoials section
echo for step-by-step instructions to download the newest JDK Update.
pause
cls
goto menu
:sl
cls
echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
echo Server was run using %java%. >> "Compile Logs.txt"
echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
echo. >> "Compile Logs.txt"
goto r5
:sl2
cls
echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
echo Server was run using %java%. >> "Compile Logs.txt"
echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
echo. >> "Compile Logs.txt"
goto r6
:cl
cls
echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
echo Java files were compiled using %java%. >> "Compile Logs.txt"
echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
echo. >> "Compile Logs.txt"
goto c5
:cl2
cls
echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
echo Java files were compiled using %java%. >> "Compile Logs.txt"
echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
echo. >> "Compile Logs.txt"
goto c4
:jl
cls
echo %name% Jar file created at %time% and on %date%. >> "Compile Logs.txt"
echo Jar file was created using %java%. >> "Compile Logs.txt"
echo Thank you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
echo. >> "Compile Logs.txt"
goto jar4
:reset
cls
echo Resetting the Compiler's Logs...
pause
del "Compile Logs.txt"
goto menuAs the pic says "5 duke stars for whoever can fix this"I got that exact problem I think, how did you fix it?? I been trying to make a server for a whole year, spent hours and hours trying to make it, and I can't do it... Need help... Whoever helps gets... Co on my server. :)
-
Java.lang.NoClassDefFoundError: (wrong name)
Hi,
I know this has been discussed a million times before, but I have read through various threads in the forum and tried the suggested solutions, but I still can't run my java applet. I use NetBeans 5.5. Under "Project properties/Run", Main Class path is set to "lottoapplet.LottoAppletUI"
Beginning of my code looks like this:
package lottoapplet;
import java.math.*;
import javax.swing.JLabel;
import javax.swing.*;
import java.text.*;
public class LottoAppletUI extends javax.swing.JFrame {
If I build the project and try to run the applet in a browser with the following code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<applet code="LottoAppletUI.class" width="641" height="431">
</applet>
</body>
</html>
I get a gray box and an "X" and the java console says the (in)famous:
java.lang.NoClassDefFoundError: LottoAppletUI (wrong name: lottoapplet/LottoAppletUI)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
If I use the command prompt, the compile works fine with the -cp parameter but applet won't run:
C:\Documents and Settings\masaxp>javac -cp "C:\Documents and Settings\masaxp\My
Documents\Java projects\LottoApplet\src\lottoapplet" "C:\Documents and Settings\
masaxp\My Documents\Java projects\LottoApplet\src\lottoapplet\LottoAppletUI.java
C:\Documents and Settings\masaxp>"C:\Program Files\Java\jdk1.6.0_01\bin\java.exe
" "C:\Documents and Settings\masaxp\My Documents\Java projects\LottoApplet\src\l
ottoapplet\LottoAppletUI"
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Documents and Sett
ings\masaxp\My Documents\Java projects\LottoApplet\src\lottoapplet\LottoAppletUI
I can run the project in the NetBeans IDE without a problem. Anyone that can decipher this and see the problem? Thanks anyway.Thanks for your reply,
when I change:
<applet code="LottoAppletUI.class" width="641" height="431">
</applet>
to:
<applet code="lottoapplet.LottoAppletUI.class" width="641" height="431">
</applet>
I get:
inl?sning: klassen lottoapplet.LottoAppletUI.class finns inte.(does not exist in english)
java.lang.ClassNotFoundException: lottoapplet.LottoAppletUI.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Documents and Settings\masaxp\My Documents\Java projects\LottoApplet\src\lottoapplet\lottoapplet\LottoAppletUI\class.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
If I change to:
<applet code="lottoapplet.LottoAppletUI" width="641" height="431">
</applet>
I get:
inl?sning: klassen lottoapplet.LottoAppletUI finns inte.(does not exist in english)
java.lang.ClassNotFoundException: lottoapplet.LottoAppletUI
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Documents and Settings\masaxp\My Documents\Java projects\LottoApplet\src\lottoapplet\lottoapplet\LottoAppletUI.class (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more
why is this so difficult? Time should be spent on coding not on pathways.
Thanks,
Mattias -
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 muchHello,
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. -
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"). -
Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wr
Tthe program is getting compiled fine . After that I am giving hte command
java JdbcExample1
The error messge that comes is :
Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wrong name: com/stardeveloper/example/JdbcExample1)
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)
MY computer settings
Java is installed in : c:\jdk1.3
Classpath is
C:\com\stardeveloper\example;C:\Documents and Settings\abhijeet\Desktop;c:\jdk1.3\bin;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\JdbcExample2\mysql-connector-java-3.1.12-bin.jar;c:\jdk1.3\bin;c:program files\java\j2re1.4.2_11\bin\;C:\jdk1.3\jre\bin;%CLASSPATH%;
CODE is :
package com.stardeveloper.example;
import java.sql.*;
public class JdbcExample1 {
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test", "root", "desertgot123");
if(!con.isClosed())
System.out.println("Successfully connected to MySQL server...");
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}Thanks a lot all.....the code has started working but the reason for its running and non running remain unclear...
1)When you give the command java JdbcExample1 inside the directory structure c:\com\startdeveloper\example ,it does not work
\2) Including c:\ in the classpath also did not help
3) Now after removing c:\ from the classpath and then going ot the c:\ i gave the command java com.stardeveloper.example.JdbcExample1. Voila it stated working.
Some advice needed from you all guys..the way out to buil a databas e driven website seems seriously very complicated if this keeps happening.IS there any GUI based tool hat can help.
Thanks a lot
abhijeet -
Java.lang.NoClassDefFoundError . Please help
Hi everyone!
I have this problem...i create a small java program, like "hello world". It is ok to compile and run it. The directory structure is as follows:
/some/files/mypackage/myclass.java
if i put in my source pacake mypackage/myclass, then i can compile the program, but when i try to run it i get this error:
java.lang.NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError: myclass (wrong name: mypackage/myclass)
Thanks!!!You can always search the forum for answers - just put "wrong name" in the search box.
In your case, you entered "java myclass" but the class that the jvm found was named mypackage/myclass. In other words, the myclass class is defined to be in the mypackage package so the fully qualified name of the class is mypackage/myclass (or mypackage.myclass). Your command needs to be "java mypackage/myclass" Most likely, you need to "cd /some/files/" before entering the command to run it. -
Problems on java.lang.NoClassDefFoundError
The simple sourcecode is as follow
When I compile
javac hellowporld.java
java helloworld
the error information is
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld (wrong e: helloworld/helloworld)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
if I delete the sentence "package helloworld" then recompile it . It is Ok
Anyone knows the reason. Many thanks,
package helloworld;
public class helloworld {
/** Creates a new instance of helloworld */
public helloworld() {
* @param args the command line arguments
public static void main(String[] args)
System.out.println("Hello World!");The reason is the "java" command requires the fully qualified class name. Fully qualified means package name + class name. If you have a class whose name is helloworld and you put a statement "package helloworld;" in the source code, then its fully qualified name is "helloworld.helloworld" (or "helloworld/helloworld").
To run this class, the command must be "java helloworld.helloworld" This link will tell you just about everything you need to know about packages.
http://java.sun.com/docs/books/tutorial/java/interpack/packages.html -
Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1/
Dear all ,I am getting the following eror message while using JDBC to connect to MYSQL
Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1/class
The code comiles fine but when i run it the error comes.
The java code used is as follows and it is in the directory c:\com\stardeveloper\example
The classpath is set as
classpath= .;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\mysql-connector-java-3.1.12-bin.jar
JAVA_HOME= C:\jdk1.3
Java is installed in : C:\jdk1.3
The mysql-connector-java-3.1.12-bin.jar is in the folder wher the code is i.e. C:\com\stardeveloper\example
THE CODE IS AS FOLLOWS:
package com.stardeveloper.example;
import java.sql.*;
public class JdbcExample1 {
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test", "root", "desertgot123");
if(!con.isClosed())
System.out.println("Successfully connected to MySQL server...");
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
Please help
Thanks in advance
Regards
AbhijeetClasspath is C:\com\stardeveloper\example;C:\Documents and Settings\abhijeet\Desktop;c:\jdk1.3\bin;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar;C:\com\stardeveloper\example\JdbcExample2\mysql-connector-java-3.1.12-bin.jar;c:\jdk1.3\bin;c:program files\java\j2re1.4.2_11\bin\;C:\jdk1.3\jre\bin;%CLASSPATH%;
the program is getting compiled fine . After that I am giving hte command
java JdbcExample1
The error messge that comes is :
Exception in thread "main" java.lang.NoClassDefFoundError: JdbcExample1 (wrong n
ame: com/stardeveloper/example/JdbcExample1)
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) -
i compile my java programm by typing javac c:\MyClass.java, i have 0 errors. But when i try to run the class file by typing java c:\MyClass.class i have this exception : Exception in thread "main" java.lang.NoClassDefFoundError c:\MyClass/class
what is wrong please?what is wrong please? First, wrong forum. See the " New To Java Technology" forum.
Second, you run classes not files (as the previous poster pointed out.) -
I am getting below error when the weblogic server starts. Can somebody help on this.
DS (XreferenceDB) creation was successful but could not test (Not available in Testing tab).
####<Jul 3, 2012 7:18:14 PM IST> <Error> <Deployer> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323294981> <BEA-149231> <Unable to set the activation state to true for the application 'XreferenceDB'.
java.lang.NoClassDefFoundError: t : T (wrong name t)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101)
at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.rmi.internal.GenericMethodDescriptor.getActualClassName(GenericMethodDescriptor.java:216)
at weblogic.rmi.internal.GenericMethodDescriptor.access$100(GenericMethodDescriptor.java:19)
at weblogic.rmi.internal.GenericMethodDescriptor$TypeParameter.<init>(GenericMethodDescriptor.java:250)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:111)
at weblogic.rmi.internal.GenericMethodDescriptor.parseGenericParameter(GenericMethodDescriptor.java:151)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:109)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:75)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:46)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initRemoteMethods(BasicRuntimeDescriptor.java:715)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initializeRuntimeDescriptor(BasicRuntimeDescriptor.java:244)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:155)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:139)
at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:106)
at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:85)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:51)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:37)
at weblogic.rmi.internal.OIDManager.makeServerReference(OIDManager.java:194)
at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:175)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
at weblogic.rmi.extensions.server.ServerHelper.replaceAndResolveRemoteObject(ServerHelper.java:403)
at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:381)
at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:276)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at weblogic.jdbc.common.internal.JDBCUtil.bindDeeply(JDBCUtil.java:147)
at weblogic.jdbc.common.internal.JDBCUtil.bindAll(JDBCUtil.java:85)
at weblogic.jdbc.common.internal.RmiDataSource.start(RmiDataSource.java:394)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:136)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:97)
at weblogic.jdbc.module.JDBCModule.activate(JDBCModule.java:347)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:227)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:531)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:165)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:157)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:42)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
###<Jul 3, 2012 7:18:15 PM IST> <Info> <Common> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323295059> <BEA-000626> <Free resources in pool "mds-owsm" will be tested every "300" seconds.>
####<Jul 3, 2012 7:18:15 PM IST> <Info> <JDBC> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323295075> <BEA-001124> <Created Connection Pool named mds-owsm.>
####<Jul 3, 2012 7:18:15 PM IST> <Info> <JDBC> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323295122> <BEA-001174> <Creating Data Source named mds-owsm, JNDI Name = jdbc/mds/owsm.>
####<Jul 3, 2012 7:18:15 PM IST> <Error> <Deployer> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323295122> <BEA-149231> <Unable to set the activation state to true for the application 'mds-owsm'.
java.lang.NoClassDefFoundError: t : T (wrong name t)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101)
at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.rmi.internal.GenericMethodDescriptor.getActualClassName(GenericMethodDescriptor.java:216)
at weblogic.rmi.internal.GenericMethodDescriptor.access$100(GenericMethodDescriptor.java:19)
at weblogic.rmi.internal.GenericMethodDescriptor$TypeParameter.<init>(GenericMethodDescriptor.java:250)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:111)
at weblogic.rmi.internal.GenericMethodDescriptor.parseGenericParameter(GenericMethodDescriptor.java:151)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:109)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:75)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:46)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initRemoteMethods(BasicRuntimeDescriptor.java:715)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initializeRuntimeDescriptor(BasicRuntimeDescriptor.java:244)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:155)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:139)
at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:106)
at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:85)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:51)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:37)
at weblogic.rmi.internal.OIDManager.makeServerReference(OIDManager.java:194)
at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:175)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
at weblogic.rmi.extensions.server.ServerHelper.replaceAndResolveRemoteObject(ServerHelper.java:403)
at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:381)
at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:276)
at weblogic.jdbc.common.internal.JDBCUtil.bindDeeply(JDBCUtil.java:147)
at weblogic.jdbc.common.internal.JDBCUtil.bindAll(JDBCUtil.java:85)
at weblogic.jdbc.common.internal.RmiDataSource.start(RmiDataSource.java:394)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:136)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:97)
at weblogic.jdbc.module.JDBCModule.activate(JDBCModule.java:347)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:227)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:531)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:165)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:157)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:42)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Edited by: 944382 on Jul 4, 2012 2:34 AMError while creating and saving the DS...
####<Jul 3, 2012 7:18:13 PM IST> <Info> <JDBC> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323293059> <BEA-001517> <Connection Pool "XreferenceDB" using Driver: "Oracle JDBC driver", Version: "11.1.0.7.0-Production".>
####<Jul 3, 2012 7:18:14 PM IST> <Info> <Common> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323294856> <BEA-000628> <Created "1" resources for pool "XreferenceDB", out of which "1" are available and "0" are unavailable.>
####<Jul 3, 2012 7:18:14 PM IST> <Info> <JDBC> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323294856> <BEA-001124> <Created Connection Pool named XreferenceDB.>
####<Jul 3, 2012 7:18:14 PM IST> <Info> <JDBC> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323294903> <BEA-001174> <Creating Data Source named XreferenceDB, JNDI Name = Xreference.>
####<Jul 3, 2012 7:18:14 PM IST> <Error> <Deployer> <PC165237> <AdminServer> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1341323294981> <BEA-149231> <Unable to set the activation state to true for the application 'XreferenceDB'.
java.lang.NoClassDefFoundError: t : T (wrong name t)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.utils.classloaders.FilteringClassLoader.findClass(FilteringClassLoader.java:101)
at weblogic.utils.classloaders.FilteringClassLoader.loadClass(FilteringClassLoader.java:86)
at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:177)
at weblogic.rmi.internal.GenericMethodDescriptor.getActualClassName(GenericMethodDescriptor.java:216)
at weblogic.rmi.internal.GenericMethodDescriptor.access$100(GenericMethodDescriptor.java:19)
at weblogic.rmi.internal.GenericMethodDescriptor$TypeParameter.<init>(GenericMethodDescriptor.java:250)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:111)
at weblogic.rmi.internal.GenericMethodDescriptor.parseGenericParameter(GenericMethodDescriptor.java:151)
at weblogic.rmi.internal.GenericMethodDescriptor.parseParams(GenericMethodDescriptor.java:109)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:75)
at weblogic.rmi.internal.GenericMethodDescriptor.computeGenericMethodSignature(GenericMethodDescriptor.java:46)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initRemoteMethods(BasicRuntimeDescriptor.java:715)
at weblogic.rmi.internal.BasicRuntimeDescriptor.initializeRuntimeDescriptor(BasicRuntimeDescriptor.java:244)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:155)
at weblogic.rmi.internal.BasicRuntimeDescriptor.<init>(BasicRuntimeDescriptor.java:139)
at weblogic.rmi.internal.DescriptorManager.createRuntimeDescriptor(DescriptorManager.java:106)
at weblogic.rmi.internal.DescriptorManager.getBasicRuntimeDescriptor(DescriptorManager.java:85)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:51)
at weblogic.rmi.internal.DescriptorManager.getDescriptor(DescriptorManager.java:37)
at weblogic.rmi.internal.OIDManager.makeServerReference(OIDManager.java:194)
at weblogic.rmi.internal.OIDManager.getReplacement(OIDManager.java:175)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceRemote(RemoteObjectReplacer.java:120)
at weblogic.rmi.utils.io.RemoteObjectReplacer.replaceObject(RemoteObjectReplacer.java:103)
at weblogic.rmi.extensions.server.ServerHelper.replaceAndResolveRemoteObject(ServerHelper.java:403)
at weblogic.jndi.internal.WLEventContextImpl.copyObject(WLEventContextImpl.java:381)
at weblogic.jndi.internal.WLEventContextImpl.bind(WLEventContextImpl.java:276)
at javax.naming.InitialContext.bind(InitialContext.java:400)
at weblogic.jdbc.common.internal.JDBCUtil.bindDeeply(JDBCUtil.java:147)
at weblogic.jdbc.common.internal.JDBCUtil.bindAll(JDBCUtil.java:85)
at weblogic.jdbc.common.internal.RmiDataSource.start(RmiDataSource.java:394)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:136)
at weblogic.jdbc.common.internal.DataSourceManager.createAndStartDataSource(DataSourceManager.java:97)
at weblogic.jdbc.module.JDBCModule.activate(JDBCModule.java:347)
at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:227)
at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:531)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:165)
at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:157)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:43)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doPrepare(DeploymentAdapter.java:42)
at weblogic.management.deploy.internal.DeploymentAdapter.prepare(DeploymentAdapter.java:191)
at weblogic.management.deploy.internal.AppTransition$1.transitionApp(AppTransition.java:21)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
at weblogic.management.deploy.internal.ConfiguredDeployments.prepare(ConfiguredDeployments.java:165)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Edited by: 944382 on Jul 5, 2012 4:28 AM -
Hi
I was trying to build an app using JBuilder personal. It would build and run fine. Then i realised that i could not use the api from jdk1.4 as JBuilder would only work with jdk1.3.
So, i moved the project from JBuilder to Forte thinking that Forte would allow me to use the jdk1.4 api. After significant trouble porting the project, i got the project to build successfully.
But when i try to run it , i get the following error
What could be causing it and how do i fix it? these errors are very frustrating. searching this site or the forte help, hasnt given me any tips yet. Thanks
java.lang.NoClassDefFoundError: src/myproject/myapp (wrong name: myproject/myapp )
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
Exception in thread "main"But when i try to run from Forte, it still gives the same dumb errors ..
Could it be a Forte settings problem??Definitely. Choose the Project menu, then the Settings... at the bottom. That brings you up a new dialog. On the left, select the "Execution types", and the "external execution" within. On the right pane, click on the "expert" tab on the bottom. There you have a field named classpath; add your classpath directories there. Then your program will probably run from Forte.
For compiling, you also should set the classpath; you need "Compiler types" on the left pane, and you have to set the classpath for the fastJavac compilation and/or for the external compilation, depending which one you use.
On the left also a "Java Sources" node - click on it, and check if the "default compilation" is either external or (preferable) fastJavac; and that the default execution is external.
How Forte works with internal compilation, and internal execution, I don't know, never tried that.
Best Regards,
Ivan -
Java.lang.NoClassDefFoundError: Illegal name:
I'm looking for some validation on this problem I'm experiencing with 1.4.2_05. I believe that java.lang.ClassLoader.defineClass() was cleaned up in this release to no longer accept class definitions that use the '/' as the separator character. Rather you actually have to follow the API specification and use the '.' character (go figure).
Using any JDK release before 1.4.2_04, I can use the slash character. I know that this particular usage is somewhat wrong, what I can't figure out is why there is no indication in the 1.4.2_05 release notes that this has changed. Does anyone actually know if this is something that was silently fixed in 1.4.2_05?
The exception I'm seeing:
java.lang.NoClassDefFoundError: Illegal name: weblogic/db/oci/OciColumn
at java.lang.ClassLoader.defineClass(ClassLoader.java:538)
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 weblogic.db.oci.OciConnection.native_initialize(Native Method)
at weblogic.db.oci.OciConnection.initialize(OciConnection.java:435)
at weblogic.db.oci.OciConnection.<init>(OciConnection.java:140)
at weblogic.jdbc.oci.Connection.<init>(Connection.java:268)
at weblogic.jdbc.oci.Driver.allocateConnection(Driver.java:44)
at weblogic.jdbc.oci.Driver.connect(Driver.java:101)
<rest of stack omitted>
There are some reported bugs on this topic too...4817264 (which is marked as dupe of 4471675, but I can't see that bug for some reason).
thanks!It appears that you're correct. I ran into this too, and with your additional
insight, I dug into java.lang.ClassLoader and decompiled (with jad) the
class from 1.4.2_03 and 1.4.2_05.
defineClass has this bit of code in it:
try
if(!checkName(s, false))
throw new NoClassDefFoundError("Illegal name: " + s);
class1 = defineClass0(s, abyte0, i, j, protectiondomain);
}The call (and definition) of checkName is in the 1.4.2_05 release, but not
in 1.4.2_03. checkName disallows slash characters:
private boolean checkName(String s, boolean flag)
if(s == null || s.length() == 0)
return true;
if(s.indexOf('/') != -1)
return false;
return flag || s.charAt(0) != '[';
}tim
Maybe you are looking for
-
i have to create an open slaes order in AFS, with multiple line items and then for each line item, there will be multiple schedule line items,, can anybody help me with this,, any sample program????
-
IMac, 2010, will not boot after update
After downloading Yosemite, my 2010, 27" iMac will not reboot. It appeared to install ok but it stayed white screen, no text for more than an hour after it automatically rebooted. Idaes?
-
The twitter app for iPad doesn't work when I try to logout. It's so frustrating that I deleted it and use twitter online.
-
Redirect iWeb Pages To External Sites?
I have a persona domain that I have linked to my .mac account. I have a previous blog that I am trying to substitute on my site instead of having to create a whole new one using the iWeb blog feature. How do I do this? Currently, I have tried to chan
-
Can iOS app run as daemon and access iPhone functions?
I wanted to make an app that stays in the background at all times such that it can send SMS messages at scheduled times. I've tried other apps to do this, but they all use a third party server to send the messages. What I want is for the phone itself