Friday, November 24, 2017

Removing a corrupted weblogic deployment.

Problem Description: What if you have deployed an application on weblogic and somehow it has got corrupted and you want to undeploy it. Most of the time you can go to weblogic console and undeploy but at times it gets corrupted so badly that you can't even start your weblogic server. I faced this issue recently while experimenting with filters. My filter code has some problem. Application got deployed successfully but when I try to use it, due to code bug in filter, it was going in infinite loop. So I stopped weblogic server. Now when I try to start my weblogic server, it by default tries to deploy previous application and this time because of problem in deployment weblogic was not starting. To sum up I need to delete my weblogic deployment offline.

Here are the changes I did

1. Find your config.xml and see app-deployment node. For integrated server config.xml is located in <System-Directory>/DefaultDomain/config/config.xml

 Your entry will be something like below

<app-deployment>
    <name>MyApplication</name>
    <target>DefaultServer</target>
    <module-type>ear</module-type>
    <source-path>D:\Oracle\Middlewares\JDEV_SystemDir\system12.2.1.0.42.151011.0031\o.j2ee\drs\MyApplication</source-path>
    <security-dd-model>DDOnly</security-dd-model>
    <staging-mode xsi:nil="true"></staging-mode>
    <plan-staging-mode xsi:nil="true"></plan-staging-mode>
    <cache-in-app-directory>false</cache-in-app-directory>
  </app-deployment>

a. Note source-path location. Remove your deployment from that location.
b. Remove entry of app-deployment from config.xml file as well.
c. Also remove your applicaton from <System-Directory>/servers\DefaultServer\tmp\_WL_user directory.
d. To my surprise even after all these changes, weblogic server was not starting. I thought of deleting DefaultDomain directory but then I decided to close jdev once and try. That worked.

To sumup you need to close jdev and then perform a,b and c task mentioned above.


Now you can start your application.

Similarly I believe you can delete invalid jndi entries also from this file if you find that your weblogic is taking long time to start because of invalid jndi entries. Actually weblogic tries to look in this file and connect with those database while starting to reserve connections in pool but if database is down or no longer valid, weblogic waits for timeout and it makes weblogic startup slow.

Thats all.