OAS 10G WAR应用迁移至WebLogic 12C后无法连接问题求助
Hey there, let's walk through the key checks you need to perform now that you've got the basics (datasource setup, network tests, WAR deployment) covered:
Verify JDBC Driver Compatibility
WebLogic 12c has specific driver requirements that might differ from OAS 10G. For Oracle 12.1.0, ensure you're using a compatible driver version (e.g.,ojdbc7.jarfor JDK 7,ojdbc8.jarfor JDK 8—match it to your WebLogic JDK). Avoid reusing the OAS driver; download the correct one from Oracle and place it in$DOMAIN_HOME/libor your server'slibdirectory, then restart WebLogic. Also, confirm the datasource's driver class is set tooracle.jdbc.OracleDriver(the deprecatedoracle.jdbc.driver.OracleDrivermight cause silent failures).Align JNDI Names Between App and WebLogic
OAS and WebLogic use distinct JNDI naming conventions. Your app might be referencing an OAS-specific JNDI name that doesn't match what you created in WebLogic. Double-check your application's config files:- In
web.xml, ensure the<resource-ref>entry points to the exact JNDI name of your WebLogic datasource. - If using
weblogic.xml, verify the<resource-link>maps the app's internal reference to the correct WebLogic JNDI binding.
- In
Tweak Connection Pool Configuration
Even if the datasource test passes, misaligned pool settings can block app access. Check these parameters in WebLogic's datasource config:- Initial/Maximum Capacity: If your app spawns connections quickly, a low initial capacity might cause delays or pool exhaustion.
- Connection Testing: Enable
Test Connections on Reserveand set a valid test query (e.g.,SELECT 1 FROM DUAL) to ensure connections are alive when the app uses them. - Connection Timeout: Adjust this if your app waits too long for a free pool connection.
Clean Up OAS-Specific Deployment Descriptors
Files likeorion-web.xmlare OAS-specific and won't work in WebLogic. Remove or replace them with WebLogic-compatible descriptors:- Use
weblogic.xmlto define resource links, session settings, and other WebLogic-specific configurations. - Ensure
web.xmlhas proper<resource-ref>entries with correctres-type(javax.sql.DataSource) andres-auth(Container).
- Use
Enable JDBC Debug Logging
If you're still stuck, turn on WebLogic's JDBC debug logs to uncover hidden errors:- In the WebLogic Console, go to your server →
Debug→JDBCand enableDebugJDBCSQLandDebugJDBCConn. - Reproduce the issue, then check the server logs (
$DOMAIN_HOME/servers/[server-name]/logs/[server-name].log) for detailed messages about JNDI lookups, connection attempts, and suppressed exceptions.
- In the WebLogic Console, go to your server →
Check Security Permissions
WebLogic's security policies might restrict your app from accessing the datasource. Ensure your app has:java.net.SocketPermissionfor the database host and port.javax.naming.JNDIPermissionfor the datasource's JNDI name.
You can adjust these via the domain's security policy or add a customweblogic.policyto your deployment.
Match Database Session Parameters
OAS might have set specific session properties (like NLS settings, transaction isolation levels) that WebLogic doesn't inherit. Configure these in your WebLogic datasource'sPropertiestab—add entries likeNLS_LANG=AMERICAN_AMERICA.AL32UTF8ordefaultRowPrefetch=100to match your OAS setup.
内容的提问来源于stack exchange,提问作者taoufik

