HSQLDB Embedded in Jar throwing - scala

I have an HSQLDB embedded within a fat-jar in the resources directory of the jar. When my script attempts to access the DB, it's throwing an error regarding the lack of a .lck file. However, I was under the impression that DB's within jar files would always be accessed in read-only mode.
Caused by: org.hsqldb.HsqlException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile#18f6cf91[file =/mnt/c/ctakes/SparkCtakes/jar:file:/mnt/c/ctakes/SparkCtakes/lib/ctakes-assembly-4.0.1.jar!/resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: /mnt/c/ctakes/SparkCtakes/jar:file:/mnt/c/ctakes/SparkCtakes/lib/ctakes-assembly-4.0.1.jar!/resources/org/apache/ctakes/dictionary/lookup/fast/sno_rx_16ab/sno_rx_16ab.lck (No such file or directory)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.persist.LockFile.newLockFileLock(Unknown Source)
at org.hsqldb.persist.Logger.acquireLock(Unknown Source)
at org.hsqldb.persist.Logger.open(Unknown Source)
at org.hsqldb.Database.reopen(Unknown Source)
at org.hsqldb.Database.open(Unknown Source)
at org.hsqldb.DatabaseManager.getDatabase(Unknown Source)
at org.hsqldb.DatabaseManager.newSession(Unknown Source)
... 112 more
The way I am creating this fat-jar containing the database resources is by placing the resources folder in src/main/scala/resources and then using sbt-assembly to package everything.

When a read-only database is in a Jar file, the URL to access the database must be a res: type URL.
Supposing the top-level directory in the Jar is org, the URL would look like this:
jdbc:hsqldb:res:/org/apache/ctakes/dictionary/look‌​up/fast/sno_rx_16ab/‌​sno_rx_16ab

Related

Error trying to execute feature files in Katalon Studio v6.3.3 - NoClassDefFoundError

Every time I attempt to execute a feature file the below error is thrown. It doesn't matter if it's a new feature file or an existing one. My colleagues are able to execute the exact same tests on their computers. This only occurs when trying to run feature file tests. I'm able to execute other types of tests with Katalon studio. I've tried versions 6.3.2 and 6.3.3 and received the same results. Has anyone seen this before? Based on the error I think it's failing prior to even getting to execute the code within the feature files but I'm at a loss.
09-09-2019 02:56:05 PM Verification
Elapsed time: 1.000s
Verification FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Keyword runFeatureFile was failed (Root cause: java.lang.NoClassDefFoundError: Integer
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:82)
at cucumber.runner.Runner.<init>(Runner.java:36)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.runtime.Runtime.<init>(Runtime.java:46)
at cucumber.runtime.Runtime.<init>(Runtime.java:42)
at cucumber.api.cli.Main.run(Main.java:34)
at cucumber.api.cli.Main$run.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:76)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:46)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:101)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1568055365381.run(WSVerification1568055365381:2)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.WSVerificationExecutor.runScript(WSVerificationExecutor.java:146)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:140)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:123)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:115)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:103)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1568055363653.run(TempTempCase1568055363653.groovy:21)
Caused by: java.lang.ClassNotFoundException: Integer
... 27 more
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:70)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:46)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:101)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1568055365381.run(WSVerification1568055365381:2)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.WSVerificationExecutor.runScript(WSVerificationExecutor.java:146)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:140)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:123)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:115)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:103)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1568055363653.run(TempTempCase1568055363653.groovy:21)
Caused by: java.lang.NoClassDefFoundError: Integer
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:82)
at cucumber.runner.Runner.<init>(Runner.java:36)
at cucumber.runtime.Runtime.<init>(Runtime.java:65)
at cucumber.runtime.Runtime.<init>(Runtime.java:46)
at cucumber.runtime.Runtime.<init>(Runtime.java:42)
at cucumber.api.cli.Main.run(Main.java:34)
at cucumber.api.cli.Main$run.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:76)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
... 16 more
Caused by: java.lang.ClassNotFoundException: Integer
... 27 more
Well, this isn't an answer as to what happened but I deleted the local source code I was using and pulled it back down into a separate location and now I'm able to run the tests. Maybe something got corrupted in the original clone from the repo. Anyway, all is well now.

SchemaSpy DB2 Connection Failure

I tried to analyze a DB2 database with SchemaSpy, but got a warning 'Connection Failure'. I tried this way:
java -jar schemaspy-6.0.0.jar -configFile schemaspy.properties --logging.pattern.console="%d{HH:mm:ss.SSS} %clr(%-5level) - %msg%n" --logging.level.org.schemaspy=TRACE
(found the logging part on https://github.com/schemaspy/schemaspy/issues/250)
The .properties file looks like this:
schemaspy.t=db2
schemaspy.dp=C:\tmp\db2jcc.jar
schemaspy.host=**host**
schemaspy.port=50000
schemaspy.db=**db**
schemaspy.u=**user**
schemaspy.p=**password**
schemaspy.o=D:\**\schemaspy-output\
schemaspy.s=**schema**
The error I got was:
14:24:20.297 DEBUG - Unable to find driverClass COM.ibm.db2.jdbc.app.DB2Driver'
14:24:20.308 WARN - Connection Failure
org.schemaspy.model.ConnectionFailure: Failed to connect to database URL [jdbc:db2:zumtest] Failed to create any of 'COM.ibm.db2.jdbc.app.DB2Driver' driver from driverPath 'C:\tmp\db2jcc.jar' with sibling jars no.
Resulting in classpath:
file:/C:/tmp/db2jcc.jar
at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:101)
at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:75)
at org.schemaspy.service.SqlService.connect(SqlService.java:68)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:186)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:107)
at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:97)
at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:86)
at org.schemaspy.Main.main(Main.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.schemaspy.model.ConnectionFailure: Failed to create any of 'COM.ibm.db2.jdbc.app.DB2Driver' driver from driverPath 'C:\tmp\db2jcc.jar' with sibling jars no.
Resulting in classpath:
file:/C:/tmp/db2jcc.jar
at org.schemaspy.DbDriverLoader.getDriver(DbDriverLoader.java:147)
at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:93)
... 15 common frames omitted
I guess, the error comes from the wrong class path? But how can I fix this? I tried to change the line in db2.properties
driver=COM.ibm.db2.jdbc.app.DB2Driver
to
driver=COM.ibm.db2.jcc.DB2Driver
, because I extracted this class path from the driver's .jar flie, but it did not help.
this worked for me using db2jcc.jar
# type of database. Run with -dbhelp for details
schemaspy.t=db2
# optional path to alternative jdbc drivers.
schemaspy.dp=/lib/db2jcc.jar
# database properties: host, port number, name user, password
schemaspy.host=xxxxxx
schemaspy.port=xxxxx
schemaspy.db=xxx
schemaspy.u=xx
schemaspy.p=xx
# output dir to save generated files
schemaspy.o=/output
# db scheme for which generate diagrams
schemaspy.s=xxxx
driver=com.ibm.db2.jcc.DB2Driver
connectionSpec=jdbc:db2://xxx.xx.x.xxx:[PORT]/[DBNAME]
schemaspy.cat=%
The command used:
java -jar schemaspy-6.1.0.jar -configFile db2.properties --logging.pattern.console="%d{HH:mm:ss.SSS} %clr(%-5level) - %msg%n" --logging.level.org.schemaspy=TRACE

JasperReports Server - Error generating reports with scheduler

every week on monday we are generating some reports in the morning. We have no problem with the most of them, but 2 are failing sometimes (irregular).
This is the stacktrace of the exception we get with e-mail:
ExceptionConverter: java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(File.java:1704)
at java.io.File.createTempFile(File.java:1792)
at java.io.File.createTempFile(File.java:1828)
at com.jaspersoft.jasperserver.api.metadata.common.domain.util.FileBufferedOutputStream.ensureFileOutput(FileBufferedOutputStream.java:144)
at com.jaspersoft.jasperserver.api.metadata.common.domain.util.FileBufferedOutputStream.write(FileBufferedOutputStream.java:164)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
at com.lowagie.text.pdf.OutputStreamCounter.write(Unknown Source)
at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:109)
at com.lowagie.text.pdf.PdfStream.toPdf(Unknown Source)
at com.lowagie.text.pdf.PdfIndirectObject.writeTo(Unknown Source)
at com.lowagie.text.pdf.PdfWriter$PdfBody.add(Unknown Source)
at com.lowagie.text.pdf.PdfWriter$PdfBody.add(Unknown Source)
at com.lowagie.text.pdf.PdfWriter$PdfBody.add(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.addToBody(Unknown Source)
at com.lowagie.text.pdf.PdfWriter.add(Unknown Source)
at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
at com.lowagie.text.Document.newPage(Unknown Source)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:686)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:396)
at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.exportToPdf(EngineServiceImpl.java:548)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.PdfReportOutput.getOutput(PdfReportOutput.java:95)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.executeAndSendReport(ReportExecutionJob.java:485)
at com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportExecutionJob.execute(ReportExecutionJob.java:217)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Have someone an idea why some are failing and the most of them not?
We are using JasperReports Server 4.7 on a Linuxserver (Debian) with a Tomcat.
I see the error 'No such file or directory' which makes me wonder where you are saving the output? Is it being emailed, saved to the repository, or saved somewhere on the file system?

Importing OpenStreetMap data into PostgreSQL database

I'm trying to import one of the following OpenStreetMap maps 1, 2, 3 into a PostgreSQL database using calls like call osmosis.bat --read-xml file="map.osm" --write-pgsimp user="ccp-web-user" database="ccp-web2" password="ccp-web-password", but I always following error message.
SCHWERWIEGEND: Thread for task 1-read-xml failed
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to read the schema version from the schema info table.
at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:90)
at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateVersion(SchemaVersionValidator.java:50)
at org.openstreetmap.osmosis.pgsimple.v0_6.PostgreSqlWriter.initialize(PostgreSqlWriter.java:183)
at org.openstreetmap.osmosis.pgsimple.v0_6.PostgreSqlWriter.process(PostgreSqlWriter.java:773)
at org.openstreetmap.osmosis.xml.v0_6.impl.BoundsElementProcessor.end(BoundsElementProcessor.java:84)
at org.openstreetmap.osmosis.xml.v0_6.impl.OsmHandler.endElement(OsmHandler.java:107)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:111)
at java.lang.Thread.run(Unknown Source)
Caused by: org.postgresql.util.PSQLException: FEHLER: Relation ╗schema_info½ existiert nicht Position: 21
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
at org.openstreetmap.osmosis.pgsimple.common.SchemaVersionValidator.validateDBVersion(SchemaVersionValidator.java:71)
... 19 more
30.10.2012 23:06:56 org.openstreetmap.osmosis.core.Osmosis main
SCHWERWIEGEND: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed
.
at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
How can I fix this?
You need initialize PostGIS simple schema as described here.
The schema creation scripts can be found in the scripts directory within the osmosis distribution.
These scripts are:
pgsimple_schema_0.6.sql - Builds the minimal schema.
pgsimple_schema_0.6_action.sql - Adds the optional "action" table which allows derivative tables to be kept up to date when diffs are applied.
pgsimple_schema_0.6_bbox.sql - Adds the optional bbox column to the way table.
pgsimple_schema_0.6_linestring.sql - Adds the optional linestring column to the way table.
pgsimple_load_0.6.sql - A sample data load script suitable for loading the COPY files created by the --write-pgsimp-dump task.
If you are using PgAdmin3 open this files and execute them. Or use psql command. Of course PostGIS should be installed in your database.
I just had this issue, and found a solution for myself on Ubuntu.
If you think you have already followed the steps on https://wiki.openstreetmap.org/wiki/Osmosis/PostGIS_Setup through psql commands, but still encounter errors, then there is possibility that there can be some issue with user permissions when executing psql commands on Linux terminal, such as when creating postgis and hstore extensions, and when executing pgsnapshot schema.
What I did:
- After creating a database on the terminal
- I used PgAdmin, go to the database (e.g. pgsnapshot) and execute the step of creating extension postgis and hstore. Then execute one of the schema creation scripts (e.g. pgsnapshot_schema_0.6.sql) inside that PgAdmin query tool.
- After that, return to the terminal to execute commands (e.g.: osmosis --read-pbf ....)
These steps solved my issue.

error while loadin applet in web application

I want to run my applet on web application, but i got some error which i mentioned below please help me to get out of this problem
Java Plug-in 1.7.0
Using JRE version 1.7.0-ea-b116 Java HotSpot(TM) Client VM
User home directory = C:\Users\HONEY
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
java.lang.RuntimeException: java.lang.NoClassDefFoundError: mp3$1
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: mp3$1
at mp3.<init>(mp3.java:93)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: mp3$1
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
Caused by: java.io.IOException: open HTTP connection failed:http://viscous10.webng.com/mp3/mp3$1.class
at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 21 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: mp3$1
but it happens only if i run applet with events
and in simple applet i never occurred
This error means the Java runtime cannot find the .class file for an anonymous inner class of your mp3 class. Anonymous inner classes are named OuterClass$1, OuterClass$2, OuterClass$3 and so on. An example of the definition of an anonymous inner class:
button1.addActionListener(
new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
// do something
}
}
);
As it seems you are using inner classes, be aware that your mp3.java source file creates various .class files and make sure all of these .class files are available for the runtime environment (via copying, or adding them in a .jar file, etc).
to run the applet on web browser
write java code run the application on java
make the class file by using cmd prompt
give proper path and run your java file on cmd prompt to create class file
make html file add applet code in it <applet code=file.class archive =file.zip/jar></applet>
enabled java console from control panel
run the html file and refresh the window
NOTE: make sure class file, html file,zip or jar file having same name for avoiding any confusion