8 Replies Latest reply on Feb 7, 2005 12:17 PM by suzyrizzo

    Crystal Reports configuration

    suzyrizzo Newbie

      I'm trying to integrate some crystal reports into my application, and I can't seem to configure things correctly. The crystal jars are found ok, but the crystal config file is not found. Crystal tech support insists that the config file simply needs to be "on the classpath". I guess I'm not sure what that means in JBoss.

      The versions I'm using are JBoss 3.2.5 and Crystal Reports 10.

      Here's the most recent version of my setup:

      jboss/server/all/lib (Crystal jars)
      CrystalCommon.jar
      CrystalFCM.jar
      CrystalQueryEngine.jar
      CrystalReportEngine.jar
      rascore.jar
      webreporting-core.jar

      jboss/server/all/deploy/MyApp/WEB-INF/classes (Crystal config file)
      CrystalReportsEngine-config.xml

      The error I get is from crystal's report engine. Here's a snippet of the log:

      16:28:01,984 INFO [STDOUT] Opening report: userInfo.rpt
      16:28:05,468 ERROR [reportengineinterface] Unable to locate CrystalReportEngine-config.xml
      16:28:05,531 INFO [STDOUT] com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Report location is not specified in the configuration file---- Error code:-2147215356 Error code name:fileNotOpened


      And the error is coming from the first line in the try block of this code (where I try to create a crystal report):
      public void genReport(String report, HttpServletRequest sreq, HttpServletResponse sresp, ServletContext contxt) {
       System.out.println("Opening report: " + report);
       IReportSourceFactory2 rptSrcFactory = new JPEReportSourceFactory();
       CrystalReportViewer viewer = null;
       try{
       IReportSource reportSource = (IReportSource) rptSrcFactory.createReportSource(report, Locale.US);
       viewer = new CrystalReportViewer();
       viewer.setReportSource(reportSource);
       viewer.setOwnPage(true);
       viewer.setEnableLogonPrompt(true);
       viewer.setHasRefreshButton(true);
       viewer.showFirstPage();
       viewer.processHttpRequest(sreq, sresp, contxt, sresp.getWriter());
       viewer.dispose();
       }
       catch(Exception e)
       {
       System.out.println(e);
       setError(true);
       setErrmsg(e.getMessage());
       }
       }
      
      


      And the content of CrystalReportsEngine-config.xml:
      <?xml version="1.0" encoding="utf-8"?>
      <CrystalReportEngine-configuration>
       <reportlocation>/view</reportlocation>
       <timeout>10</timeout>
       <keycode>MyLicenseKeyCodeHere</keycode>
      </CrystalReportEngine-configuration>


      I'd love to hear from anyone who has gotten Crystal & JBoss to work together...or from JBoss users who can suggest where (and why) I might put the config file so that it's "on the classpath."

      Thanks,
      Sue.

        • 1. Re: Crystal Reports configuration
          suzyrizzo Newbie

          Just thought I'd post a solution. It was really a stupid error on my part.

          The crystal jars go where I put them:
          jboss/server/all/lib

          The crystal config file goes in the conf folder:
          jboss/server/all/lib

          The crystal config file needs to be spelled correctly (DUH!) It is CrystalReportEngine-config.xml instead of CrystalReportsEngine-config.xml

          And the configuration's reportlocation needs to be relative to the jar file that uses it. In my case, the jar is in jboss/server/all/lib & my report files (rpt's) are in jboss/server/all/view

          <?xml version="1.0" encoding="utf-8"?>
          <CrystalReportEngine-configuration>
           <reportlocation>../view</reportlocation>
           <timeout>10</timeout>
           <keycode>MyLicenseKeyCodeHere</keycode>
          </CrystalReportEngine-configuration>


          Sue.


          • 2. Re: Crystal Reports configuration
            christina ku Newbie

            Hi Sue,

            i got a question here... i am now trying to display a sample crystal report (.rpt) on my application. It isn't web based.. it's just a simple java application. i try to call the report and display it using ReportViewerBean which is a viewer in package :

            com.seagatesoftware.img.ReportViewer.ReportViewerBean

            it needs a url for the report location and i figure i need to put the report on a server.. currently, i am connecting to a jboss server to save and retrieve database data from mysql.

            do i put the report in the directories like you did as well as all the crystal jars file? and when my java application runs, (it's an applet actually) i just click "view report" for eg, and it will connect to jboss and jboss will noe wat i am requesting? i dun need to specify any paths rite? coz the report is already in the ../view dir?

            i got lotsa questions on this.. quite a headache actually coz i am new to jboss... thanx in advance..

            =)
            chris

            • 3. Re: Crystal Reports configuration
              suzyrizzo Newbie

              Sorry, but I really don't know much about Crystal. A co-worker did all the Crystal work for us, and I was helping him migrate his
              reports from straight Tomcat to JBoss.

              Maybe someone else on the forums might have some ideas?

              Sue.

              • 4. Re: Crystal Reports configuration
                Weixin Wang Newbie

                Hi suzyrizzo

                Could you give me the source code of JPEReportSourceFactory.java?

                I think that it should be something wrong there. JPEReportSourceFactory is responsible for generating a absolute path.

                the root path in Jboss for my application is the place where you start it.(%JBOSS_HOME%/bin/)

                Hope this can help you.

                • 5. Re: Crystal Reports configuration
                  Shahar Maoz Newbie

                  Hi,

                  I am using jboss with crystal reports.
                  I am trying to configure the report to work with JNDI through JBoss.
                  Any help would be greatly appreciated.

                  Thanks,
                  S.

                  • 6. Re: Crystal Reports configuration
                    suzyrizzo Newbie

                    I'm not sure where you are in your configuration, but here's a tricky naming convention that finally allowed my
                    crystal reports to work with JNDI.

                    The JNDI datasource that I've been using for some time with my web app is called cdhp. It shouldn't matter,
                    but it happens to be an MS SQL Server database. Just for reference, here's the entry in mssql-ds.xml:

                    <datasources>
                     <local-tx-datasource>
                     <jndi-name>cdhp</jndi-name>
                     <connection-url>
                     jdbc:microsoft:sqlserver://myServer:1433;DatabaseName=myDatabase;SelectMethod=Cursor
                     </connection-url>
                     <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
                     <user-name>myUser</user-name>
                     <password>myPassword</password>
                     </local-tx-datasource>
                    </datasources>

                    To match this JNDI datasource, I set up an ODBC datasource named java:/cdhp . This is the datasource I use
                    in Crystal Designer to create the reports.

                    I still don't know exactly why this worked, but through trial & error, I finally stumbled upon it. From reading the
                    Crystal docs, it seemed like both the jndi name & ODBC name should be exactly the same. But (as you probably
                    found out) that just didn't work for me.

                    Hope this helps.
                    Sue.

                    • 7. Re: Crystal Reports configuration
                      Shahar Maoz Newbie

                      Thanks very much for your post.

                      I am still not sure what should I have in my CRDB_javaserver.ini under the JDBC section, what do I need to enter in the connection dialog in the designer (under JNDI provider URL etc.), and how can I set JNDI parameters for the viewer from JSP code.

                      Thanks in advance.
                      S.

                      • 8. Re: Crystal Reports configuration
                        suzyrizzo Newbie

                        Hmmm. Looks like I did things an old way - using ODBC instead of JDBC in the Crystal Designer.

                        I'm afraid I've never tried using a JDBC connection in Crystal Designer. I did a quick search on crystal's site
                        just to see a little about what you were talking about. Seemed like there was a pretty recent white paper
                        out there that might help:

                        http://support.businessobjects.com/communityCS/TechnicalPapers/cr10_configuring_JDBC_JNDI.pdf

                        It's probably something you've already looked at, but since I don't have any experience with Crystal & JDBC,
                        I thought I'd mention it before I punt.

                        Sue.