Eclipse Project ORA-28040 Exception Despite Updated OJDBC - java

I joined a new project and I am working on it through Eclipse. For reference, the server is running on Oracle 19c, and is being managed by a different team.
I tried putting the project onto my Tomcat server and connecting to it, but it gives me an ORA-28040 exception. Here's the exact exception message:
2022/1/11 11:08:45.847 [TRACE] com.nuorbit.persistence.DBConnection Opening DriverManager connection
2022/1/11 11:08:46.402 [TRACE] com.nuorbit.persistence.DBConnection Opening DriverManager connection
2022/1/11 11:08:46.946 [ERROR] com.nuorbit.utils.Errors java.sql.SQLException: ORA-28040: No matching authentication protocol
java.sql.SQLException: ORA-28040: No matching authentication protocol
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:294)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:357)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.nuorbit.persistence.DBConnection.getConnectionByDriverManager(DBConnection.java:113)
at com.nuorbit.persistence.DBConnection.getConnection(DBConnection.java:77)
at com.nuorbit.persistence.DBConnection.getConnection(DBConnection.java:65)
at com.nuorbit.utils.Settings.getSetting(Settings.java:116)
at com.nuorbit.servlet.Startup.init(Startup.java:22)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1152)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1097)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:990)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4952)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5266)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I looked around for what might be causing that, and came across two common answers: replacing my ojdbc jar file, or changing the server's sqlnet.ora file by adding the following snipet:
SQLNET.ALLOWED_LOGON_VERSION=10
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=10
SQLNET.ALLOWED_LOGON_VERSION_SERVER=10
Since the server is not under my control, I tried to do the former. I went into the build path, and replaced ojdbc14.jar with ojdbc8-19.3.0.0.jar. However, this still results in the same error, so I am not sure what I am doing wrong.
For reference, I am able to connect to the server using SQL Developer, as well as using Database Connection in the Data Source Explorer in Eclipse, so it seems like it's something wrong with my project specifically.
Let me know if there's anything I can clarify.

Turns out that the old ojdbc was also in referenced libraries, so I needed to remove it from there to get it to work. Just replacing it on the build path wasn't enough.

Related

Liquibase 3.7.0 on Azure - Unexpected Liquibase Exception: Cannot find LockService

I am currently working on a Java8 WebApp with Hibernate and Vaadin and Liquibase as a dependency which I tried to run on Azure for testing.I didn't write this app myself and the version that was given to me was originally using Liquibase 3.0.7 and apparently running on a Tomcat 8.0.28
I updated this to 3.7.0 (see bottom for specific reasons why) and now get the following error:
liquibase.exception.UnexpectedLiquibaseException: Cannot find LockService for unsupported
liquibase.lockservice.LockServiceFactory.getLockService(LockServiceFactory.java:74)
liquibase.Liquibase.update(Liquibase.java:183)
liquibase.Liquibase.update(Liquibase.java:179)
liquibase.Liquibase.update(Liquibase.java:175)
liquibase.Liquibase.update(Liquibase.java:168)
com.app.test.AppServlet.initDB(AppServlet.java:86)
com.app.test.AppServlet.servletInitialized(AppServlet.java:44)
com.vaadin.server.VaadinServlet.init(VaadinServlet.java:217)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
I am testing locally with a tomcat 8.5.47 and a Tomcat 7 as well as the tomcat7 maven plugin that allows me to run the app with maven and see all the logging in the console. I am trying to deploy the .war to a Tomcat 8.5 on Azure.
So I got the following Servers:
Tomcat 8.5.47 (local)
Tomcat 7.0.96 (local)
Tomcat 7.x (Maven Plugin)
Tomcat 8.5.41 (Azure)
The above problem occurs only on Azure
All the local Servers seem to work (I did not go too deep into testing though, but at least they render the front-page).
The database is a MariaDB also running on Azure and all of the configuration for the connection is made in the code via hibernate config or in the jdbc connection string, so all the servers run the same code and connect to the exact same db.
I already tried the latest Version 3.8.0 but have the same problem there so I got back to 3.7.0
How can I fix this error?
Update:
I found more errors in the server log after activating verbose logging:
2019-10-23T13:30:58.611225727Z Caused by: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find unique implementation of liquibase.executor.Executor. Found 0 implementations
2019-10-23T13:30:58.611235727Z at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:216) ~[liquibase-core-3.7.0.jar:na]
2019-10-23T13:30:58.611246427Z at liquibase.executor.ExecutorService.lambda$getExecutor$0(ExecutorService.java:26) ~[liquibase-core-3.7.0.jar:na]
2019-10-23T13:30:58.611256327Z ... 31 common frames omitted
2019-10-23T13:30:58.611265628Z Caused by: liquibase.exception.ServiceNotFoundException: Could not find unique implementation of liquibase.executor.Executor. Found 0 implementations
2019-10-23T13:30:58.611275428Z at liquibase.servicelocator.ServiceLocator.findClass(ServiceLocator.java:188) ~[liquibase-core-3.7.0.jar:na]
2019-10-23T13:30:58.611285028Z at liquibase.servicelocator.ServiceLocator.newInstance(ServiceLocator.java:214) ~[liquibase-core-3.7.0.jar:na]
2019-10-23T13:30:58.611294328Z ... 32 common frames omitted
and
2019-10-24T08:59:39.545505776Z 24.10.2019 08:59:39.483 INFO com.app.test.AppServlet - servletInitialized
2019-10-24T08:59:39.546076490Z 24.10.2019 08:59:39.492 INFO com.app.test.AppServlet - initDB
2019-10-24T08:59:40.130035108Z 24.10.2019 08:59:40.129 WARN liquibase.database.DatabaseFactory - Unknown database: MySQL
2019-10-24T08:59:40.162920831Z 24.10.2019 08:59:40.162 INFO l.database.core.UnsupportedDatabase - Error getting default schema
2019-10-24T08:59:40.162974433Z liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.ServiceNotFoundException: liquibase.exception.ServiceNotFoundException: Could not find
unique implementation of liquibase.executor.Executor. Found 0 implementations
More Background
Azure only allows me to create App Services with Tomcat 8.5 or 9 and the App in it's original state would not work on both of the Tomcat 8.5 servers.
I received an error: Could not find implementation of liquibase.logging.Logger
Updating Liquibase to 3.2.3 (because that's where the error should've been fixed) fixed this for all of my local machines, but I still received it on Azure.
After updating to 3.7.0 I do not receive the could not find implementation.. error anymore but now receive the error above as well as a problem with my xml scheme which doesn't seem to crash the app though and doesn't seem to be related:
Caused by: org.xml.sax.SAXParseException: s4s-elt-schema-ns: Namespace des Elements 'databaseChangeLog' muss aus dem Schema-Namespace 'http://www.w3.org/2001/XMLSchema' stammen.

How can I solve an Intellij IDEA servlet error

When developing a project using servlet, I first met a problem: error during artifact deployment. Then I searched the internet and tried every method, but all failed (including deploying tomcat, making the version correspond). It turned out to appear another problem: internal error.So now the server cannot even be started. Of course I deleted the cache. So I beg friends on stakoverflow give me some advice. Thank you very much (this is the first time I posted a question here,show me you hospitality).The following is my error page.
Error:Internal error: (java.nio.file.AccessDeniedException) D:\System Volume Information
java.nio.file.AccessDeniedException: D:\System Volume Information
at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
at java.base/sun.nio.fs.WindowsDirectoryStream.(WindowsDirectoryStream.java:86)
at java.base/sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:520)
at java.base/java.nio.file.Files.newDirectoryStream(Files.java:475)
at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:300)
at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:373)
at java.base/java.nio.file.Files.walkFileTree(Files.java:2839)
at org.jetbrains.jps.incremental.FSOperations.traverseRecursively(FSOperations.java:231)
at org.jetbrains.jps.incremental.FSOperations.markDirtyFiles(FSOperations.java:207)
at org.jetbrains.jps.incremental.BuildOperations.ensureFSStateInitialized(BuildOperations.java:54)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1064)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:965)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:794)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:830)
Please perform full project rebuild (Build | Rebuild Project)

Exception in monitor thread while connecting to server localhost:27017 while accessing MongoDB with Java

I have the following exception when running Java app for MongoDB:
[localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017 while accessing MongoDB with Java
Call stack is follows:
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.0.4.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:114) ~[mongodb-driver-core-3.0.4.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:127) ~[mongodb-driver-core-3.0.4.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_45]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_45]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_45]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_45]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_45]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_45]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:50) ~[mongodb-driver-core-3.0.4.jar:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.0.4.jar:na]
... 3 common frames omitted
Neither of these names belong to my application. Also I have NO MONGODB server on local host. I am using remote host and setting it later. An exception occurs BEFORE any of my statements concerning Mongo.
UPDATE
This is probably some Spring provided beans accessing Mongo. How to disable them?
My config contains following dependencies:
dependencies {
compile('javax.media:jai_core:1.1.3')
//compile('jai_core:1.1.3')
// compile('org.springframework.boot:spring-boot-starter-data-mongodb')
compile('org.mongodb:mongodb-driver:3.0.4')
compile('org.mongodb:bson:3.0.4')
compile('org.geotools:gt-api:14.2')
compile('org.geotools:gt-shapefile:14.2')
compile('org.geotools:gt-geometry:14.2')
compile('org.geotools:gt-referencing:14.2')
compile('org.geotools:gt-geojson:14.2')
compile('org.geotools:gt-mongodb:14.2')
compile('org.springframework.boot:spring-boot-starter-web')
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
i.e. I have removed org.springframework.boot:spring-boot-starter-data-mongodb and was thinking will use Mongo myself...
UPDATE2
I found related question: How to disable spring-data-mongodb autoconfiguration in spring-boot
I was to add exclusion annotation to my main annotated class,
i.e. instead of
#SpringBootApplication
I should have
#SpringBootApplication
#EnableAutoConfiguration(exclude={MongoAutoConfiguration.class})
Try adding
spring.data.mongodb.host=hostIpOnWhichMongoIsRunning
spring.data.mongodb.port=27017
into application.properties.
If Mongo is not running on localhost, this should fix the issue.
My IDEA suggested that I do this.
#SpringBootApplication(exclude = {MongoAutoConfiguration.class})
I can't say for sure. It's kind of not enough information question.
I can say that: Mongo driver by default tries to connect to the local host.
Probably you haven't specified the Mongo host/port.
So you'll have to configure the MongoDB host/port/credentials (if you have those).
Maybe it's network related issue or firewall (try to connect to MongoDB from your machine directly with cli / even running a basic program that uses only mongo driver).
From the stacktrace I don't see any usage of Spring, so more information is required to say for sure.
In general you can analyze the dependencies in Gradle by using gradle dependencies command (see here).
I had the same exception when trying to connect MongoDB with spring-boot.
In my case, I forgot to add the #Configuration annotation in the MongoDB Configuration class I created.
After adding this it worked for me.
I changed the scope(It was Test before)
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>4.2.3</scope>
</dependency>
In my case the mistake was not to have authorized my development environment. So I allowed connections from any IP (not a good idea for prod env) by adding the rule 0.0.0.0/0. You add this rule from the Network Access section from the atlas dashboard.
In my case mongoDB internal port was not mapped to external. Using command docker run -p 27017:27017 -d mongo resolved my issue.
check your mongo with cmd "mongo" if mongo is deathed follow step
1: open search windown
2: search "services"
3: find MongoDB Service and right click then click start on popup
It seems your server is not running.
Also if it running, it is doing so on a different port.

Intellij Can't import Gradle Project Because of Proxy

Trying to install a Gradle project into Intellij IDEA 14 and it stays on Resolve dependencies 'classpath' for about 10 minutes before failing. Everything works on the command line.
The error I'm getting is "Malformed reply from SOCKS server". Here is the whole stacktrace from Intellij:
2015-08-26 15:34:00,401 [1859339] WARN nal.AbstractExternalSystemTask - Malformed reply from SOCKS server com.intellij.openapi.externalSystem.model.ExternalSystemException: Malformed reply from SOCKS server
at org.jetbrains.plugins.gradle.service.project.AbstractProjectImportErrorHandler.createUserFriendlyError(AbstractProjectImportErrorHandler.java:106)
at org.jetbrains.plugins.gradle.service.project.BaseProjectImportErrorHandler.getUserFriendlyError(BaseProjectImportErrorHandler.java:158)
at org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension.getUserFriendlyError(BaseGradleProjectResolverExtension.java:438)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164)
at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.getUserFriendlyError(AndroidGradleProjectResolver.java:322)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164)
at org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension.getUserFriendlyError(AbstractProjectResolverExtension.java:164)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:366)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:332)
at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:215)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:97)
at org.jetbrains.plugins.gradle.service.project.GradleProjectResolver.resolveProjectInfo(GradleProjectResolver.java:65)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:41)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl$1.produce(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.AbstractRemoteExternalSystemService.execute(AbstractRemoteExternalSystemService.java:59)
at com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolverImpl.resolveProjectInfo(RemoteExternalSystemProjectResolverImpl.java:37)
at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:49)
at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:51)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:138)
at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:124)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4.execute(ExternalSystemUtil.java:540)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$5$1.run(ExternalSystemUtil.java:612)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
at com.intellij.openapi.progress.impl.CoreProgressManager$8.run(CoreProgressManager.java:367)
at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:617)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
To me, that says there is a problem on the proxy wall. But Intellij works fine going through the proxy with other places, like the plugins. I do it by setting java.net.useSystemProxies to `true.
Anyone see this before?
I had a similar error when I left an active SOCKS connection on my system open. Make sure there are no live SOCKS connections like tunnels etc.
What fixed it for me was to upgrade to Intellij IDEA 15. It has much better Gradle support.

trouble connecting to oracle db through ojdbc

For those who are willing to read a bit, (skip to end for short version):
I am trying to connect my java app to a remote oracle database. with no luck I am using Mac 10.7.5 with IntelliJ Idea 12, java version "1.6.0_51" 64-bit. I have been trying to get this work all day with no success. I also was not able to use the 'DataSource' view in IntelliJ because of a missing shared dylib missing in java.library.path. I suspect the two issues are related.
I tried installing Oracle Instant Client 64-bit (including the jdbc files), copied the dylibs to /usr/lib/java and this got me close to solving the "DataSource" view issue with a different error:
java.lang.RuntimeException: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
in RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:219)
at com.sun.proxy.$Proxy115.connect(Unknown Source)
in LocalDataSource.getConnection(LocalDataSource.java:158)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at com.sun.proxy.$Proxy114.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
in RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:211)
... 21 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:250)
at sun.rmi.transport.StreamRemoteCall.executeCal
So the journey continued and I tried using the 32bit version of the ojdbc .dylibs and .jars but then I ran into 'wrong architecture'when trying to connect to oracle db using IntelliJ's DataSource view.
I would like to keep everything consistent by using 32-bit since most of my apps use libraries that require 32-bit JVM.
tl;dr 'ers:
-Cannot connect to oracle db through IntelliJ Idea 12 DataSource view nor connect through java app using JDBC
-BackGround Info: Mac OSX 10.7.5, Java 1.6.0_51 64-bit, IntelliJ Idea 12, Remote Oracle 11G DB
-Tried both 32-bit and 64-bit versions of Oracle Instant Client with jdbc files, no luck
Any suggestions will be greatly appreciated!
Thank you
Additional Notes: I cannot connect through sqlplus either; i get the error ORA-21561: OID generation failed. Search results only point to fixing the /etc/hosts file which does not make sense for me since the db server is on a remote server and I am connecting using a TNS entry in /etc/tnsnames.ora
===UPDATE 1===
I made some progress on connecting through the java code. Using this code:
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:#hostname:port/service_name", "user", "password");
but received the error:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
I CAN connect using this exact piece of code on my work machine through eclipse ide but not on my Mac laptop.
For Intellij/DataGrip 2018 DB connection via TNS I got
[08006][17002] IO Error: Invalid connection string format, a valid format is: "host:port:sid"
I find the problem in Oracle driver version: 11.2.0.4
I get "Test Connection > Succesful" using version 12.1.0.2
I can only encourage you to use the oracle thin jdbc client. There must be a very specific reason not to. With that you will likely have NO problems.

Categories