Failed to load JNI shared library “Program Files (x86)\Java\jdk1.6.0_20\jre\bin\client\jvm.dll”


If you get the following exception while trying to open Eclipse on Windows 7 version;

Failed to load JNI shared library “Program Files (x86)\Java\jdk1.6.0_20\jre\bin\client\jvm.dll”

You need to download the correct (Bit Architecture) version of Eclipse program.

Your jdk  architecture (32 or 64) of the Java and the Eclipse architecture should be the same.

If you are using the 32 Bit Architecture of Java, you have to Download 32 bit Eclipse version or if you are using 64 bit version of Java you have to download the 64 bit version of Eclispe program.

Advertisements

PrimeFaces navigation problem JSF 2.0


      Click here to attend Spring Framework 4.x and certification course with a discount

While using PrimeFaces p:commandButton component, you may have some problems regarding the JSF 2.0 xml-less navigation. Normally, using JSF 2.0 technology, developer can navigate between views by only returning  a string view-id like the following example (there is no need to define rules inside faces-config.xml file);

inside UserBean;

public String login() {
  return "success"; //view-id
}

 

<h:commandButton  action="#{userBean.login}" value="Login" style="margin-left:0px" />

or  directly by setting

<h:commandButton action="success.xhtml" value="Submit" />

However, as the document of PrimeFaces (FAQ) indicates, http://primefaces.org/faq.html

PrimeFaces does not support forward based navigations within an ajax request, you need to do redirect instead or set ajax to false.

so that p:commandButton could be used like the following way if you need to have AJAX functionality with it;

inside UserBean;

public String login() {
  return "success.xhtml?faces-redirect=true"; //view-id

 

<p:commandButton ajax="true" action="#{userBean.login}" value="Login" update="panel"
style="margin-left:0px" />


java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/RichTextString


If you get the following exception you need to download the related jar file named poi-3.7.xyz.jar here

java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/RichTextString
    org.primefaces.component.export.ExporterFactory.getExporterForType(ExporterFactory.java:22)
    org.primefaces.component.export.DataExporter.processAction(DataExporter.java:94)
    javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
    javax.faces.component.UICommand.broadcast(UICommand.java:300)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

java.lang.ClassNotFoundException: com.lowagie.text.Phrase


If you get the following error while using for example Prime Faces DataExporter or similar components depending on itext library. Download the related itext-2.1.7.jar here
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/Datatable] threw exception [com/lowagie/text/Phrase] with root cause
java.lang.ClassNotFoundException: com.lowagie.text.Phrase
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
    at org.primefaces.component.export.ExporterFactory.getExporterForType(ExporterFactory.java:24)
    at org.primefaces.component.export.DataExporter.processAction(DataExporter.java:94)
    at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
    at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
    at javax.faces.component.UICommand.broadcast(UICommand.java:300)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:304)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

No unique bean of type [org.springframework.security.authentication.AuthenticationManager] is defined:


      Click here to attend Spring Framework 4.x and certification course with a discount

If you get the following exception while injecting AuthenticationManager object inside services/controller classes using Spring Framework.

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.springframework.security.authentication.AuthenticationManager] is defined: expected single matching bean but found 3: [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0, org.springframework.security.authentication.ProviderManager#0, org.springframework.security.authenticationManager]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:800)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement
.inject(AutowiredAnnotationBeanPostProcessor.java:553)

… 39 more

You should add the Qualifier Annotation for the bean AutoWired;

@Autowired
@Qualifier(“authenticationManager”)
public void setAuthenticationManager(AuthenticationManager autm) {
authenticationManager = autm;
}

I assume you declared alias for the AuthenticationManager object such as
<authentication-manager alias=”authenticationManager“>