Wednesday, May 25, 2016

Windows 7 or Ubuntu, a developer's POV

When I started ubuntu for my desktop years ago, I had three targets :

1- be familiar with linux, for better tackling with our integration/production servers.
2- better understanding for OS, since you will rely much on the terminal instead of GUI
3- security, no malicious exe on my usb flash will harm my PC

the results -respectively- where :

1- somehow, not much
2- a little, as I was just struggling here and there to find how to make things work
3- Yes yes yes

but I -both as a developer and and an end user- faced many problem, that can be summarized to "productivity killer" and "no easy way to ...."

1- No GIT client as easy and free as tortoise GIT (some friends adviced to settle for GIT bash but I wasn't convinced)

2- If you do any freelancing work, most of your clients will be windows users, so you need to simulate their environments as much as possible.

3- One of my projects where killed because I wasn't able to install a third party mysql library that my code rely on - 4 nights of hard working with no hope- on my client's windows pc, though it was tooooo easy on linux .... may be If I had windows I would have taken another approach

4- One of my odesk clients swindled me and refused to pay for the task because I wasn't able to setup the monitoring client easily -It took me a day later to setup- , so he pretended that the work wasn't done

5-need to easily run exe files that your client provide you.

6-  Difficult to install the driver of the Internet USB driver provided by a local telecom providor

7- go search the internet in order to install any thing

8- No pdf/doc editor provides printingon both sides or booklet printing -AFAIK-

9- No audioplayer provides fast play that I need much to finish lectures and lessons quickly -AFAIK-

So, sadly I decided to switch back to windows and face again the endless trojans, viruses, ad-wares and similar stuff

Tuesday, May 17, 2016

org.apache.lucene.index.IndexNotFoundException: no segments* file found in org.apache.lucene.store.MMapDirectory

I encountered this error while trying to create an empty SOLR index from an existing one .... I started to copy missing files one by one and the error kept appearing but with different file name, It was obviously not the solution ...... the solution was to delete data folder completely so that the core knows that this is a empty index

Monday, May 9, 2016

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX: java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

I got this exception while trying to deploy an EJB ear that was created with maven to weblogic 12g :

Error instantiating the Persistence Provider class org.hibernate.ejb.HibernatePersistence of the PersistenceUnit XXX : java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence

Note : I am having a certain problem preventing me from putting shared libraries in the lib folder in weblogic

I searched a lot and tried the following :

1- make sure that hibernate-entitymanager jar is included in the ear while deployment
2- put these entries in the persistence.xml file :
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.transaction.manager_lookup_class"
       value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
        <property name="hibernate.show_sql" value="true" />
3- put this in weblogic.xml :
         <prefer-application-packages>
            <package-name>antlr.*</package-name>
        </prefer-application-packages>
        <prefer-application-packages>
            <package-name>org.hibernate.*</package-name>
        </prefer-application-packages>

all these trials didn't solve the problem, I got another EJB ear that is working on weblogic and started the normal process of comparison between working and non-working ears and found the following :

4- the jar inside the ear that holds all the code has MANIFEST.MF inside its META-INF folder that has a Class-Path entry that points to the hibernate jars ..... I tried hard coding this entry and it worked.

5- Next I wanted to generate this entry automatically using maven, so I added the following entry to the pom.xml of the included jar's project :
           
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>

                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>


 Now it's deploying fine







Thursday, March 17, 2016

SOLR : Internal Server Error on calling deleteById()

Shifting from local environment to integration environment, my code suddenly started to throw Internal Server Error while calling SolrServer.deleteById(List<String>) , I googled it, found some solutions talking about locking mechanism and thread pool size and similar stuff, but It didn't work, I made a small test case that deletes one part with no threads... It gave the same exception.
I looked at the schema and realized that some one commented out the <uniqueKey>id</uniqueKey> tag ... and that's it :( ....... I just uncommented it again, restarted the solr application and all was ok