tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Tomee 1.6 Custom JDBC Factory not working
Date Wed, 28 May 2014 05:48:39 GMT
normally nothing since that the fallback but as field:

public class SecuredJdbcDataSourceFactory extends DataSourceFactory {

Properties properties; // +setter

public javax.sql.DataSource createJDBCDataSource()
throws Exception {
System.out.println("Setting decrypted password starts");
properties.setProperty(PROP_PASSWORD, new AesCrypto().decrypt(
properties.getProperty(PROP_PASSWORD)));
System.out.println("Setting decrypted password ends");
return createDataSource(properties);

}
}

btw tomee has cipher support:
http://tomee.apache.org/datasource-password-encryption.html




Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-05-28 3:45 GMT+02:00 Nina Kumar <ninaanish@yahoo.com>:

> What value should I set to pass properties in tomee.xml?
> Resource id=" jdbc/mydatasource" type="javax.sql.DataSource"
> factory-name="createJDBCDataSource"
> class-name="com.jdbc.crypto.factory.SecuredJdbcDataSourceFactory"
> constructor="properties">
> # tomcat pool configuration
> auth=Container
> jdbcDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
> jdbcUrl = jdbc:sqlserver://***:1433;databaseName=***
> userName = ****
> password = 1RwfeJY8mclgyN/TH13LGjHKIBADY=
> validationQuery = SELECT 1
> LogSql = true
> properties=properties
>
>
> ay 27, 2014 6:24:16 PM org.apache.openejb.util.OpenEJBErrorHandler
> handleUnknownError
> SEVERE: FATAL ERROR: Unknown error in Assembler. Please send the following
> stack trace and this message to users@openejb.apache.org :
> org.apache.xbean.recipe.MissingFactoryMethodException: Constructor has 0
> arugments but expected 1 arguments: public com.
> jdbc.crypto.factory.SecuredJdbcDataSourceFactory()
> at
> org.apache.xbean.recipe.ReflectionUtil.findConstructor(ReflectionUtil.java:622)
> at org.apache.xbean.recipe.ObjectRecipe.findFactory(ObjectRecipe.java:563)
>
>
> public class SecuredJdbcDataSourceFactory extends DataSourceFactory {
>
> public javax.sql.DataSource createJDBCDataSource(Properties properties)
> throws Exception {
> System.out.println("Setting decrypted password starts");
> properties.setProperty(PROP_PASSWORD, new
> AesCrypto().decrypt(properties.getProperty(PROP_PASSWORD)));
> System.out.println("Setting decrypted password ends");
> return createDataSource(properties);
>
> }
> }
> Thank You
>
> Sent from Yahoo Mail on Android<https://overview.mail.yahoo.com/mobile/?.src=Android>
>
>  ------------------------------
> * From: * Romain Manni-Bucau <rmannibucau@gmail.com>;
> * To: * users@tomee.apache.org <users@tomee.apache.org>; Nina Kumar <
> ninaanish@yahoo.com>;
> * Subject: * Re: Tomee 1.6 Custom JDBC Factory not working
> * Sent: * Sun, May 18, 2014 9:42:57 AM
>
>   Hi
>
> here a sample:
>
> <Resource  id="name"
>           types="org.foo.Bar"
>           factory-name="createResource"
>           class-name="org.foo.BarFactory"
>           constructor="attribute1, attr2">
>   attribute1 = value1
> </Resource>
>
> will match BarFactory.createResource(attribute1, attr2)
>
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-05-17 19:16 GMT+02:00 Nina Kumar <ninaanish@yahoo.com>:
> > Hi
> >
> >
> > I am getting below error when I set a custom factory resource in
> tomee.xml.
> > I tried factory-name but it is not working.
> >
> >
> > Caused by: org.xml.sax.SAXException: Unsupported Attribute(s): factory.
> Supported Attributes are: type, jar, provider, id, class-name, constructor,
> factory-name, jndi, aliases.  If the setting is a configuration property it
> must be placed inside the element body.
> >
> > Thank you
> >
> > Nina
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message