I was creating one utility in which there was interaction with database. I was passing the data source name and URL of application server (Weblogic) from the properties file and creating the database connection. But while running the program I was getting the below error:
Exception in thread "main" java.lang.UnsupportedOperationException: Remote JDBC disabled at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348) at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259) at weblogic.jdbc.common.internal.RmiDataSource_1035_WLStub.getConnection(Unknown Source) at ae.dso.common.DBConn.getConnection(DBConn.java:80) at ae.dso.history.data.TaskHistoryPayload.main(TaskHistoryPayload.java:82)Caused by: java.lang.UnsupportedOperationException: Remote JDBC disabled at weblogic.jdbc.common.internal.JDBCServerHelperImpl.<clinit>(JDBCServerHelperImpl.java:36) at weblogic.jdbc.common.internal.JDBCService.initialize(JDBCService.java:91) at weblogic.jdbc.common.internal.JDBCService.start(JDBCService.java:137) at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
This error comes because your weblogic does not allow you to perform any database operation remotely. So in that case you have to enable the JDBC access in weblogic.
Solution
- Go to the Weblogic Domain Directory and edit the setDomainEnv.sh file i.e %MW_HOME%\user project\domains\<your domain>\bin.
- Modify WLS_JDBC_REMOTE_ENABLED value false to true. i.e WLS_JDBC_REMOTE_ENABLED="-Dweblogic.jdbc.remoteEnabled=true"
- Restart the WebLogic Servers.