Hi I am trying to develop an example of custom PasswordCipher for Password
Datasource. But A ClassNoDefFoundError is thrown and maybe this is because
I am following an old guide.

The class is:

public class PasswordReverse implements PasswordCipher {

@Override
public String decrypt(char[] arg0) {
System.out.println("AAAA");
return new String(arg0);
}

@Override
public char[] encrypt(String arg0) {
System.out.println("BBBB");
return arg0.toCharArray();
}

}

and in META-INF/org.apache.openejb.resource.jdbc.cipher.PasswordCipher

I have created a file called reverse with next content:

org.superbiz.PasswordReverse

and finally at WEB-INF/resources.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <Resource id="book" type="DataSource">
      JdbcUrl = jdbc:hsqldb:mem:my-ds

      JdbcDriver = org.hsqldb.jdbcDriver

      Password = AAAA

      PasswordCipher =reverse

      JtaManaged = true
  </Resource>
</resources>

But next exception is thrown at startup:

Caused by: org.apache.xbean.recipe.ConstructionException: Error invoking
factory method: public static javax.sql.CommonDataSource
org.apache.openejb.resource.jdbc.DataSourceFactory.create(java.lang.String,boolean,java.lang.Class,java.lang.String,org.apache.openejb.util.Duration,org.apache.openejb.util.Duration,org.apache.openejb.util.Duration)
throws
java.lang.IllegalAccessException,java.lang.InstantiationException,java.io.IOException
at
org.apache.xbean.recipe.ReflectionUtil$StaticFactory.create(ReflectionUtil.java:1006)
at
org.apache.xbean.recipe.ObjectRecipe.internalCreate(ObjectRecipe.java:276)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:96)
at org.apache.xbean.recipe.AbstractRecipe.create(AbstractRecipe.java:61)
at
org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2201)
at
org.apache.openejb.config.ConfigurationFactory.install(ConfigurationFactory.java:436)
at
org.apache.openejb.config.AutoConfig.installResource(AutoConfig.java:2074)
at
org.apache.openejb.config.AutoConfig.processApplicationResources(AutoConfig.java:976)
at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:185)
at
org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:401)
at
org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:962)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1214)
... 16 more
Caused by: org.apache.openejb.cipher.PasswordCipherException: Cannot load
password cipher class 'reverse'


Am I missing something?



-- 
+----------------------------------------------------------+
  Alex Soto Bueno
  www.lordofthejars.com
+----------------------------------------------------------+

Reply via email to