Wednesday, July 24, 2013

'tasksel: aptitude failed (100)' error while Installing LAMP server in Ubuntu

While installing LAMP server in Ubuntu tasksel: aptitude failed (100) may occur. This might be due to a previous installed mysql database server or a trace of mysql in /etc/lib directory. So, the simple solution is to remove mysql database server. Other wise use other methods than 'tasksel' to install LAMP :)

Thursday, June 13, 2013

Alias in Linux to create short cut

To save time it is possible to create a short cut for Linux commands by  creating an alias. To do so: 
  1. open ~/.bashrc or /etc/bash.bashrc in any text editor 
  2. Add each commnad using this formula: 'alias <name>=<"command"> e.g. alias install ="sudo apt-get install" 
  3. Then save it and log out and log in again in to the system
  4. Enjoy :)

Friday, April 5, 2013

Solution for De-serialization problem in EJB entity from a remote client!

In my previous post , I had a problem in calling remote EJB entity from a remote client. The problem was, when retrieving an object from a data base and return to the client CORBA MARSHALING exception is being thrown. Because, may be the entity retrieved and returned to client can't be de-serialized in the same way as the server.  For overcoming this problem, I spent many hours. There are many posts available in web just mentioning the problem and suggesting their idea, but not really a solution.
Finally, I just separate the entity class as java application and add to all EJB session beans, Interfaces, and Client application (web application). With this, it works perfectly. Nevertheless, I don't think this is better solution. This gives access to entity beans for the client.
I am still searching for a better solution.:) 

Wednesday, April 3, 2013

De-Serialization problem in EJB remote client and server using JPA

When I try to retrieve an object passed as a list or so from session bean to a client side application say action class in struts 2 concept, De-Serialization problem occurred. I googled a lot, but no one has came with tangible solution.

Here below the full stack trace of the glass fish server.
WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream
org.omg.CORBA.MARSHAL: WARNING: IOP00810011: Exception from readValue on ValueHandler in CDRInputStream  vmcid: OMG  minor code: 11 completed: Maybe
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
 at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
 ......
 at org.mk.rc.intf.__PublicationBeanRemote_Remote_DynamicStub.searchPublication(org/mk/rc/intf/__PublicationBeanRemote_Remote_DynamicStub.java)
 at org.mk.rc.intf._PublicationBeanRemote_Wrapper.searchPublication(org/mk/rc/intf/_PublicationBeanRemote_Wrapper.java)
 at org.mk.rc.actions.PublicatonAction.searchPublication(PublicatonAction.java:43)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
......
 at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
 ......
atThreadPool$Worker.run(AbstractThreadPool.java:513)
 at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NullPointerException
 at com.sun.corba.ee.impl.orbutil.ClassInfoCache$ClassInfo.(ClassInfoCache.java:156)
.....
 at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:274)
 at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:1015)
 ... 96 more

I don't solved it yet. I hope soon :)

Tuesday, March 26, 2013

An annotation processor threw an uncaught exception.

When compiling a EJB project there might be a case in which the java EE API comes before eclipseLink API in the class path. Hence the following error may be generated.

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
.....
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
../..//nbproject/build-impl.xml:839: The following error occurred while executing this line:
../../nbproject/build-impl.xml:258: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)

The solution is simple:-) Just make the eclipseLink API first in the project libraries configuration. 

Monday, March 25, 2013

javax.naming.NameNotFoundException: org.mk.rc.intf.StaffsBeanRemote

When calling an EJB, I got an error like the following....

com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=org.mk.rc.client.Client/staffsBean,Remote 3.x interface =org.mk.rc.intf.StaffsBeanRemote,ejb-link=null,lookup=,mappedName=,jndi-name=org.mk.rc.intf.StaffsBeanRemote,refType=Session into class org.mk.rc.client.Client: Lookup failed for 'java:comp/env/org.mk.rc.client.Client/staffsBean' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl}
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:703)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:470)
....

Caused by: javax.naming.NameNotFoundException: org.mk.rc.intf.StaffsBeanRemote#org.mk.rc.intf.StaffsBeanRemote not found
at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:248)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:215)
..... 

The problem is, I didn't add StaffsBeanRemote bean name to application-client.xml file. Just add as follow and works fine. 

<ejb-ref>
    <ejb-ref-name>StaffsBean</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <remote>org.mk.rc.intf.StaffsBeanRemote</remote>
 </ejb-ref>

Enjoy :-)


Saturday, March 23, 2013

The module has not been deployed.

When I tried to use Hibernate (JPA 2.0) as a persistence provider in glasfish 3.x application server , I encountered the following problem and my EJB application can't be deployed.


Initializing...
deploy?DEFAULT=/home/alemnew/NetBeansProjects/LMS-ejb/build/classes&name=LMS-ejb&libraries=/home/alemnew/NetBeansProjects/LMSRemote/dist/LMSRemote.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/ejb3-persistence.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/hibernate-annotations.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/hibernate-commons-annotations.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/hibernate-validator.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/hibernate3.jar,/home/alemnew/NetBeansProjects/LMS-ejb/lib/hsqldb.jar&force=true failed on GlassFish Server 3.1.2 
 Error occurred during deployment: Exception while preparing the app : java.lang.ClassNotFoundException: org.hibernate.ejb.HibernatePersistence. Please see server.log for more details.
/home/alemnew/NetBeansProjects/LMS-ejb/nbproject/build-impl.xml:971: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 1 second)
=========================================

As a temporary solution I used eclipseLink (JPA 2.0) instead.  The problem seams like, glassfish doesn't have Hibernate as a persistence provider by default. Hence, manual operation is needed, I think. I will try to solve......