Professional Web Applications Themes

datasource service factory not available cfmx7 - Coldfusion - Advanced Techniques

I have a java class that I load from CF with code like this: <cfscript> InvoiceSet = CreateObject ("java", "edu.cornell.fcs.invoices.InvoiceSet"); InvoiceSet.init(blah); </cfscript> Then in my java class, I get a database connection like this: DataSourceService ds = ServiceFactory.getDataSourceService(); This worked fine under CFMX7 pro version. It stopped working when we upgraded to Enterprise, and have CFMX running under Jrun 4. Now we get coldfusion.server.ServiceFactory$ServiceNotAvailab leException: The DataSource service is not available. It seems as though the class is loaded in a separate JVM from the CF JVM. Any ideas on how to get around this? I'd like to be able ...

  1. #1

    Default datasource service factory not available cfmx7

    I have a java class that I load from CF with code like this:
    <cfscript>
    InvoiceSet = CreateObject ("java", "edu.cornell.fcs.invoices.InvoiceSet");
    InvoiceSet.init(blah);
    </cfscript>
    Then in my java class, I get a database connection like this:
    DataSourceService ds = ServiceFactory.getDataSourceService();

    This worked fine under CFMX7 pro version. It stopped working when we upgraded
    to Enterprise, and have CFMX running under Jrun 4. Now we get
    coldfusion.server.ServiceFactory$ServiceNotAvailab leException: The DataSource
    service is not available.

    It seems as though the class is loaded in a separate JVM from the CF JVM.
    Any ideas on how to get around this? I'd like to be able to continue to access
    the datasources registered in CFMX administrator from within my java code.



    smandl Guest

  2. #2

    Default Re: datasource service factory not available cfmx7

    smandl wrote: 

    You can do this more easily now with the Administrator API in CF 7.

    --
    Matt Woodward
    com
    Team Macromedia - ColdFusion
    mpwoodward Guest

  3. #3

    Default Re: datasource service factory not available cfmx7

    I thought the Administrator API was a bunch of CFC's. I am trying to access the
    registered datasources from a java class. How should I go about doing this? Is
    there some doentation or examples you can point me to?

    smandl Guest

  4. #4

    Default Re: datasource service factory not available cfmx7

    this works for me:CFMX6 & 7
    factory = CreateObject("java", "coldfusion.server.ServiceFactory");
    ds_service = factory.datasourceservice;
    dsnamestest = ds_service.getDatasources();

    HTH,
    Tim
    --
    Tim Carley
    www.recfusion.com
    com
    Mountain Guest

  5. #5

    Default Re: datasource service factory not available cfmx7

    smandl wrote: 

    Sorry, I didn't read your post closely enough to see that you were
    trying to do that via Java. I think you got another response from
    someone else, but in CF 7 Enterprise there is also a proxy so that you
    can call CFCs from Java. I have yet to dig into it much but that might
    also be a way to go.

    --
    Matt Woodward
    com
    Team Macromedia - ColdFusion
    mpwoodward Guest

  6. #6

    Default Re: datasource service factory not available cfmx7

    Well, it turns out this is more fundamental than I origianlly thought. I gave
    up on trying to get a connection from the coldfusion datasourceservice, and
    created the datasource in a different way. Now I can't return the resultset I
    generate, which gets back to my original question. Are java classes loaded in a
    different JVM than the CF JVM when using the createobject function?

    smandl Guest

Similar Threads

  1. Replies: 17
    Last Post: July 13th, 07:48 PM
  2. Replies: 2
    Last Post: May 27th, 12:50 PM
  3. Using jndi datasource on webshere 6 & cfmx7
    By Chrisneedshelp in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: August 30th, 01:24 PM
  4. Problem Mapping Datasource - CFMX7
    By Willow315 in forum Coldfusion - Getting Started
    Replies: 2
    Last Post: May 23rd, 01:06 PM
  5. The DataSource service is not available.
    By Chris Henkel in forum Macromedia ColdFusion
    Replies: 0
    Last Post: March 1st, 11:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139