I have a problem connecting to an old project HSQLDB (need to migrate it to MySQL). The DB is standalone, file based. I'm using hsqldb-2.4.0 to connect.
Tried to follow all instructions and this forum tips to no avail. Getting authorization error java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification
This is what I do
1) start service
java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 file:db.hsqldb -dbname.0 xdb
--> seems to start correctly
2) trying to connect
java -cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing --driver org.hsqldb.jdbcDriver --URL jdbc:hsqldb:hsql://localhost/xdb --user "SA"
--> invalid authorization
My understanding from the script is that a default username/password (SA/no password) was used:
CREATE USER SA PASSWORD DIGEST '67a2fc38c682b3d55125dbc9d0bd26a3'
(not sure how to check it otherwise)
Any help/ideas are greatly appreciated.
The DIGEST is not for the default, empty string, password. Before starting the server, edit the .script file and change the digest to 'd41d8cd98f00b204e9800998ecf8427e', which is the digest for empty string passwords.
Related
I am struggling to get my java code (that uses HikariCP) to connect with my database on AWS RDS using SSL. I can connect with the database using MySQL Workbench, I just can't find out how to configure the MySQL Connector/J 5.1.45 driver to access the database using SSL.
Currently this is my HikariCP properties file:
jdbcUrl=jdbc:mysql://mypath.jqwejrkq4568833.us-east-1.rds.amazonaws.com:3306/myschema
username=myusername
password=mypassword
dataSource.cachePrepStmts=true
dataSource.prepStmtCacheSize=250
dataSource.prepStmtCacheSqlLimit=2048
dataSource.useServerPrepStmts=true
dataSource.useLocalSessionState=true
dataSource.useLocalTransactionState=true
dataSource.rewriteBatchedStatements=true
dataSource.cacheResultSetMetadata=true
dataSource.cacheServerConfiguration=true
dataSource.elideSetAutoCommits=true
dataSource.maintainTimeStats=false
dataSource.clientCertificateKeyStoreUrl=file://truststore
dataSource.clientCertificateKeyStorePassword=123456
dataSource.useSSL=true
dataSource.verifyServerCertificate=true
dataSource.requireSSL=true
The truststore file was generated with the RDS certificate from here, it's on my classpath root since it's on my resources folder from maven. I really want to provide my own truststore file to the MySQL Connector/J driver so this program can be moved around without having to configure the truststore from the environment (this is very useful for me because my code runs locally on GlassFish but on the cloud on AWS Lambda and who knows where will it run tomorrow).
When I try to get a connection using this configuration I get the following error:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot open file://truststore [truststore]
At first I thought my trustore url was wrong, but if I change it to something like this:
dataSource.clientCertificateKeyStoreUrl=file:///truststore
The error changes to:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot open file:///truststore [\truststore (The system cannot find the file specified)]
Which indicates for me that the first url was correct.
I have no idea what am I doing wrong or how to fix this, the `truststore was generated with the following command:
'C:\Program Files\Java\jre1.8.0_151\bin\keytool.exe' -importcert -alias AwsRdsMySqlCACert -file rds-combined-ca-bundle.pem -keystore truststore -storepass 123456
I have no idea what am I doing wrong, which leads me to the question:
What's wrong with my truststore file then?
EDIT:
Digging deeper I could find the cause of the Exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Cannot open file://truststore [truststore]
is:
java.net.UnknownHostException: truststore
I don't know what this means since my database url is correct because it's the same I use in MySQL Workbench.
if you are using Maven, make sure you are using the -Djavax.net.ssl.trustStore=/home/vagrant with the proper certificate , or configure the MAVEN_OPTS with the proper value for example : -Djavax.net.ssl.trustStore=/dev, also place it on the runner section in Intellij
We are using Weblogic Deployer Plugin for Jenkins 1.5 to deploy wars via Jenkins in Weblogic servers. The source, target & credentials are managed through default.xml file.
<weblogic-target>
<name>WeblogicServer</name>
<host>localhost</host>
<port>9001</port>
<login>JenkinsUser</login>
<password>deploy</password>
<authMode>BY_LOGIN</authMode>
</weblogic-target>
But in the console output of Jenkins, the password is being shown as plaintext. We have installed Mask Password plugin & configured it, but this is of no help.
Can someone put forward any idea about hiding this password from appearing in the Jenkins console output?
Finally got it! Weblogic Deployer Plugin version 2.3 onwards has built in capability of hiding password. It uses Weblogic's password encryption functionality. I had to just modify the default.xml like this:
<weblogic-target>
<name>WeblogicServer</name>
<host>localhost</host>
<port>9001</port>
<login>JenkinsUser</login>
<password>deploy</password>
<authMode>BY_KEY</authMode>
<userconfigfile>C:\users\MyUser\Desktop\userconfig</userconfigfile>
<userkeyfile>C:\users\MyUser\Desktop\userkey</userkeyfile>
</weblogic-target>
The userconfigfile & userkeyfile are a properties-key file pair which can be generated from either WLST script or cmd. For everyone's convenience am providing the commands below:
Go to your weblogic server installation folder --> bin, open cmd inside that folder & type setWLSEnv + enter.
java weblogic.Admin -adminurl t3://localhost:9001 -userid userid -password password -userconfigfile "Your designated path to store the file" -userkeyfile "Your designated path to store the file" -STOREUSERCONFIG
It will ask for confirmation, press Y & enter, the pair of files will be created. you can validate if this pair works by the following command:
java weblogic.Admin -adminurl t3://localhost:9001 -userconfigfile "Local path where you stored the confing file in previous step" -userkeyfile "Local path where you stored the key file in previous step" -GETSTATE
If it shows RUNNING then the file is working fine!
If you prefer to use Mask Password Plugin you can use the regex: -password\s.* in your job configuration.
These are my environment variables:
System variables:
JAVA_HOME C:\Program Files\Java\jdk1.8.0_20\
Path:
...;C:\Program Files\Java\jdk1.8.0_20\bin;...
I key the following in the command line:
c:\wsimport>wsimport http://www.webservicex.net/geoipservice.asmx?WSDL -Xdebug
I receive the following message
[DEBUG] Authorization file "C:\Users\myPC.metro\auth" not found. If
the WSDL access needs Basic Authentication, please provide
authorization file with read access at C:\Users\myPC.metro\auth or
use -Xauthfile to give the authorization file and on each line
provide authorization information using this format : http[s]://user:password#host:port//
parsing WSDL...
Where my configuration is incorrect?
I am not sure what happened but it's working now. It seems like my issue was perhaps related to my internet connection. I was online but the connection was pretty slow. Now everything's back to normal and my wsimport command is working.
I'm using jCifs 1.3.17 to connect and list files on remote windows share.
Everything works fine on my local JRE(5,6,7), but the same code executed on oracle 11g database (11.2.0.3.0) crashes with following stack:
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad
password. at
jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:546) at
jcifs.smb.SmbTransport.send(SmbTransport.java) at
jcifs.smb.SmbSession.sessionSetup(SmbSession.java) at
jcifs.smb.SmbSession.send(SmbSession.java:218) at
jcifs.smb.SmbTree.treeConnect(SmbTree.java:176) at
jcifs.smb.SmbFile.doConnect(SmbFile.java:911) at
jcifs.smb.SmbFile.connect(SmbFile.java:954) at
jcifs.smb.SmbFile.connect0(SmbFile.java:880) at
jcifs.smb.SmbFile.exists(SmbFile.java) at
pl.openlife.CifsConnect.listCIFSFiles(CifsConnect.java:49)
I found out, that user password lenght might cause the problem:
1. Windows env jdk1.5.0_22 -> works with long passwords
2. Oracle linux, RDMS embeded JVM -> works with short password only (8 characters)
3. Oracle linux, RDMS embeded JVM -> long password fails with error shown above.
Sample code:
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain,
username,
password);
SmbFile dir = new SmbFile(path,auth);
if(!dir.exists()){
// ABOVE CHECK FAILS
}
I heard somewhere about problems with oracle embedded jvm and bugs in JCE, but this shouldn't be the case, as jcifs have its own implementation of algorithms such as RC4 or DES. Does anyone have a clue what can be the case? Is there a way to walk this around?
Unfortunately I didn't find any answer to the issue mentioned above.
As a walkaround, I have used older version of jcifs (jcifs-1.2.25), which seems to work properly with oracle db embedded jvm.
UPDATE:
I have imported jcifs lib again (1.3.17) and it is working like a charm. I ended up with conclusion, that the java library was not imported properly. Reimport (loadjava) with option "-force" and manual compilation of invalid objects solves the problem always, but (I cant't figure why) in my case it must be loaded in following order :
1. Load my program lib (will cause errors)
2. Load jcifs lib with force option
3. compile and resolve
It seems that oracle jvm is unpredictable :)
I am trying to generate the java help classes that I need for a client (a.k.a consumer) for a SSL-protected web service (on Microsoft Biztalk) that is external to our company network. We can access it only over a proxy and we cannot change anything about the Webservice itself.
This is my command provided to the wsimport tool:
wsimport -keep -httpproxy:theProxy.net:8080 -s c:\generatedWebService_wsImport\ -p the.java.package.I.want.to.call.it -Xauthfile c:\generatedWebService_wsImport\auth https://meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
and this is the content of my auth file:
https://user:pwd#meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
And this is the error I get:
[ERROR] Server returned HTTP response code: 401 for URL: https:
//meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL,
"https:
//meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL"
needs authorization, please provide authorization file with read
access at C:\Documents and Settings\s6424.metro\auth or use
-Xauthfile to give the authorization file and on each line provide authorization information using this format :
http[s]://user:password#host:port//
Of course the proxy and credentials are different as in this post. The password contains a special character ! (exclamation mark).
Can someone help me with a working example under similar conditions. I had already searched a lot but couldn't find anything that would have helped me.
Is there somewhere a downloadable source code of the wsimport tool? This would be as the last resort to use.
Try to open https://user:pwd#meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
with your browser and save to local folder. Later you can use a wsimport like this:
wsimport -keep -s c:\generatedWebService_wsImport\ -p the.java.package.I.want.to.call.it /home/user/Download/example?WSDL
Regards,
in your request, you used
https://meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
in your auth file, it is
meldeservice-test.oekb.at:8080/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL
try removing the port number, change it to
https://user:pwd#meldeservice-test.oekb.at/Meldeservice/WebService_at_oekb_biztalk_MeldeService.asmx?WSDL