Thursday, 3 March 2011

Connection errors between JDeveloper 11g and OTN SoaBPM Appliance

I' m working with the "Pre-built Virtual Machine for SOA Suite and BPM Suite 11g" for a while now.
I use it to prepare for SoaSuite and BPM Bootcamps and one thing I try to do is to use JDeveloper  11g on my Host  (OpenSuse 11.2) and connect to the application server in my VirtualBox guest. In fact, that would (probably) be the architecture to use in a real developer environment.

So I changed the network adapter of the VirtualBox VM (in Device Settings) from NAT to "host-only". Then I re-activated the network-adapter in the guest (Oracle Enterprise Linux), to have it query for new ip-settings.As root I queried for the ip-address using ' ifconfig':
[root@soabpm-vm ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:1C:4C:37
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe1c:4c37/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:219 errors:0 dropped:0 overruns:0 frame:0
          TX packets:192 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21908 (21.3 KiB)  TX bytes:26686 (26.0 KiB)
          Interrupt:10 Base address:0xd020

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2222 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2222 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2942937 (2.8 MiB)  TX bytes:2942937 (2.8 MiB)

So the ip-address of my vm is '192.168.56.101'.

Then I changed the /etc/hosts file of the VM as:
127.0.0.1       localhost
192.168.56.101  soabpm-vm soapbm-vm.local bpm-vm.local bpm-vm
::1             localhost6.localdomain6 localhost6

And I added the same address in the host file of my OpenSuse host:
 192.168.56.101  soabpm-vm soabpm-vm.darwin-it.local

In Jdeveloper 11g I created an application server connection, named "soabpm-vm', added the credentials (weblogic/welcome1), hostname: soabpm-vm, ports 7001/7002, domain name: domain1. And then we test:

Fine. So in my BPM Bootcamp preperations I came to the point I have to map the abstract roles (swimlanes) to LDAP roles/users. Doing so you have to query the users over the application server connection. Choosing the connection it would populate the realm-poplist. In my case it would not.Testing in the JDeveloper within the VM would give me:
Mark the Realm "jazn.com" automatically populated.

So I tried to deploy a SoaProject, that builds fine, but deploying resulted in:

[03:10:41 PM] Error sending deployment request to server AdminServer [localhost:7001]  
 java.net.ConnectException: Connection refused 
[03:10:41 PM] Error sending deployment request to server AdminServer [localhost:7001]  
 java.net.ConnectException: Connection refused  

After a while I noticed 'AdminServer [localhost:7001]'! That's not where I want to connect to! And it is certainly not the host I applied in the Jdev Applicatioin Server dialog.

Apparently the AdminURL of Weblogic is not correctly set during startup. This is set in  the config.xml.
This can easily be found as follows:
[oracle@soabpm-vm config]$ cd
[oracle@soabpm-vm ~]$ cd bin
[oracle@soabpm-vm bin]$ . ./wls_env.sh
[oracle@soabpm-vm bin]$ cd $DOMAIN_HOME/config
[oracle@soabpm-vm config]$ ls config.xml
config.xml
Edit the config.xml and look for:
<external-dns-name>localhost</external-dns-name>
Then change it in:
<!--<external-dns-name>localhost</external-dns-name>-->
<external-dns-name>soabpm-vm</external-dns-name>

As always it is good practice to backup the config.xml. And after the change of course you'll need to restart the weblogic server.
But then the connection to the AdminServer will work, the realm can be queried and deploying will work.
Important lesson: the hostname in the setting above should not be localhost, but a meaningful host name.that can be resolved on both the SoaSuite server as well as the Client running JDeveloper.

5 comments :

Javin @ eclipse shortcuts said...

Nice article from my experience this error also occur when you try to connect remote JVM and its not running. see here "Failed to connect to remote VM. Connection refused" or "Connection refused: connect"

SMahmood said...

Hi there,

If you select Host only network for dev (virtual) machine, weblogic and soa stack shall not be able to connect to outside world. Just wondering what was your experience?

SMahmood said...

Hi there,

Just wondering if host-only option worked for you. If we select host-only network, weblogic and soa stack shall not be able to communicate with outside work.

Just wondering what was your experience with host only selection

Martien van den Akker|Darwin-IT said...

Hi,

Host only is meant to work as a network that is confined to only your host-machine. Through that netwok al the VM's running on your host that have a hostonly adapter will be able to connect to each other. Also your host is reachable. It has an address like 192.168.56.1, where the .56. may vary between installations.

For me that suffice. The pro's of the host only is that a request between your host and the VM's or the VM's between each other won't have a round trip through your external router. Also the host only network is up when you're on the move with your laptop(and have no physical network ocnnection).

If you need to be able to do requests from within your VM to the outside, you have two options:
1. NAT
2. Bridged networking.

The first is the simplest. It shares the ip-address of your host. That means that it cannot respond to requests from outside your host to your VM. For that purpose the Bridged Network adapter is meant. This means that the VM gets an ip-address that is reachable from outside your host. So to the network it responds as a standalone PC.

Now I often use a combination of host-only and a bridged. That means that when I'm connected, the VM is connected externally as well. But on the road, the VM is still reachable through the host-only network.
In that combination you might need to look into your routes. See the routing tab in the Networking Administration tool. The host-only adapter (eth0 if it is the first in row), needs to be routed for only the request within the network. In Oracle Linux6 there is a checkbox for that. Otherwise your requests to www.oracle.com for instance might be routed to your host only network adapter instead of your bridged.

Hope this clears it up for you.

Regards,
Martien

Alex said...

Hello Martien,

I keep struggling with my VB image of soa suite and connecting to it from a remote JDeveloper. Somehow I cannot get it to work anymore like I have done before.

I set up the hostfiles as you have done. When I go to soabpm-vm:7001 I get the soasuite screen. However when I make it soabpm-vm:7001/em it redirects to www.soasuite-vm.site:7001/em and it doesn't find a page.

Any ideas?