Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8040973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:04:02+00:00 2026-06-05T04:04:02+00:00

So I have a MySQL database, and I have a datasource on a local

  • 0

So I have a MySQL database, and I have a datasource on a local instance of WebLogic which is connected to that database. I am trying to write some client code which will simply connect and query. I am having issues with obtaining a connection from the datasource. Here’s my code thus far. I am running WebLogic 12c.

    import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class ConnectionTest {

    public static void main(String... args) {
        ConnectionTest tCon = new ConnectionTest();
        tCon.TestConnection();

    }

    public void TestConnection() {
        Context ctx = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;

        try {
            Hashtable<String, String> props = new Hashtable<String, String>();

            props.put("java.naming.factory.initial",
                    "weblogic.jndi.WLInitialContextFactory");
            props.put("java.naming.provider.url", "t3://localhost:7001");
            props.put("java.naming.security.principal", "weblogic");
            props.put("java.naming.security.credentials", "welcome1");
            ctx = new InitialContext(props);
            DataSource ds = (DataSource) ctx.lookup("RegexDB");
            System.out.println(ds);
            DAO dao = new DAO();
            conn = ds.getConnection();
            stmt = conn.createStatement();
            stmt.execute("select * from regular_ex");
            rs = stmt.getResultSet();
            ArrayList<HashMap<String, Object>> results = dao
                    .resultSetToArrayList(rs);
            dao.printArrayList(results);
            stmt.close();
            conn.close();
        } catch (NamingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (stmt != null)
                    stmt.close();
                if (conn != null)
                    conn.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }

    }
}

This fails at ds.getConnection() with the following exception:

java.lang.ClassCastException: weblogic.jdbc.common.internal.ConnectionEnv cannot be cast to java.io.Serializable
    at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2285)
    at weblogic.utils.io.ObjectStreamClass.writeFields(ObjectStreamClass.java:414)
    at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:235)
    at weblogic.corba.utils.ValueHandlerImpl.writeValueData(ValueHandlerImpl.java:225)
    at weblogic.corba.utils.ValueHandlerImpl.writeValue(ValueHandlerImpl.java:182)
    at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:1983)
    at weblogic.iiop.IIOPOutputStream.write_value(IIOPOutputStream.java:2021)
    at weblogic.iiop.IIOPOutputStream.writeObject(IIOPOutputStream.java:2285)
    at weblogic.jdbc.common.internal.RmiDataSource_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:695)
    at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:520)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:516)
    at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

I have wlclient.jar, wlsafclient.jar, and weblogic.jar in my buildpath. I have tried all sorts of combinations of adding/removing these jars, but I still get the same error regardless of what I do. Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:04:05+00:00Added an answer on June 5, 2026 at 4:04 am

    After doing some research, I am deleting my old answer and starting over.

    There is a large table of client types in the Oracle Doc for WebLogic Standalone Clients. For each type of client, listed, the table shows the required jar files. For certain types of clients, you need to build an additional jar (wlfullclient.jar) and include that.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have mysql database and I want a software which can draw the database
I have a MySQL database that currently uses MyISAM but I am thinking of
I have s MySQL database and I need to insert some specific data in
I have a MySQL database (currently using phpmyadmin to manage) that I would like
I have a mysql database (version 5.5), and I am trying to add a
I have a grails project and my configuration points to a mysql database: DataSource.groovy
I have a desktop app in Java that connects to a MySql database through
I have MySQL database with two tables: users and items. They look like this:
I have MySQL database of areas in a city. The attributes of each area
I have mysql database structure like below: CREATE TABLE test ( id int(11) NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.