Beryx Badass Runtime TLSv1.3 javax.net.ssl.SSLProtocolException: Received close_notify during handshake - javafx

I have a user who has a license to use Swiss Topo maps and requires my application to pull these tiles down.
In my main project I pull the tiles from the following type of URL https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/[tile id].jpeg.
When I initially implemented this in my main project, which I compile as a non-modular image against OpenJDK11.0, there was an issue because of a known bug with TLSv1.3 pre openJDK11.02. The work around was to use the JVM param -Dhttps.protocols=TLSv1.2 to force my application to use TLSv1.2. This worked within my IDE but when I made the image using Beryx Badass Runtime it's as if the JVM param is ignored, I do see that Beryx has added it to the batch file that launches the image though.
I then decided I would try against OpenJDK 11.02 as this was meant to have a fix for TLSv1.3 and doesn't require that I force the TLS version to 1.2 with the JVM param. Again, this works when running from within my IDE (without a JVM param) but when I use Beryx to create the runtime image I see the same SSLExceptions. If I build the runtime with the following JVM param -Djavax.net.debug=ssl:handshake I see the following (it looks like OpenJDK11.02 only tries TLSv1.2?):
Reprex.bat
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: package javax.naming not in java.base
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.base specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.base specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-exports
WARNING: Unknown module: javafx.graphics specified to --add-exports
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/715.jpeg
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.146 GMT|null:-1|jdk.tls.keyLimits: entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.571 GMT|null:-1|the previous server name in SNI (type=host_name (0), value=wmts10.geo.admin.ch) was replaced with (type=host_name (0), value=wmts10.geo.admin.ch)
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.586 GMT|null:-1|Signature algorithm, ed25519, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, ed448, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA256withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA384withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.587 GMT|null:-1|Signature algorithm, SHA512withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.589 GMT|null:-1|Signature algorithm, SHA224withECDSA, is not supported by the underlying providers
javax.net.ssl|WARNING|1B|Thread-3|2022-11-30 13:10:17.590 GMT|null:-1|Signature algorithm, SHA1withECDSA, is not supported by the underlying providers
javax.net.ssl|INFO|1B|Thread-3|2022-11-30 13:10:17.591 GMT|null:-1|No available application protocols
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.592 GMT|null:-1|Ignore, context unavailable extension: application_layer_protocol_negotiation
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.593 GMT|null:-1|Ignore, context unavailable extension: cookie
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.622 GMT|null:-1|No session to resume.
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.622 GMT|null:-1|Ignore, context unavailable extension: pre_shared_key
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:17.623 GMT|null:-1|Produced ClientHello handshake message (
"ClientHello": {
"client version" : "TLSv1.2",
"random" : "31 5F 56 DC E8 EC 9D 92 1B C6 63 D0 F2 B7 62 83 18 E9 3E 13 6D D2 6D 0E 5E 63 39 7D 18 58 66 0E",
"session id" : "A3 84 68 4B EB 32 A8 27 22 62 73 44 42 03 76 CE 7C E4 A9 88 FC D1 E6 98 9D 70 BF D6 E0 D5 5F 20",
"cipher suites" : "[TLS_AES_128_GCM_SHA256(0x1301), TLS_AES_256_GCM_SHA384(0x1302), TLS_RSA_WITH_AES_256_GCM_SHA384(0x009D), TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(0x009F), TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(0x00A3), TLS_RSA_WITH_AES_128_GCM_SHA256(0x009C), TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(0x009E), TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(0x00A2), TLS_RSA_WITH_AES_256_CBC_SHA256(0x003D), TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(0x006B), TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(0x006A), TLS_RSA_WITH_AES_256_CBC_SHA(0x0035), TLS_DHE_RSA_WITH_AES_256_CBC_SHA(0x0039), TLS_DHE_DSS_WITH_AES_256_CBC_SHA(0x0038), TLS_RSA_WITH_AES_128_CBC_SHA256(0x003C), TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(0x0067), TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(0x0040), TLS_RSA_WITH_AES_128_CBC_SHA(0x002F), TLS_DHE_RSA_WITH_AES_128_CBC_SHA(0x0033), TLS_DHE_DSS_WITH_AES_128_CBC_SHA(0x0032)]",
"compression methods" : "00",
"extensions" : [
]
}
)
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.229 GMT|null:-1|Received alert message (
"Alert": {
"level" : "warning",
"description": "close_notify"
}
)
javax.net.ssl|ERROR|1B|Thread-3|2022-11-30 13:10:40.230 GMT|null:-1|Fatal (UNEXPECTED_MESSAGE): Received close_notify during handshake (
"throwable" : {
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sample.Main$1.call(Main.java:60)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)}
)
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.231 GMT|null:-1|close the underlying socket
javax.net.ssl|DEBUG|1B|Thread-3|2022-11-30 13:10:40.232 GMT|null:-1|close the SSL connection (passive)
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source)
at java.base/sun.security.ssl.TransportContext.dispatch(Unknown Source)
at java.base/sun.security.ssl.SSLTransport.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.decode(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(Unknown Source)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at sample.Main$1.call(Main.java:60)
at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
You will also notice a number of WARNING: Unknown module: messages at the start of that output but I'll address those later.
I have created a reprex project which can be found at https://github.com/chrisrush1/MVPDoExportsTLSReprex
I've included some commented out jvm params in the build.gradle which I've been using to see more detail on the SSL exception and to force the TLS version.
Within the Main.java there is some code I've commented out that will force the TLS version in code, I tried this to see if the Beryx runtime was failing to pass the JVM param but that isn't the issue.
Something different happens with the SSL request when running the image Beryx runtime creates than when the application is just run within the IDE and I'm struggling to see what that is.
Within the runtime block in my build.gradle I do the follow just to make sure it is using the correct OpenJDK which I set using the Env var JAVA_HOME, I don't think it should be necessary though.
runtime {
javaHome.set(System.getenv('JAVA_HOME'))
println "runtime JavaHome path:${javaHome.get()}"
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
}
In addition to the above issue you can see the WARNING messages about 'unknown module'. I've included all the add-exports and add-opens commands required by my main project in the build.gradle for this reprex project so that all these WARNINGS can be seen. These warnings are odd because they would imply the modules are missing but the main application runs correctly and wouldn't if I removed the add-exports/add-opens so I'm not sure why when launching the image from the bat file created these are displayed? javafx.graphics and javafx.controls are vital to my main project so they must be in the image as it launches and runs without issue so why the warnings?
The modules file created for my image with badass runtime contains the following
bin\java --list-modules
java.base#11.0.2
java.compiler#11.0.2
java.datatransfer#11.0.2
java.desktop#11.0.2
java.instrument#11.0.2
java.logging#11.0.2
java.management#11.0.2
java.management.rmi#11.0.2
java.naming#11.0.2
java.net.http#11.0.2
java.prefs#11.0.2
java.rmi#11.0.2
java.scripting#11.0.2
java.se#11.0.2
java.security.jgss#11.0.2
java.security.sasl#11.0.2
java.smartcardio#11.0.2
java.sql#11.0.2
java.sql.rowset#11.0.2
java.transaction.xa#11.0.2
java.xml#11.0.2
java.xml.crypto#11.0.2
jdk.accessibility#11.0.2
jdk.aot#11.0.2
jdk.attach#11.0.2
jdk.charsets#11.0.2
jdk.compiler#11.0.2
jdk.crypto.cryptoki#11.0.2
jdk.crypto.ec#11.0.2
jdk.crypto.mscapi#11.0.2
jdk.dynalink#11.0.2
jdk.editpad#11.0.2
jdk.hotspot.agent#11.0.2
jdk.httpserver#11.0.2
jdk.internal.ed#11.0.2
jdk.internal.jvmstat#11.0.2
jdk.internal.le#11.0.2
jdk.internal.opt#11.0.2
jdk.internal.vm.ci#11.0.2
jdk.internal.vm.compiler#11.0.2
jdk.internal.vm.compiler.management#11.0.2
jdk.jartool#11.0.2
jdk.javadoc#11.0.2
jdk.jcmd#11.0.2
jdk.jconsole#11.0.2
jdk.jdeps#11.0.2
jdk.jdi#11.0.2
jdk.jdwp.agent#11.0.2
jdk.jfr#11.0.2
jdk.jlink#11.0.2
jdk.jshell#11.0.2
jdk.jsobject#11.0.2
jdk.jstatd#11.0.2
jdk.localedata#11.0.2
jdk.management#11.0.2
jdk.management.agent#11.0.2
jdk.management.jfr#11.0.2
jdk.naming.dns#11.0.2
jdk.naming.rmi#11.0.2
jdk.net#11.0.2
jdk.pack#11.0.2
jdk.rmic#11.0.2
jdk.scripting.nashorn#11.0.2
jdk.scripting.nashorn.shell#11.0.2
jdk.sctp#11.0.2
jdk.security.auth#11.0.2
jdk.security.jgss#11.0.2
jdk.unsupported#11.0.2
jdk.unsupported.desktop#11.0.2
jdk.xml.dom#11.0.2
jdk.zipfs#11.0.2
My uderstanding was that the runtime plugin puts the javafx dependencies in the jar file under /lib along with my project classes, I see a lot of them in there including packages that are in javafx.base, javafx.controls and javafx.graphics, is this not where my image is using them from? Thanks
Thanks for any help with these issues.

This issue is NOT related to JavaFX specifically, it will manifest in any Java program packaged as modular jlinked images that use SSL.
In order for SSL to work in a modular Java image, you need to include the following module in the image:
jdk.crypto.cryptoki
Without this module, the jlinked image will hang trying to get an SSL socket, and eventually (after about 30 seconds) fail with the error:
javax.net.ssl.SSLProtocolException: Received close_notify during handshake
// at SSL related stack trace...
This will occur because jlink won't, by default, bind in the sun security provider for public key cryptography that is required to support SSL connections.
From the cryptoki documentation:
Provides the implementation of the SunPKCS11 security provider.
You need some kind of public key security provider for SSL to function, either the standard one from the JDK or a 3rd party one like Bouncy Castle. Without it, the rest of the app will work, but some cryptography will not. The lookup and usage of security algorithms is a runtime thing, so everything will work until you try to use it (e.g. when you try to open an SSL connection).
To fix it, you can create a modular app that requires the necessary module in the module-info.java file with this line:
requires jdk.crypto.cryptoki;
Demonstration
I am going to give a Maven-based answer as I am more familiar with that toolset. I don't know Gradle well enough to advise on how to translate this answer for Gradle. For testing, I used OpenJDK 19.0.1 and JavaFX 19 on OS X (Intel) 13.0.1.
This example is derived from code by rickybobby.
To build the linked app:
mvn javafx:jlink
To run the linked app:
./target/app/bin/app
src/main/java/sample/Main.java
package sample;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import java.io.InputStream;
import java.net.URL;
public class Main extends Application {
private static final String BASE_URL = "https://wmts10.geo.admin.ch/1.0.0/ch.swisstopo.pixelkarte-farbe/default/current/3857/11/1074/";
private ImageView iv;
#Override
public void start(Stage primaryStage) throws Exception {
HBox hBox = new HBox(0.0);
hBox.setPrefHeight(400);
hBox.setPrefWidth(600);
iv = new ImageView();
iv.setFitWidth(200);
iv.setFitHeight(150);
iv.setPreserveRatio(true);
hBox.getChildren().add(iv);
primaryStage.setScene(new Scene(hBox, 300, 275));
primaryStage.show();
//load map tile from server
Task<Void> mapTileLoadTask = new Task<>() {
#Override
protected Void call() throws Exception {
Thread.sleep(1000);
Image image = null;
for (int i = 715; i < 739; i++) {
String urlString = BASE_URL + i + ".jpeg";
System.out.println(urlString);
URL url = new URL(urlString);
try {
//open inputStream to show SSLHandshakeExpception seen in main project
InputStream inputStream = url.openConnection().getInputStream();
image = new Image(urlString, true);
} catch (Exception e) {
e.printStackTrace();
}
if (image != null)
setMapImage(image);
Thread.sleep(10);
}
return null;
}
};
new Thread(mapTileLoadTask).start();
}
public synchronized void setMapImage(Image image) {
Platform.runLater(() -> {
if (iv != null)
iv.setImage(image);
});
}
public static void main(String[] args) {
launch(args);
}
}
src/main/java/module-info.java
module com.example.maptilemaven {
requires javafx.controls;
// if you comment out this line, SSL handshakes will fail in jlinked images.
requires jdk.crypto.cryptoki;
exports sample;
}
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>maptilemaven</artifactId>
<version>1.0-SNAPSHOT</version>
<name>maptilemaven</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>19</source>
<target>19</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.maptilemaven/sample.Main</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
<!-- Normally the javafx maven plugin will find jlink in JAVA_HOME, but if you want to specify which version to use, set that here:
<jlinkExecutable>/Users/username/Library/Java/JavaVirtualMachines/openjdk-19.0.1/Contents/Home/bin/jlink</jlinkExecutable>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Verify of linked modules with this command:
.target/app/bin/java --list-modules
Outputs:
com.example.maptilemaven
java.base#19.0.1
java.datatransfer#19.0.1
java.desktop#19.0.1
java.prefs#19.0.1
java.xml#19.0.1
javafx.base#19
javafx.controls#19
javafx.graphics#19
jdk.crypto.cryptoki#19.0.1
jdk.crypto.ec#19.0.1
jdk.unsupported#19.0.1

Related

Sharing file create by an app in MODE_PRIVATE

So I have an app which writes sensor data to a csv file via FileOutputStream in MODE_PRIVATE
FileOutputStream fos = null;
try {
fos = context.openFileOutput(FILE_NAME,Context.MODE_PRIVATE);
for(int i = 0; i< signalList.size(); i++){
Signal s = signalList.get(i);
fos.write(s.toString().getBytes());
}
Log.d("WRITESTATUS","Success");
}
Now I wanted to share this file with other apps (whatsapp,email etc.). To achieve that, I am using the code below to share the intent. I was trying to use MODE_WORLD..something but that didn't work because it was deprecated so I learned through the other stackoverflow questions that we need to use FileProvider to make that happen but that didn't work either.
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType("*/*");
File file = getFileStreamPath(FILE_NAME);
Uri uri = FileProvider.getUriForFile(this,"com.example.writefile",file);
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
sharingIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sharingIntent, "Share SENSOR Data"));
<provider
android:authorities="com.example.writefile"
android:name="androidx.core.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_path"/>
</provider>
ERROR LOG
2020-06-22 16:27:34.047 6578-6578/? E/ample.writefil: Unknown bits set in runtime_flags: 0x8000
2020-06-22 16:27:34.147 6578-6578/com.example.writefile E/libc: Access denied finding property "vendor.iop.enable_uxe"
2020-06-22 16:27:36.043 6578-6578/com.example.writefile E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.writefile, PID: 6578
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:402)
at android.view.View.performClick(View.java:7158)
at android.view.View.performClickInternal(View.java:7135)
at android.view.View.access$3500(View.java:801)
at android.view.View$PerformClick.run(View.java:27373)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:235)
at android.app.ActivityThread.main(ActivityThread.java:7441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397)
at android.view.View.performClick(View.java:7158) 
at android.view.View.performClickInternal(View.java:7135) 
at android.view.View.access$3500(View.java:801) 
at android.view.View$PerformClick.run(View.java:27373) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:235) 
at android.app.ActivityThread.main(ActivityThread.java:7441) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 
Caused by: java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.example.writefile/files/sensor.csv
at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
at com.example.writefile.MainActivity.Clicked(MainActivity.java:266)
at java.lang.reflect.Method.invoke(Native Method) 
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:397) 
at android.view.View.performClick(View.java:7158) 
at android.view.View.performClickInternal(View.java:7135) 
at android.view.View.access$3500(View.java:801) 
at android.view.View$PerformClick.run(View.java:27373) 
at android.os.Handler.handleCallback(Handler.java:883) 
at android.os.Handler.dispatchMessage(Handler.java:100) 
at android.os.Looper.loop(Looper.java:235) 
at android.app.ActivityThread.main(ActivityThread.java:7441) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935) 
Change this and it will work- I have taken hint from here and tried different configuration and this works, I don't know why.
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path
name="sensor"
path="."/>
</paths>

Vaadin 7.7.16 -> java.lang.ClassNotFoundException: com.vaadin.server.VaadinServlet

On Vaadin 7.3.6 this code work fine:
import org.apache.log4j.Logger;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext; this work fine
import org.apache.log4j.Logger;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
private void start() {
try {
WebAppContext context = new WebAppContext();
Server server = new Server(port);
String descriptor = getClass().getResource("/web.xml").toString();
context.setDescriptor(descriptor);
context.setResourceBase("classpath");
context.setParentLoaderPriority(true);
if (ProxyConfig.secureCookies())
context.getSessionHandler().getSessionManager().getSessionCookieConfig().setSecure(true);
server.setSendServerVersion(false);
server.setHandler(context);
BackendService.getInstance();
server.start(); // ERROR HERE
server.join();
} catch (Throwable e) {
logger.error(e.getMessage(), e);
}
}
But on Vaadin 7.7.16 I get error:
[ERROR] 27.02.2019 20:26:33.375 [main] myproject.client.AppStarter.start(AppStarter.java:42)
com/vaadin/server/VaadinServlet
java.lang.NoClassDefFoundError: com/vaadin/server/VaadinServlet
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:407)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:79)
at org.eclipse.jetty.servlet.Holder.doStart(Holder.java:107)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:298)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:791)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
at org.eclipse.jetty.server.Server.doStart(Server.java:282)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at myproject.client.AppStarter.start(AppStarter.java:35)
at myproject.client.AppStarter.<init>(AppStarter.java:56)
at myproject.client.AppStarter.main(AppStarter.java:61)
Caused by: java.lang.ClassNotFoundException: com.vaadin.server.VaadinServlet
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 31 more
[DEBUG] 27.02.2019 20:26:38.255 [DICTIONARY_SYNC] myproject.client.service.DictionaryService$1.run(DictionaryService.java:38)
Caused by: java.lang.ClassNotFoundException:
com.vaadin.server.VaadinServlet
The class that is obviously not found on the class path (VaadinServlet) is contained in vaadin-server-7.7.16.jar. You must ensure that this library is on your class path when starting your application.
I created a minimum example project (maven) based on the maven archetype vaadin-archetype-aaplication by command:
mvn archetype:generate \
-DarchetypeGroupId=com.vaadin \
-DarchetypeArtifactId=vaadin-archetype-application \
-DarchetypeVersion=7.7.16 \
-DgroupId=com.pany \
-DartifactId=project-name \
-Dversion=0.1 \
-Dpackaging=war
and added your code in UI.init(VaadinRequest vaadinRequest) (+ I added a dependency for jetty-webapp to get the imports resolved).
If I have the following dependency in my pom.xml
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
</dependency>
(which it is by default in that archetype)
I can run/start the app without any problems.
If I know force that the vaadin-server dependency is not added to the class path (by marking it as provided)
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<scope>provided</scope>
</dependency>
Then when trying to start the app it fails with:
[ERROR] Failed to execute goal
org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run (default-cli)
on project project-name: Execution default-cli of goal
org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run failed: A
required class was missing while executing
org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run:
com/vaadin/server/VaadinServlet
because the mentioned class is no longer on the class path.

Firestore ClassNotFoundException: com.google.auth.oauth2.GoogleCredentials and com/google/api/client/googleapis/util/Utils

I have a gradle project in Intellij where I am trying to access the Firestore database by following the guide https://firebase.google.com/docs/admin/setup but it throws ClassNotFoundException for google-oauth2 GoogleCredentials and in FirebaseOptions$Builder for google-api Utils.
Following is my code.
FileInputStream serviceAccount = new FileInputStream("path/to/serviceAccountKey.json");
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount);
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(googleCredentials)
.setDatabaseUrl("https://<DATABASE_NAME>.firebaseio.com/")
.build();
FirebaseApp.initializeApp(options);
But that throws ClassNotFoundException for com/google/auth/oauth2/GoogleCredentials
com/google/auth/oauth2/GoogleCredentials: java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: com/google/auth/oauth2/GoogleCredentials
at com.amazon.asksdk.roomservice.data.DatabaseInitializer.initialize(DatabaseInitializer.java:36)
at com.amazon.asksdk.roomservice.data.TasksDAO.<init>(TasksDAO.java:28)
at com.amazon.asksdk.roomservice.RoomServiceSpeechlet.onSessionStarted(RoomServiceSpeechlet.java:54)
at com.amazon.speech.speechlet.SpeechletRequestDispatcher.dispatchSpeechletCall(SpeechletRequestDispatcher.java:112)
at com.amazon.speech.speechlet.SpeechletRequestHandler.internalHandleSpeechletCall(SpeechletRequestHandler.java:152)
at com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:115)
at com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:89)
Caused by: java.lang.ClassNotFoundException: com.google.auth.oauth2.GoogleCredentials
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
And writing it like this:
FileInputStream serviceAccount = new FileInputStream("path/to/serviceAccountKey.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://<DATABASE_NAME>.firebaseio.com/")
.build();
FirebaseApp.initializeApp(options);
Throws exception in FirebaseOptions$Builder for googleapis Utils
com/google/api/client/googleapis/util/Utils: java.lang.NoClassDefFoundError
java.lang.NoClassDefFoundError: com/google/api/client/googleapis/util/Utils
at com.google.firebase.FirebaseOptions$Builder.<init>(FirebaseOptions.java:197)
at com.amazon.asksdk.roomservice.data.DatabaseInitializer.initialize(DatabaseInitializer.java:45)
at com.amazon.asksdk.roomservice.data.TasksDAO.<init>(TasksDAO.java:28)
at com.amazon.asksdk.roomservice.RoomServiceSpeechlet.onSessionStarted(RoomServiceSpeechlet.java:54)
at com.amazon.speech.speechlet.SpeechletRequestDispatcher.dispatchSpeechletCall(SpeechletRequestDispatcher.java:112)
at com.amazon.speech.speechlet.SpeechletRequestHandler.internalHandleSpeechletCall(SpeechletRequestHandler.java:152)
at com.amazon.speech.speechlet.SpeechletRequestHandler.handleSpeechletCall(SpeechletRequestHandler.java:115)
at com.amazon.speech.speechlet.lambda.SpeechletRequestStreamHandler.handleRequest(SpeechletRequestStreamHandler.java:89)
Caused by: java.lang.ClassNotFoundException: com.google.api.client.googleapis.util.Utils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more
build.gradle
dependencies {
compile 'com.amazon.alexa:alexa-skills-kit:1.5.0'
compile 'com.amazonaws:aws-lambda-java-core:1.0.0'
compile 'com.amazonaws:aws-java-sdk-dynamodb:1.9.40'
compile 'com.amazonaws:aws-lambda-java-log4j:1.0.0'
implementation 'com.google.firebase:firebase-admin:6.0.0'
compile 'log4j:log4j:1.2.17'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
compile 'org.eclipse.jetty:jetty-server:9.0.6.v20130930'
compile 'org.eclipse.jetty:jetty-servlet:9.0.6.v20130930'
compile 'org.slf4j:slf4j-api:1.7.10'
}
How do I resolve this since gradle should be taking care of the correct dependencies by itself? I have tried explicitly adding the following but that didn't work:
compile 'com.google.oauth-client:google-oauth-client:1.23.0'
compile 'com.google.oauth-client:google-oauth-client-servlet:1.23.0'
compile 'com.google.oauth-client:google-oauth-client-appengine:1.23.0'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
I also see these in the External Libraries. I am trying to run this project by AWS lambda, so I upload the jar to lambda to eventually run this.

error in JSF deployment with external JAR

I try to add an external JAR library to my JSF project.
My Project structure Looks like this:
XXX (EAR)
XXXWeb
XXXEJB
When I deploy my Project I get the following error from my Wildfly 10.1 console:
15:42:52,338 WARN [org.jboss.modules] (default task-185) Failed to define class de.sqs.topInterface.IAPIException in Module "deployment.sqs-selfservice.ear.sqs-selfserviceWeb.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link de/sqs/topInterface/IAPIException (Module "deployment.sqs-selfservice.ear.sqs-selfserviceWeb.war:main" from Service Module Loader): org/omg/CORBA/UserException
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 org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
15:42:52,338 ERROR [org.jboss.as.ejb3.invocation] (default task-185) WFLYEJB0034: EJB Invocation failed on component SQSBean for method public java.lang.String de.ruv.sqs usc.web.beans.SQSBean.connect(): javax.ejb.EJBException: WFLYEJB0442: Unexpected Error
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:184)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
Caused by: java.lang.NoClassDefFoundError: Failed to link de/sqs/topInterface/IAPIException (Module "deployment.sqs-selfservice.ear.sqs-selfserviceWeb.war:main" from Service Module Loader): org/omg/CORBA/UserException
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 org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at de.ruv.sqsusc.web.beans.SQSBean.connect(SQSBean.java:23)
SQSBean.java:
import de.ruv.sqs.connector.SQS_Connector;
#Stateless
#Named("sqs")
public class SQSBean {
public String connect() {
SQS_Connector sc = new SQS_Connector(); // <<-- 23
}
}
At first I tried to add the libraries to EJB. After that I added it to WEB-INF/lib and to EAR/lib. But the error remains the same.
So where and how do I have to include external JAR library files with a common Software API to have access to them in my JSF Webaplication?
If you have an example or how to, it would be very, very nice!
Thank you!

errors deploying an EAR with EJBs 2.1 into JBoss AS5

I'm porting an application with EJBs 2.1 from Weblogic9 to JBoss AS5. I have made some of the changes like adding jboss.xml descriptors to EJBs and fixing application.xml of the EAR, but there are still problems when deploying the EAR. Here is a summary of the the latest error I'm getting when the first EJB is being deployed by JBoss (I will add the full stack trace at the end of the message):
14:15:48,124 ERROR [AbstractKernelController] Error installing to Parse: name=vf
sfile:/C:/Marina/Tools/jboss-5.1.0.GA/server/default/deploy/contracts.ear/ state
=Not Installed mode=Manual requiredState=Parse
org.jboss.deployers.spi.DeploymentException: Error creating managed object for v
fsfile:/C:/Marina/Tools/jboss-5.1.0.GA/server/default/deploy/contracts.ear/admin
-ejb.jar/
....
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed
to parse schema for nsURI=, baseURI=null, schemaLocation=http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd
....
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 94:3 The markup in the document preceding the root element must be well-formed.
Is this a problem with parsing the jboss_2_4.dtd itself? or is it something worng with my descriptors for the EJB?
When I try to validate the jboss_2_4.dtd in an XML editor it does complain about a syntax error at line 94:1 , which is the beginning of the first declaration, although it looks fine. Any ideas?
Thanks!
Marina
Full error stack trace:
14:15:48,124 ERROR [AbstractKernelController] Error installing to Parse: name=vf
sfile:/C:/Marina/Tools/jboss-5.1.0.GA/server/default/deploy/contracts.ear/ state
=Not Installed mode=Manual requiredState=Parse
org.jboss.deployers.spi.DeploymentException: Error creating managed object for v
fsfile:/C:/Marina/Tools/jboss-5.1.0.GA/server/default/deploy/contracts.ear/admin
-ejb.jar/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentExcept
ion(DeploymentException.java:49)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO
utput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO
utput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO
utput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbP
arsingDeployer.java:95)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO
utput.deploy(AbstractParsingDeployerWithOutput.java:234)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(Deployer
Wrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(Deployer
sImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(Deployers
Impl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(Deployers
Impl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeploye
rImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter
.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction
.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileActi
on.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(
ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:
461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed
to parse schema for nsURI=, baseURI=null, schemaLocation=http://www.jboss.org/j
2ee/dtd/jboss_2_4.dtd
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBPars
er.java:203)
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java
:168)
at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:189)
at org.jboss.xb.util.JBossXBHelper.parse(JBossXBHelper.java:166)
at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(Sch
emaResolverDeployer.java:137)
at org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer.parse(Sch
emaResolverDeployer.java:121)
at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse
AndInit(AbstractVFSParsingDeployer.java:256)
at org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer.parse
(AbstractVFSParsingDeployer.java:188)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithO
utput.createMetaData(AbstractParsingDeployerWithOutput.java:348)
... 35 more
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to parse schema
for nsURI=, baseURI=null, schemaLocation=http://www.jboss.org/j2ee/dtd/jboss_2_4
.dtd
at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(A
bstractMutableSchemaResolver.java:293)
at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startE
lement(SundayContentHandler.java:274)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHan
dler.startElement(SaxJBossXBParser.java:401)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
ce)
at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
e)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
e)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
canRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known 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 Sour
ce)
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBPars
er.java:199)
... 43 more
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: -1:-1 94:3 The markup i
n the document preceding the root element must be well-formed.
at org.jboss.xb.binding.sunday.unmarshalling.XsdBinderTerminatingErrorHa
ndler.handleError(XsdBinderTerminatingErrorHandler.java:40)
at org.apache.xerces.impl.xs.XMLSchemaLoader.reportDOMFatalError(Unknown
Source)
at org.apache.xerces.impl.xs.XSLoaderImpl.load(Unknown Source)
at org.jboss.xb.binding.Util.loadSchema(Util.java:395)
at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.ja
va:176)
at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.ja
va:147)
at org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver.resolve(A
bstractMutableSchemaResolver.java:285)
... 58 more
I'd like to see your jboss.xml but I really wonder why you're using this very dusty jboss_2_4.dtd (the "JBoss 2.4 EJB deploymentDescriptor"). Since you're using JBoss AS 5.1, I'd recommend using the moderner jboss_5_1.xsd schema instead (see JBossDTDs for reference). Below an empty sample:
<jboss xmlns="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
http://www.jboss.org/j2ee/schema/jboss_5_1.xsd"
version="3.0">
</jboss>

Resources