My original post to CF-TALK was this: (response follows)
Tried this on CF-Server to no avail.
We are trying to get CF MX 6.1 running as a J2EE application under JRun.
We are getting this error when trying to load and initialize a Java Class
object
coldfusion.server.ServiceFactory$ServiceNotAvailableException: The
DataSource service is not available.
The object tag is as follows.
<cfobject type="JAVA" action="Create" name="MapperAdaptor"
class="com.newsstand.library.WWWMapperAdaptor">
We then call the init function including the data source name that we use
throughout the system and get the above error.
The Java here fails.
import coldfusion.server.DataSourceService;
import coldfusion.server.ServiceFactory;
.
.
.
public WWWMapperAdaptor(String dataSourceName, String username)
throws Exception
{
// Get a service locator from the cold fusion server.
DataSourceService ds = ServiceFactory.getDataSourceService();
// Lookup the specific datasource.
dataSource = ds.getDatasource(dataSourceName);
this.username = username;
// Get the list of subscriptions belonging to this user.
// Loads data into the subscriptions and userData instance
variables.
fillInSubscriptions();
}
Specifically on this line:
DataSourceService ds = ServiceFactory.getDataSourceService();
But this CF works just fine.
// This will dump all of the services in CFMX
<cfobject type="JAVA" action="Create" name="factory"
class="coldfusion.server.ServiceFactory">
<cfdump var="#factory#">
// This will dump the datasources and drivers manipulating datasources is as
simple as modifying
// the structure datasources below
<cfobject type="JAVA" action="Create" name="factory"
class="coldfusion.server.ServiceFactory">
<cfset sqlexecutive = factory.getDataSourceService()>
<cfset drivers=sqlexecutive.drivers>
<cfset datasources=sqlexecutive.datasources>
<cfdump var="#sqlexecutive#" label="DataSource Factory">
<cfdump var="#datasources#" label="DataSources">
<cfdump var="#drivers#" label="Database Drivers">
Currently the class file is in a path referenced by the specific CF
instance. My Java developer feels that this is a class loader problem and
we are moving this class file to the same location as the system wide CF jar
files.
All of this works just fine in stand alone mode.
====================================================
The response I got was:
Certain coldfusion.* classes only work in the context of the
ColdFusion class loader - therefore the Java objects work when invoked
from CF but will not worked when invoked outside of CF.
Shawn
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Stay Ahead of Hackers - Download ZoneAlarm Pro
http://www.houseoffusion.com/banners/view.cfm?bannerid=65
Message: http://www.houseoffusion.com/lists.cfm/link=i:10:5455
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/10
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:10
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.10
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54