Re: Configuring SSL

From: Michael Gentry (blacknex..mail.com)
Date: Sat Jun 21 2008 - 09:37:17 EDT

  • Next message: Andrus Adamchik: "Re: weakly referenced paged queries"

    I was thinking at first you might need to specify a custom DB Adapter,
    but I think this is the real exception causing the problem:

    Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create
    PoolableConnectionFactory (Io
    exception: Unknown host specified )
    Caused by: java.sql.SQLException: Io exception: Unknown host specified
           at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)

    The Oracle "Unknown host specified" exception is bubbling up and
    Cayenne cannot figure out the database adapter to use. It still seems
    like the Oracle JDBC driver cannot connect to your server (the host).

    /dev/mrg

    On Fri, Jun 20, 2008 at 11:15 AM, Elena Doyle <ed28..dmin.cam.ac.uk> wrote:
    > Andrus,
    >
    > I have managed to sort the previous error, the server is a proxy and I have to put /sevice_name
    > rather then : to make it work.
    >
    > Now I get an error:
    >
    > Exception in thread "main" org.apache.cayenne.CayenneRuntimeException: [v.2.0.4 October 8 2007]
    > Error detecting database type
    > at org.apache.cayenne.dba.AutoAdapter.loadAdapter(AutoAdapter.java:159)
    > at org.apache.cayenne.dba.AutoAdapter.getAdapter(AutoAdapter.java:129)
    > at org.apache.cayenne.dba.AutoAdapter.getExtendedTypes(AutoAdapter.java:239)
    > at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:246)
    > at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:301)
    > at org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:60)
    > at
    > org.apache.cayenne.access.DataDomainQueryAction$1.transform(DataDomainQueryAction.java:273)
    > at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:836)
    > at
    > org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:270
    > )
    > at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:110)
    > at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
    > at
    > org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
    > at org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
    > at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1395)
    > at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1384)
    > at uk.ac.cam.admin.ed284.Main.main(Main.java:19)
    > Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io
    > exception: Unknown host specified )
    > at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
    > at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    > at org.apache.cayenne.access.DataNode$TransactionDataSource.getConnection(DataNode.java:544)
    > at org.apache.cayenne.conf.NodeDataSource.getConnection(NodeDataSource.java:47)
    > at org.apache.cayenne.dba.AutoAdapter.loadAdapter(AutoAdapter.java:144)
    > ... 15 more
    > Caused by: java.sql.SQLException: Io exception: Unknown host specified
    > at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
    > at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
    > at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
    > at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
    > at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:494)
    > at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:411)
    > at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:490)
    > at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
    > at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    > at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
    > at
    > org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    > at
    > org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    > at
    > org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
    > at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
    > ... 19 more
    >
    > -----Original Message-----
    > From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Sent: 19 June 2008 13:17
    > To: use..ayenne.apache.org
    > Subject: Re: Configuring SSL
    >
    > At this point there's not much I can do to help... I guess you should try writing a simple JDBC
    > example to see that the property makes a difference outside Cayenne/DBCP. If it does, check your
    > implementation of the factory, if it doesn't - check the Oracle setup.
    >
    > Andrus
    >
    >
    > On Jun 19, 2008, at 3:13 PM, Elena Doyle wrote:
    >> Andrus,
    >>
    >> I actually got the custom factory to work as in if it is not a secure
    >> connection, I can connect using my custom class.
    >>
    >> But if I try to go to a secure site, I get this
    >>
    >> Caused by: java.sql.SQLException: Io exception: Remote host closed
    >> connection during handshake
    >> at
    >> oracle
    >> .jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    >> at
    >> oracle
    >> .jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
    >> at
    >> oracle
    >> .jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255)
    >> at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387)
    >> at
    >> oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
    >> 441)
    >> at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    >> at
    >> oracle
    >> .jdbc
    >> .driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    >> at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    >> at
    >> org
    >> .apache
    >> .commons
    >> .dbcp
    >> .DriverConnectionFactory
    >> .createConnection(DriverConnectionFactory.java:38)
    >> at
    >> org
    >> .apache
    >> .commons
    >> .dbcp
    >> .PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:
    >> 294)
    >> at
    >> org
    >> .apache
    >> .commons
    >> .dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:
    >> 1247)
    >> at
    >> org
    >> .apache
    >> .commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:
    >> 1221)
    >>
    >> Which is what I get if I do not do extra properties.
    >>
    >>
    >> -----Original Message-----
    >> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    >> Sent: 18 June 2008 18:07
    >> To: use..ayenne.apache.org
    >> Subject: Re: Configuring SSL
    >>
    >> Ah... DBCP depends on another Commons library. You will need
    >> commons- pool jars as well:
    >>
    >> http://commons.apache.org/pool/
    >>
    >> Andrus
    >>
    >>
    >> On Jun 18, 2008, at 7:58 PM, Elena Doyle wrote:
    >>
    >>> I have ran it with the cayenne.xml pointing to my custom factory
    >>> class and I got
    >>>
    >>> java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/
    >>> GenericObjectPool
    >>> at
    >>> custom
    >>> .oracle
    >>> .access
    >>> .OracleSSLDataSourceFactory
    >>> .getDataSource(OracleSSLDataSourceFactory.java:39)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf
    >>> .RuntimeLoadDelegate.shouldLoadDataNode(RuntimeLoadDelegate.java:297)
    >>> at org.apache.cayenne.conf.ConfigLoader
    >>> $NodeHandler.init(ConfigLoader.java:330)
    >>> at org.apache.cayenne.conf.ConfigLoader
    >>> $DomainHandler.startElement(ConfigLoader.java:219)
    >>> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1672)
    >>> at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
    >>> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
    >>> at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
    >>> at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
    >>> at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
    >>> at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    >>> at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:
    >>> 448)
    >>> at
    >>> org.apache.cayenne.conf.ConfigLoader.loadDomains(ConfigLoader.java:
    >>> 78)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf.DefaultConfiguration.initialize(DefaultConfiguration.java:161)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf.Configuration.initializeSharedConfiguration(Configuration.java:
    >>> 276)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf.Configuration.initializeSharedConfiguration(Configuration.java:
    >>> 258)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf.Configuration.initializeSharedConfiguration(Configuration.java:
    >>> 239)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne
    >>> .conf.Configuration.getSharedConfiguration(Configuration.java:176)
    >>> at
    >>> org
    >>> .apache
    >>> .cayenne.access.DataContext.createDataContext(DataContext.java:229)
    >>> at uk.ac.cam.admin.ed284.Main.main(Main.java:9)
    >>> Exception in thread "main"
    >>>
    >>> By default the mapping file points to DriverDataSourceFactory. I
    >>> presume that is what I am trying to customise and I need to make sure
    >>> I have in my custom factory everything DriverDataSourceFactory Does?
    >>>
    >>> Elena
    >>>
    >>> -----Original Message-----
    >>> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    >>> Sent: 18 June 2008 17:13
    >>> To: use..ayenne.apache.org
    >>> Subject: Re: Configuring SSL
    >>>
    >>>
    >>> On Jun 18, 2008, at 7:05 PM, Elena Doyle wrote:
    >>>
    >>>> I currently have cayenne.jar in the build path
    >>>
    >>> Hmm... That should be all you need. That's what I meant by
    >>> "classpath". There is an alternative in Eclipse. Once you have an
    >>> empty class that is declared to implement the interface, e.g.:
    >>>
    >>> public class OracleSSLDataSourceFactory implements DataSourceFactory
    >>> {
    >>>
    >>> }
    >>>
    >>> You can right click on this class icon and select "Source ->
    >>> Override/ Implement Methods...", and then select all methods from
    >>> DataSourceFactory interface as shown by Eclipse.
    >>>
    >>> Andrus
    >>>
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Sat Jun 21 2008 - 09:37:47 EDT