Wednesday, October 09, 2013

Simple WS client using CXF for .NET WS server

A long time ago I figured out this incompatibility, the matter is than when consuming a SOAP web service produced by a .NET server, the following exception used to happen:

undefined element declaration 's:schema'

so, searching again a lot, I've found the solution; so using a CXF maven plugin to build the client, will simply look like this:

<execution>
                        <id>generate-sources</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <wsdloptions>
                                <wsdloption>
                                    <wsdl>
                                        ../path/to/wsdl
                                    </wsdl>

                                    <extraargs>
                                        <extraarg>-b</extraarg>
                                        <extraarg>http://www.w3.org/2001/XMLSchema.xsd</extraarg>
                                        ... OTHER EXTRAARGS ...
                                    </extraargs>
                                </wsdloption>
                            </wsdloptions>
                        </configuration>
                        <goals>
                            <goal>wsdl2java</goal>
                        </goals>
                    </execution>


Simply add those two extraarg elements to the POM, and that's all. Of course using those same parameters when using CXF via command line will work fine.

Thursday, September 19, 2013

Making Work VirtualBox on Fedora 19

After many hours trying to solve a basic problem while installing Virtual Box on my recently installed Fedora 19, i found a very simple solution, which no one post has.

Problem.

I've got the following description:

Trying to register the VirtualBox kernel modules using DKMSError! echo
Your kernel headers for kernel 3.3.4-5.fc17.x86_64 cannot be found at
/lib/modules/3.9.5-301.fc19.x86_64/build or /lib/modules/3.9.5-301.fc19.x86_64/source.
[FAILED]
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules [FAILED]
(Look at /var/log/vbox-install.log to find out what went wrong)


Paying attention to the source of the problem, the directory /lib/modules/3.9.5-301.fc19.x86_64 doesn't exists, when I go to the path /lib/modules/, an making an LS, I got:

[root@localhost modules]# ls -al /lib/modules
total 48
drwxr-xr-x.  5 root root  4096 Sep 19 08:26 .
dr-xr-xr-x. 68 root root 32768 Sep 19 12:49 ..
drwxr-xr-x.  6 root root  4096 Sep 19 12:29 3.10.11-200.fc19.x86_64
drwxr-xr-x.  7 root root  4096 Sep 19 16:12 3.11.1-200.fc19.x86_64
drwxr-xr-x.  6 root root  4096 Sep 19 12:29 3.9.5-301.fc19.x86_64


It looks like there is the requiered directory, but checking it better, I realize that ...

$[miguel@localhost kernels]$ ll 3.9.5-301.fc19.x86_64/
lrwxrwxrwx.  1 root root     38 Jun 27 13:14 build -> /usr/src/kernels/3.9.5-301.fc19.x86_64
drwxr-xr-x.  5 root root   4096 Sep 19 12:29 extra
drwxr-xr-x. 12 root root   4096 Jun 27 13:14 kernel


And build sym link has an error, because the origin /usr/src/kernels, doesn't contains the 3.9.5-301.fc19.x86_64 directory.

$[miguel@localhost kernels]$ ls -al /usr/src/kernels/
total 16
drwxr-xr-x.  4 root root 4096 Sep 19 15:39 .
drwxr-xr-x.  4 root root 4096 Sep 19 12:49 ..
drwxr-xr-x. 22 root root 4096 Sep 18 01:57 3.10.11-200.fc19.x86_64
drwxr-xr-x. 22 root root 4096 Sep 19 12:05 3.11.1-200.fc19.x86_64


Actually, this is correct, such that directory doesn't exists.

Solution.

After many hours, trying to get the missing kernel headers, and so..............


I realized that making

[root@localhost modules]# uname -r
3.9.5-301.fc19.x86_64


Even when I updated the Kernel, the old kernel still was referenced, and so I decided to use that kernel in my next boot, so editing the /boot/grub2/grub.cfg file, solves the problem. Just add a new entry to grub referencing to the updated kernel, and reboot.

### BEGIN /etc/grub.d/10_linux ###

### The configuration to make work the new kernel version, this for fixing the VirtualBox problem
menuentry 'Fedora, with Linux 3.11.1-200.fc19.x86_64' --class fedora --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.11.1-200.fc19.x86_64-advanced-68e3207d-d9ac-41ee-8db8-2bcb2dc308a1' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='hd0,msdos6'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos6 --hint-efi=hd0,msdos6 --hint-baremetal=ahci0,msdos6 --hint='hd0,msdos6'  63534bc2-5c8b-49a8-8156-8ba8bfe5d2df
    else
      search --no-floppy --fs-uuid --set=root 63534bc2-5c8b-49a8-8156-8ba8bfe5d2df
    fi
    linux    /vmlinuz-3.11.1-200.fc19.x86_64 root=UUID=68e3207d-d9ac-41ee-8db8-2bcb2dc308a1 ro rd.md=0 rd.lvm=0 rd.dm=0 vconsole.keymap=us acpi_backlight=vendor acpi_osi=Linux rd.luks=0 vconsole.font=latarcyrheb-sun16 rhgb quiet
    initrd    /initramfs-3.11.1-200.fc19.x86_64.img
}

###End of custom configuration

menuentry 'Fedora, with Linux 3.9.5-301.fc19.x86_64' --class fedora...


Ok, now in the start screen, the new entry appears, and use the new entry, try to use VirtualBox as usuarl, and everything goes ok.

I hope it would be helpful, have a nice day community...

Sunday, June 02, 2013

Put Android Maps V2 work on your Emulator

Last time i've been reading a lot about the new features of the Google Android Maps API v2., so after many hours of trying to make work these new features in my emulator, I've found such that solution in the following steps:

1. Need To create a new AVD WITHOUT GoogleApis, for example, the next picture shows my emulator for testing.
2. Next, start the emulator as usual, but this after the starting has been completed, we'll install TWO extra APK files. Those APK files are the following:

  1. The Google Services platform is the component of the OS, which provides of those new features, so the most important thing to remember is to ALWAYS INSTALL the latest version of this file, in my case I downloaded the following file com.google.android.gms-19032013.apk. Be careful to check the LATEST version, at the time of writing this post, this file was the latest one.
  2. I read many in many posts to download and install the following file "com.android.vending-1.apk", but those posts do not mention that this file is simply the Google Playstore APK, neither mention that need the LATEST version, so I downloaded as many files as you can imagine, trying to make the API work. Thus, the file we need is again the LATEST apk file of the Google Playstore, in my case I downloaded the "Playstore v4.0.27.apk" file.
This seems to be so easy when nobody is there to tell you what exactly need to do. I encountered many problems using the wrong file.

If you encounter with the (491 error) when trying to update the Google Play Services, or if you are installing some APK right to the /data/system/, maybe you searched for a solution a lot but I certainly can tell you that the answer is not in that way.

I will omit the steps about how to create and configure the API key for android applications, (but if you are interested, I've added some reference links for this) instead I will focus on the project configuration using the (not my favourite IDE) Eclipse; when the Android Studio gets stable, I will post a new entry (if necessary) about how to configure a project in that IDE.

Ok, let get back to what we want.

1. Create a project.

2. After you created the project, need to import the existing "google_play_services-lib" eclipse project, into the new project, by doing the following:

3. IF is the first tie you are attempting to use the API, then need to import the Google Play Services Lib into the workspace.

File > Import...

Then go to the android-sdk installation path and browse to: /SDK_HOME/extras/google/google_play_services/libproject/google-play-services_lib.


I read in many posts, that is NECESSARY to copy the project into the current workspace, this due to bugs in Eclipse IDE.

4. After this has been done download the source code and replace in your new project (the source code is at the end of the post), you'll notice that many classes couldn't be found.


Indeed, you need to add the new imported project which is marked as a Library into the Android settings of the project.

Right Click on Project > Properties > Android
And in the lower panel, press the "Add" button and choose the recently imported Library. Then press Ok.

5. One last thing to not forget is that Eclipse external libraries need to be copied into the "LIBS" folder of the project to make them available to the Build.

Then copy the "google-play-services.jar" file located in the "LIBS" directory of the "google-play-services_lib" imported project.

Also do not forget to add it to the compilation build path of the project, this for making those classes available for IDE.


6. OK, now configure the AndroidManifest.xml, and use the Google API key generated for your account.


7. Finally a very important step is to add the google-services.jar file into the APK, this to avoid exceptions like the following.

java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng

So do the next steps:

Right clik project > Properties > Java Build Path.
Go to "Order and Export" tab.
 
Select the CheckBox of the "google-play-service.jar" file, the press OK.

8. Run thh project.

 VoilĂ !!!





The application works perfectly!!!



References:

About my search on web.

http://stackoverflow.com/questions/15894143/java-lang-noclassdeffounderror-com-google-android-gms-rstyleable-in-android
http://stackoverflow.com/questions/14372391/java-lang-noclassdeffounderror-com-google-android-gms-rstyleable
http://www.user.tu-berlin.de/hennroja/tutorial_fixing_java.lang.NoClassDefFoundError%20com.google.android.gms.R$styleable.html
http://stackoverflow.com/questions/13691943/this-app-wont-run-unless-you-update-google-play-services-via-bazaar
http://piotrbuda.eu/2012/05/installing-google-play-on-android-emulator.html

Files needed
Google Play Store, A.K.A (com.android.vending.apk)
Google Play Services, A.K.A. (com.google.android.gms.apk)

Google API

step by step guide 
NOTE, don't forget that you can use your OWN keystore to generate the KEY, but need to configure the Default debug store @Eclipse, Window> Preferences > Android > Build.


Source code

Wednesday, April 17, 2013

VMWare 8.0.6 issues fixed. Modules: vmmon, vmci

Recently I had some issues with VMWare 8, I've got Ubuntu 12.10. However, when I got the following errors, due to any reason:

"Failed to open device "/dev/vmci": No such file or directory Please make sure that the kernel module 'vmci' is loaded."

OR

"Failed to open device "/dev/vmmon": No such file or directory Please make sure that the kernel module 'vmci' is loaded."

I googled a lot, and there was not a good answer at all, after many hours and forums, I realized that the answer was as simple as:

sudo modprobe vmmon
sudo modprobe vmci

I hope this be helpful to anyone who cares.

By the way, I couldn't make work my version 9, due to a mismatch in vmmon versions 2.67 and 2.71, which many forums say to fix with a simply reboot of host machine.

"Version mismatch with vmmon module: expecting 271.0, got 267.0."

I'll see how to fix this issue, giving a real solution to it.

Tuesday, April 02, 2013

When UBUNTU terminal has no colors

You do not have problems with your terminal or terminal setting. Try this:
ls --color
It works, doesn't it?
Most likely, you have replaced your .bashrc. You can find the original .bashrc, which for example defines the alias ls='ls --color=auto' and also color promtpts in /etc/skel/.
Copy a new .bashrc with:
mv ~/.bashrc ~/.bashrc.old
cp /etc/skel/.bashrc ~/.bashrc