claimvantage / force-metadata-jdbc-driver

Full and detailed Salesforce database schema export via SchemaSpy
MIT License
13 stars 7 forks source link

[Support] `Unable to resolve databaseType: force` #5

Closed eeshugerman closed 5 years ago

eeshugerman commented 5 years ago

Hi, I'm trying to upgrade to SchemaSpy v6.0.0 and came across your fork of this driver. Sweet! However I'm running into the same error as with v2.2:

ERROR - Bad parameter: '-t = force' , Unable to resolve databaseType: force

In greater detail:

$ java -jar /opt/{{ schemaspy_filename }} \
      -dp /opt/{{ force_driver_filename }} \
      -debug \
      -t force \
      -u {{ salesforceusername }} -p {{ salesforcepasswordandtoken }} \
      -o  {{ output_path }} \
      -db {{ db }} \
      -cat % -s force \
      -connprops {{ connprops }}
INFO  - Starting Main v6.0.0 on ubuntu-xenial with PID 14183 (/opt/schemaspy-6.0.0.jar started by etluser in /home/etluser)
INFO  - The following profiles are active: default
INFO  - Started Main in 4.162 seconds (JVM running for 5.819)
DEBUG - Debug enabled
INFO  - Configuration file not found
INFO  - Starting schema analysis
DEBUG - Command line parameters: [-dp, /opt/force-metadata-jdbc-driver-2.3.jar, -debug, -t, force, -u, [[ redacted ]], -p, [[ redacted ]], -o, [[ redacted ]], -db, [[ redacted ]], -cat, %, -s, force, -connprops, [[ redacted ]]]
ERROR - Bad parameter: '-t = force' , Unable to resolve databaseType: force
org.schemaspy.model.InvalidConfigurationException: Unable to resolve databaseType: force
    at org.schemaspy.db.config.PropertiesResolver.getDbProperties(PropertiesResolver.java:66)
    at org.schemaspy.Config.getDbProperties(Config.java:1176)
    at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:61)
    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(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: org.schemaspy.db.config.ResourceNotFoundException: force
    at org.schemaspy.db.config.PropertiesFinder.find(PropertiesFinder.java:55)
    at org.schemaspy.db.config.PropertiesResolver.getDbProperties(PropertiesResolver.java:58)
    ... 16 common frames omitted

I'm very much a Java noob so sorry if this is something dumb!

jefersonchaves commented 5 years ago

Hey there. I think this might a typo on command-line: dp instead of cp. Can you please check?

java -jar /opt/{{ schemaspy_filename }} \
      -cp /opt/{{ force_driver_filename }} \
      -debug \
      -t force \
      -u {{ salesforceusername }} -p {{ salesforcepasswordandtoken }} \
      -o  {{ output_path }} \
      -db {{ db }} \
      -cat % -s force \
      -connprops {{ connprops }}
eeshugerman commented 5 years ago

Hello! I'm afraid that does not fix the issue; I get the same error. I am using -dp because that is what the readme says to use for v6.0.0 and also what java -jar /opt/schemaspy-6.0.0.jar --help documents.

jefersonchaves commented 5 years ago

Ok, let me check again. I'm not very familiar with this as well.

npetzall commented 5 years ago

Add: https://raw.githubusercontent.com/claimvantage/force-metadata-jdbc-driver/master/force.properties As force.properties in your workdir

jefersonchaves commented 5 years ago

Hey @eeshugerman, just tried the suggestion from @npetzall and it worked like a charm. Ended with 3 filles (schemaspy 6 + force jar + force.properties).

eeshugerman commented 5 years ago

Thanks! That seemed to do the trick, but now I'm hitting a new error:

INFO  - Started Main in 1.561 seconds (JVM running for 2.059)
DEBUG - Debug enabled
INFO  - Configuration file not found
INFO  - Starting schema analysis
DEBUG - Resolving dbType: force ->
    force.properties
DEBUG - Unable to find driverClass 'com.claimvantage.force.jdbc.ForceMetaDataDriver'
WARN  - Connection Failure
org.schemaspy.model.ConnectionFailure: Failed to connect to database URL [jdbc:claimvantage:force] Failed to create any of 'com.claimvantage.force.jdbc.ForceMetaDataDriver' driver from driverPath '/opt/force-metadata-jdbc-driver-2.3.jar' with sibling jars no.
Resulting in classpath:
    file:/opt/force-metadata-jdbc-driver-2.3.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(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: org.schemaspy.model.ConnectionFailure: Failed to create any of 'com.claimvantage.force.jdbc.ForceMetaDataDriver' driver from driverPath '/opt/force-metadata-jdbc-driver-2.3.jar' with sibling jars no.
Resulting in classpath:
    file:/opt/force-metadata-jdbc-driver-2.3.jar

    at org.schemaspy.DbDriverLoader.getDriver(DbDriverLoader.java:147)
    at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:93)
    ... 15 common frames omitted

There is more debug output I could provide if that would be helpful. I could also open a new issue for this if you would prefer.

npetzall commented 5 years ago

@eeshugerman Could you verify the size of /opt/force-metadata-jdbc-driver-2.3.jar? Also if there is more output that would be great.

npetzall commented 5 years ago

@eeshugerman I think the problem is with force-metadata-jdbc-driver-2.3.jar I downloaded it, which is a bit tricky, so it should be added as a release, under releases here on github. You need to click the file, get the download button while you have the option to "view raw".

Schemaspy doesn't validate that the file is a proper jar-file since anything can be added to the classpath. So a corrupt or improper jar will still be listed as a valid classpath entry.

I replaced my jar with a text-file with the content "404" and got the same error as you.

eeshugerman commented 5 years ago

That's it! There was an issue with the way I was trying to downloading the "jar" programmatically... I was actually downloading the html at https://github.com/claimvantage/force-metadata-jdbc-driver/blob/master/dist/force-metadata-jdbc-driver-2.3.jar. :man_facepalming: My bad.

Thanks for your help!

+1 for a github release

jefersonchaves commented 5 years ago

@npetzall & @eeshugerman: thanks for the feedback and I'm glad the problem is solved. I've created a new issue (feature request) to track the release: #6.