6
import org.jasypt.util.password.*;
public class encrypt
{
private static BasicPasswordEncryptor passenc;
public encrypt()
{
passenc=new BasicPasswordEncryptor();
}
public static void useradd()
{
System.out.println("IN Useradd");
}
當我調用useradd的()從一個JSF文件我得到以下錯誤加密通過jasypt
java.lang.NoClassDefFoundError: Lorg/jasypt/util/password/BasicPasswordEncryptor;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at com.sun.faces.mgbean.BeanBuilder.scanForAnnotations(BeanBuilder.java:476)
at com.sun.faces.mgbean.BeanBuilder.loadBeanClass(BeanBuilder.java:449)
at com.sun.faces.mgbean.BeanBuilder.bake(BeanBuilder.java:379)
at com.sun.faces.mgbean.ManagedBeanBuilder.bake(ManagedBeanBuilder.java:86)
at com.sun.faces.mgbean.BeanManager.preProcessBean(BeanManager.java:349)
at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:258)
at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:191)
at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:73)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:71)
at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:69)
at org.apache.el.parser.AstValue.getTarget(AstValue.java:68)
at org.apache.el.parser.AstValue.invoke(AstValue.java:187)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
at javax.faces.component.UICommand.broadcast(UICommand.java:311)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jasypt.util.password.BasicPasswordEncryptor
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 39 more
請告訴我爲什麼發生這種情況。
我有...如果我創建了一個主要方法,並從主調用useradd的()()我得到的輸出...我只得到,而從JSF運行錯誤... – DanMatlin
@Krishan:注意「LIB你的webapp目錄「的一部分。如果你從控制檯應用程序的'main'方法調用它,那將是無關緊要的。我不知道的類路徑JSF的細節,但是這就是你需要在這裏解決什麼。 –
日Thnx隊友....浪費了我整整一天的TIS ... – DanMatlin