Search code examples
javadatasourcelookupweblogic12chost

weblogic.application.ModuleException: oracle.net.ns.NetException: Unknown host specified


I'm getting the following error when starting Weblogic Server:

weblogic.application.ModuleException: oracle.net.ns.NetException: Unknown host specified 
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:411)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:100)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:192)
at weblogic.application.internal.flow.ModuleStateDriver$1.next(ModuleStateDriver.java:187)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:45)
Truncated. see log file for complete stacktrace
Caused By: oracle.net.ns.NetException: Unknown host specified 
at oracle.net.resolver.HostnameNamingAdapter.resolve(HostnameNamingAdapter.java:207)
at oracle.net.resolver.NameResolver.resolveName(NameResolver.java:131)
at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:475)
at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)
Truncated. see log file for complete stacktrace

I can not find a solution or a clue to solve this. It's obviously related with host but I just start to work in this new project and the developer who was working here before me show me how to start the server and this did not happen... And the funny thing is that I did not make any change on code or server configuration. In fact I did not even enter into Weblogic Admin Console. Also I saw how the ds = (DataSource) new InitialContext().lookup("jdbc/MyDbName"); to get teh DataSource was working perfectly, and now after the oracle.net.ns.NetException the server starts but I'm getting another error:

javax.naming.NameNotFoundException: While trying to lookup 'jdbc.MyDbName' didn't find subcontext 'jdbc'. Resolved ''; remaining name 'jdbc/MyDbName'

Of course I assume that the second error is caused by the first one.

I try almost everything (obvioulsy almost because I didn't find the solution yet)... clean and build the workspace, clean the server, look for any difference between local and head... and nothing...

Do you have any idea of what is going on? I'm a litte bit stuck here :-(

Thanks


Solution

  • Ok... after a week looking for a solution the problem was a bad host name in the URL on Pool Connections of the Data Source, in Weblogic Admin Console. The wrong URL was some like:

    jdbc:oracle:thin:@//gaftheujdgr:1521/my_data_base
    

    where host name gaftheujdgr miss an "s" after the "t", so of course the solution was change the name on the URL for the right one (gaftsheujdgr):

    jdbc:oracle:thin:@//gaftsheujdgr:1521/my_data_base
    

    I didn't realize this because (as I said before in the question) I never change any configuration on Weblogic Admin Console before get this error, and the app was working a week before. In my defense I can say that I just change job so I'm not familiar yet with our hostnames :-P haha

    All best and thanks