Sorry I am sure that I am doing something wrong but I cannot see what, but if you drop this war inside TomEE you will see the exception. I probably being missing something but I cannot see exactly what.
2014-09-23 10:01 GMT+02:00 Romain Manni-Bucau <rmannibu...@gmail.com>: > doc is http://tomee.apache.org/datasource-password-encryption.html > actually > > > Romain Manni-Bucau > Twitter: @rmannibucau > Blog: http://rmannibucau.wordpress.com/ > LinkedIn: http://fr.linkedin.com/in/rmannibucau > Github: https://github.com/rmannibucau > > > 2014-09-23 9:49 GMT+02:00 Andy Gumbrecht <andy...@gmx.de>: > > Also followed our own site documentation which is not really clear: > > > http://tomee.apache.org/examples-trunk/datasource-ciphered-password/README.html > > I will try to make it more useful / readable. > > > > Andy. > > > > > > On 23/09/2014 09:00, Jean-Louis Monteiro wrote: > >> > >> We have aliases for our internals so you don't need to add the fully > >> qualified name. > >> But in your case, there is nothing behind the alias reverse. > >> > >> Si in the DS definition, use the FQN of the cipher class. > >> > >> -- > >> Jean-Louis Monteiro > >> http://twitter.com/jlouismonteiro > >> http://www.tomitribe.com > >> > >> On Mon, Sep 22, 2014 at 2:42 PM, Alex Soto <asot...@gmail.com> wrote: > >> > >>> 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 > >>> +----------------------------------------------------------+ > >>> > > > -- +----------------------------------------------------------+ Alex Soto Bueno - Computer Engineer www.lordofthejars.com +----------------------------------------------------------+