Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting an Exception when running against Oracle database in charset ISO-8859-15 #1444

Open
MetalCamel opened this issue Apr 25, 2024 · 2 comments

Comments

@MetalCamel
Copy link

I am using Schemaspy 6.2.4 and running it against Oracle databases but I am receiving an Exception:
This only happens with our Oracle Databases with charset "ISO-8859-15" (NLS_CHARACTERSET WE8ISO8859P15)
We also have Oracle Database with charset "UTF-8" (NLS_CHARACTERSET AL32UTF8) there I have no problems running Schemaspy.

Current Behavior

with Schemaspy 6.2.4:

INFO - Starting schema analysis
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.NullPointerException
at org.schemaspy.input.dbms.DbDriverLoader.(DbDriverLoader.java:85)
at org.schemaspy.input.dbms.DbDriverLoader.(DbDriverLoader.java:74)
at org.schemaspy.input.dbms.DbDriverLoader.(DbDriverLoader.java:70)
at org.schemaspy.input.dbms.service.SqlService.connect(SqlService.java:69)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:244)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:135)
at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:109)
at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:98)
at org.schemaspy.Main.main(Main.java:55)
... 8 more

with Schemaspy 6.1.0:

TRACE - Returning cached instance of singleton bean 'schemaSpyRunner'
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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: java.io.UncheckedIOException: java.nio.charset.MalformedInputException: Input length = 1
at java.io.BufferedReader$1.hasNext(BufferedReader.java:574)
at java.util.Iterator.forEachRemaining(Iterator.java:115)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.schemaspy.Config.loadProperties(Config.java:1334)
at org.schemaspy.Config.fixupArgs(Config.java:1306)
at org.schemaspy.Config.(Config.java:162)
at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:98)
at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:87)
at org.schemaspy.Main.main(Main.java:55)
... 8 more
Caused by: java.nio.charset.MalformedInputException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:281)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.readLine(BufferedReader.java:324)
at java.io.BufferedReader.readLine(BufferedReader.java:389)
at java.io.BufferedReader$1.hasNext(BufferedReader.java:571)
... 21 more

here is my schemaspy.properties file:

{
# type of database. Run with -dbhelp for details
schemaspy.t=orathin

# database properties: host, port number, name user, password
schemaspy.host=xxxxxxxx
schemaspy.port=1521
schemaspy.db=NTX
schemaspy.u=maw
schemaspy.p=xxxxxx

# db scheme for which generate diagrams
schemaspy.s=MAW
}

Context

Database type (e.g. MySQL): ORACLE  Version 19.18.0.0.0
Database driver version (is you use a special one): ojdbc8-21.1.0.0.jar
Full command including arguments how you run SchemaSpy: `java -jar $FSYS/$FHGKD/Java/Schemaspy/schemaspy-6.1.0.jar -dp $FSYS/$FHGKD/Java/Schemaspy/ojdbc8-21.1.0.0.jar -configFile $FHGENV/Cmd/schemaspy.properties -o $FHGDOKU/Schemaspy/schema_${FHGDB}_${NOW} -cat %`

Your Environment

Version used: 6.0.0, 6.1.0, 6.2.4
Operating System and version (e.g. Windows 10): SUSE Linux Enterprise Server 10 (i586)
Java version: java version "1.8.0_261"  Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
@npetzall
Copy link
Member

Just because the 6.1.0 error is strange. Are the databases on different hosts and are you running them om the host.

6.1.0 feels like its related to the host character encoding.

But I'll read thru the 6.2.4 stacktrace and match it with the code as soon as I get some spare time.

@npetzall
Copy link
Member

npetzall commented Jun 8, 2024

I'm sorry that it has taken so much time. But both errors in 6.1.0 and 6.2.4 might be related to encoding. I'm gonna assume that when you are running SchemaSpy for the different databases your actually also running SchemaSpy on two different systems.

properties.getProperty("driver").split(","),

Bit unclear if the null pointer is the property or the key. I'm gonna see if I can provoke this using a container or changing the default encoding when running java.

I think -Dfile.encoding="UTF-8" -Dsun.jnu.encoding="UTF-8" before the -jar might solve the problem, unless the schemaspy.properties is also in a strange encoding, it should be encoded in ISO 8859-1

But I'm gonna see if I can force ISO-8859-15 and get the same error. Then I'll try to figure out what we can do to avoid this. Might be that we need to force encoding or support mix of encoding better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants