Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error while assigning resultset value to Querytable variable in Coldfusion 10

Guest
Apr 08, 2014 Apr 08, 2014

We are upgrading from coldfusion 8 to 10. Internally we were using java function to to get the data.

In java function we have a resultset object, if we assign this resultset value to Querytable variable, we are getting below error. This code was working fine in coldfusion 8.

 

Detail    This exception is usually caused by service startup failure. Check your server configuration.

Message    The Runtime service is not available.

StackTrace    coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService(ServiceFactory.java:117) at coldfusion.runtime.RequestMonitor.<clinit>(RequestMonitor.java:14) at coldfusion.sql.QueryTable.populate(QueryTable.java:358) at coldfusion.sql.QueryTable.populate(QueryTable.java:283) at coldfusion.sql.QueryTable.<init>(QueryTable.java:96) at com.myCompany.myClass.myFunct(myClass.java:627) at

 

Here is the function which is causing error.

static private QueryTable myFunct(String userId, SessionFactory sf) {

        PreparedStatement pStmt = null;

        ResultSet rs = null;

        QueryTable ret = null;

         try{

            Query q = sf.getCurrentSession().getNamedQuery("ListUsers");

            pStmt = sf.getCurrentSession().connection().prepareStatement(q.getQueryString());

            rs = pStmt.executeQuery();// works fine till here

            ret = new QueryTable(rs);  // error line         

            rs.close();

        }catch(Exception e){

            e.printStackTrace();

            throw new RuntimeException(e.getLocalizedMessage());

        }

        return ret;

    }

Can you provide some help on this. Please let me know if you need any other details.

859
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2014 Apr 08, 2014

This code seems to mix the Java and ColdFusion idioms. To make it work, you have to familiarize Java with ColdFusion's QueryTable object. The usual way to do this is to initially include cfusion.jar in the classpath and then introduce the line import coldfusion.sql.QueryTable; in the code that defines the class in question.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 08, 2014 Apr 08, 2014

Thanks BKBK.  We have already done that.

Included cfusion.jar in the classpath and introduced the line import coldfusion.sql.QueryTable

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2014 Apr 08, 2014

OK. What about installing the latest Java Development Kit (JDK), linking it with ColdFusion and testing?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 08, 2014 Apr 08, 2014

We have already upgraded Java form version 1.5 to 1.7

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2014 Apr 08, 2014

It will certainly help to show us all the relevant error messages from the log files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 14, 2014 Apr 14, 2014

We have found this error is logs

coldfusion.runtime.Encryptor$InvalidParamsForEncryptionException: An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..

    at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:303)

    at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:284)

    at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5353)

    at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5326)

    at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5458)

    at com.vmware.vcp.service.impl.EncryptColdFusionImpl.decrypt(EncryptColdFusionImpl.java:65)

    at com.vmware.vcp.web.servlet.ApplicationConfigServlet.initEmailService(ApplicationConfigServlet.java:119)

    at com.vmware.vcp.web.servlet.ApplicationConfigServlet.init(ApplicationConfigServlet.java:51)

    at javax.servlet.GenericServlet.init(GenericServlet.java:160)

    at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:121)

    at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)

    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)

    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)

    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)

    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)

    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)

    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)

    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)

    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

    at java.util.concurrent.FutureTask.run(FutureTask.java:166)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:722)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2014 Apr 14, 2014

Could you please show us the 2 stack traces in full, including the name of the log file?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 18, 2014 Apr 18, 2014

We have decompliled the   coldfusion.sql.QueryTable class and found that we are getting error in populate(ResultSet rs, int maxrows)  function.

public void populate(ResultSet rs, int maxrows)

    throws SQLException

  {

    if ((rs instanceof QueryTable))

    {

      makeShallowCopy((QueryTable)rs, maxrows);

      return;

    }

    this.meta = new QueryTableMetaData(rs.getMetaData());

    setColumnNames(this.meta.getColumnLabels());

   

    int k = 0;

    int count = 0;

    boolean isMySqlBit = false;

    while ((rs.next()) && ((maxrows == -1) || (k < maxrows)))

    {

      if ((count % 10 == 9) && (RequestMonitor.isRequestTimedOut())) {

        throw new RequestTimedOutException("CFQUERY");

      }

Can you please tell us , why we are checking this condition.

((count % 10 == 9) && (RequestMonitor.isRequestTimedOut()))

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 18, 2014 Apr 18, 2014
LATEST

The information you have provided so far is disjointed. It makes it difficult to piece the story together.

In my opinion, it is best to start by examining the log files. Pick out all the relevant error messages, in full, and let us examine them together.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources