Monday, May 20, 2013

ORA-01033: ORACLE initialization or shutdown in progress

I am sure you reading this post because you've got this ORA-01033 error message.
Quickly without wasting time here is the solution:

I have noticed this error happened when the database has not been properly shutdown .
  1. Go to the command prompt CMD:
  2. > set oracle_sid= your_sid_name
  3. > sqlplus /nolog
  4. SQL> connect / as sysdba
  5. output: connected
  6. SQL> shutdown abort
  7. output: ORACLE instance shut down
  8. SQL> startup nomount
  9. output: ORACLE instance started
  10. SQL> alter database mount
  11. output: Database altered
  12. SQL> alter database open
  13. output: Database altered
  14.  Done !


Wednesday, May 8, 2013

java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.sun.faces.application.view.StateHolderSaver

I have faced this problem while navigating back and forth in my project
using netbeans 7.1 , glassfish 3+ , primefaces 2.1 and openfaces 3.0;

After some minutes of headache I finally solve by adding <redirect/> under the navigation case in web.xml file:
e.g:

<navigation-rule>
        <from-view-id>/student/SearchEdit.xhtml</from-view-id>
        <navigation-case>
            <from-outcome>back</from-outcome>
            <to-view-id>/student/Search.xhtml</to-view-id>
            <redirect/>
        </navigation-case>
    </navigation-rule>

hope you rock!!!

Wednesday, January 30, 2013

IP restriction with jsf and glassfish

After completing one of my j2ee application I needed to secure it but how ?
The first idea that came into my mind was to develop my own custom security module. What I did but somewhere along the lines I change my mind for a built-in REALM.

Implementing the built-in security that come with glassfish is straight forward
as you can see from these blogs
  1. http://blog.eisele.net/2011/01/jdbc-security-realm-and-form-based.html
  2. http://jugojava.blogspot.com/2011/02/jdbc-security-realm-with-glassfish-and.html
  3. http://www.greenkode.com/2011/09/user-authentication-and-authorization-using-jaas-and-servlet-3-0-login/ 
Everything  went smoothly I realize there was no simple option in glassfish that could allow me to prevent some ip address  from accessing my application. Even thought we can use virtual server  and certificates to do the job, I found them advanced and difficult .

An easier way to do this will just be to use the following

HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); 
String ip = httpServletRequest.getRemoteAddr();
To get the incoming ip and .... rocks!!

I will be back on this topics soon

Wednesday, December 26, 2012

Leading zeroes formatting ireport

Hi, welcome to my blog. Are you having problem formatting leading zeroes in jasper ireport
for example:

1--->001
 10-->010

Steps:
1.Right clikc the textfield -->field pattern --->put the number of zero corresponding to the number of digit you want.
2. For the above example , I have three digits so I should put  000
3. Rock it !!!!!!!!!


Monday, September 17, 2012

Jasper report: column footer not appearing directly below detail band

Maybe you wanted the column footer to appear directly below the detail band without success.
Certainly this tips may help you.
1.Go to designer view ---> Report inspector -->right click report name --->properties-->Check "Float column Footer".
2.Go back to design view --->set the height of summary band to zero or just delete it.
3. Rock your world.