Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Problems getting started with ReportCaster API

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Problems getting started with ReportCaster API
 Login/Join
 
Member
posted
Hello all, I'm trying to use the ReportCaster API to create some customized report scheduling in WebFOCUS. I have some Java code here most I pulled from the documentation

/**
* @(#)ReportCaster.java
*
* ReportCaster application
*
* @author
* @version 1.00 2009/7/1
*/
import ibi.broker.*;
import ibi.broker.api.data.schedule.*;
import ibi.broker.api.cci.*;
//import java.util;
import ibi.broker.api.CasterManagedConnectionFactory;
import java.util.ResourceBundle;
import ibi.broker.api.*;
import javax.resource.*;
import javax.resource.cci.ConnectionSpec;
import javax.resource.ResourceException;
import java.util.ResourceBundle;
import java.io.*;

import ibi.org.xml.sax.helpers.*;
public class ReportCaster {

public static void main(String[] args)
{
String scheduleDescription = "testst";//args[0];
String fexFileName = "MK_Test";//args[1];
String execId = "myusername";//args[2];
String execPassword = "hjg";//args[3];
String server = "webfocus-server";
String port_num = "80";

CasterManagedConnectionFactory managedConnectionFactory = new CasterManagedConnectionFactory();
managedConnectionFactory.setServerName(server);//the name of the server running the distribution server
managedConnectionFactory.setPortNumber(port_num);//the port the distribution server is listening

try
{
CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory();

ConnectionSpec credential = new PasswordCredential(execId,execPassword.toCharArray());

CasterConnection aa = (CasterConnection)connectionFactory.getConnection(credential);
System.out.println("Hello");
throw new ResourceException();
/*

ConnectionSpec credential = new PasswordCredential(execId, execPassword.toCharArray());
//This can be any of the credential objects. It is assumed here the user String has been assigned earlier
// and that password, also assigned earlier, is a String that needs to be converted to a character Array.


CasterConnection connectionObject = ((CasterConnection)connectionFactory.getConnection(credential));

ScheduleManager manager = connectionObject.getScheduleManager();


// Create ScheduleManager
//ScheduleManager manager = Util.createCasterConnection().getScheduleManager();
//ScheduleManager manager;

//create object schedule with default values from config file
Schedule schedule = manager.createScheduleInstanceDefault();

//set description
schedule.setDescription(scheduleDescription);

//set distribution to Library
Distribution distribution = new StorageLibrary();
schedule.setDistribution(distribution);

//create task
TaskWFServerProcedure task = new TaskWFServerProcedure();
task.setProcedureName(fexFileName);
task.setExecId(execId);
task.setExecPassword(execPassword);
task.setSendFormat(TaskWFServerProcedure.PDF);
schedule.setTaskList(new Task[]{task});
//schedule.setCompressedReport(true);
//subscribe schedule
manager.addSchedule(schedule);*/
}
catch (ResourceException ex)
{
System.out.println(ex);
}

//This portion of the code accepts four arguments

}
}


but on the line: "
CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory();"

I keep getting the following error:

javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. invalid stream header

I can't figure this out at all, anyone ever seen this?

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Virtuoso
posted Hide Post
I can get you part of the way there. Use the listening port of the RC server (typically 8200). I pulled out some old code to test, but I still cannot get a proper connection to initialize. I will try to look into this tomorrow.

This message has been edited. Last edited by: dhagen,


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Guru
posted Hide Post
Hi,

Are you able to schedule a report and run directly using reportcaster and the same user and password that you are using in the java code.
We working doing exactly the samething as you and i can tell that we run into these issue many times.
I would check this first.

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
Member
posted Hide Post
Hi, yes, I can access RC directly and use the same user id and password and run the schedules ok, just keep getting that "invalid stream header" error when trying to connect via Java. Majid jedddi - were you able to get around it, when you say you've run into the issue many times?

dhagen - I did try using a different port and I just get a "connection refused" message.

Is there perhaps some setting for access that needs to be configured on RC server? I would think that whatever mechanism connecting to RC directly uses would be the same through custom Java code? In any event, I unfortunately don't have direct access to manipulate the RC server, as it is managed by a different group that keeps a pretty tight lid around it. Thanks for any insights you can provide.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Guru
posted Hide Post
Hi Mike,

are the IBI API jar files in the class path or seen by the web server running your java programs?

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
Member
posted Hide Post
Hi - yea, I have all the IBI API jar files that have referenced classes in my class path. Just to clarify, the error I'm getting is at run-time and not compile time.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Member
posted Hide Post
Also, I'm trying to actual use the API from a stand-along Java app, and not through JSP pages. Is this possible?


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Virtuoso
posted Hide Post
Yes ... re-read my earlier post. You're source code works fine so long as you use the port of the report caster server!

If you are getting an error message still, then you may not have all of the required JARs on your classpath. IF you are still getting an error message, than post the complete message along with your classpath.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Hmmm, here's what I have in my class path variable:

c:\j2sdk1.4.2_19\*.jar;d:\ibi\devstudio76\webapps\webfocus76\web-inf\lib\*.jar;c:\java\reportcaster.jar;c:\ibi;c:\java;D:\Documents and Settings\moabrin\My Documents\JCreator Pro\MyProjects\ReportCaster\classes;D:\documents and settings\moabrin\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\jar\*.jar;d:\ibi\DevStudio76\Webapps\webfocus76\WEB-INF\lib\connector-api.jar

Wouldn't I be getting compile error if I was missing a path to a referenced class? This error is occurring at run-time.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Virtuoso
posted Hide Post
No, if the class is abstracted by the directly invoked classes, than they do not have to be present to compile.

My classpath (all in webapps/webfocus76/WEB-INF/lib):
connector-api.jar
ibi_xerces_2_7_1.jar
ibi_xml_apis_1_3.jar
intl.jar
jlink.jar
nls.jar
reportcaster.jar
webfocus_caster.jar

I do not have any JDBC drivers in this path since my test box uses JDBC-ODBC bridge.

You still did not post the entire exception message (?).

Any chance you could upgrade from Java 1.4 to either 5 or 6 (preferably).


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Looks like I have all those in my class path, from the d:\ibi\devstudio76\webapps\webfocus76\web-inf\lib\*.jar reference. The entire error message is:

javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. invalid stream header

This is occurring on the line:

CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory();

I'll see if I can upgrade to 1.6 in the meantime.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Virtuoso
posted Hide Post
Did you change your server name and port number to the correct name and number of the reportcaster server?


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Yea, I'm certain the RC server name is correct. I even tried its IP address. Port number is the only one I'm uncertain on, though I believe it's 80, as that is the one that is used when accessing RC directly over the Web. With port 80, I get the error:

javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. invalid stream header

Any other port I get, "javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. Connection refused: connect"

(Including port 8200).


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Guru
posted Hide Post
Hi Mike,

Can you please do me a favour?
Please ask you administrator to go to the server running reportcaster and ask him to do the following:

From windows : launch add/remove programs
then add windows component
and then add the print services for unix.
Once that is done re-start the server and re-try.

I am curious to see what will happen.
Regards


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
Member
posted Hide Post
ok, one thing I found, I don't have the webfocus_caster.jar. Is that supposed to be a part of the standard WebFOCUS install? Unfortunately, I can't request the server rebooted. It's a completely separate group that supports several users across our company and so wouldn't accommodate me in that fashion.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Member
posted Hide Post
Is there somewhere I can download that webfocus_caster.jar file from?


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Guru
posted Hide Post
Hi dhagen ,

If you have these services installed. Would it be possible to stop them and see if that code is still working.
If you are getting the same error than Mike in this case that would be the reason.

Is that possible?

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
Virtuoso
posted Hide Post
Mike: webfocus_caster.jar is not a required jar. I removed it and tested.

Majid: I'm not sure why, but I did as you asked. With the RC Service stopped, the process fails with an "Unable to communicate" error. If however, I set the connection port to 80 (IIS), then it will fail (obviously) with the same error as reported by Mike (header stream).


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Member
posted Hide Post
Hmmm, interesting, I came across this link: http://solution.ibi.com:8080/43242566.html which indicates i need the webfocus_caster.jar. I'm at a loss for ideas here.


WebFOCUS 7.6.1
Windows XP
Excel, HTML, and PDF
 
Posts: 10 | Registered: July 14, 2009Report This Post
Guru
posted Hide Post
Hi Dhagen

Sorry there is a missunderstanding.
There is a windows service running on that server called:TCP/IP Print Server.

Just stop it run the java code and see if that is still working.

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by Mike Bank:
Yea, I'm certain the RC server name is correct. I even tried its IP address. Port number is the only one I'm uncertain on, though I believe it's 80, as that is the one that is used when accessing RC directly over the Web. With port 80, I get the error:

javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. invalid stream header

Any other port I get, "javax.resource.ResourceException: Configuration and Initialization Error: Received an IOException. Connection refused: connect"

(Including port 8200).


Its most likely not port 80. Port 80 is an HTTP port and it would be extremely unlikely to have your Distribution Server running on the same port as HTTP.

The proper port to use here can be found in:
rcaster76\WEB-INF\web.xml

As the value of AGENT_PORT. This same number is also in the ReportCaster configuration and in \ReportCaster76\bin\classpath.bat under "DSPORT".

Once you have this, go to your commmand prompt and type in the following with RCHOST being your hostname and RCPORT being the port you're trying to use:


telnet RCHOST RCPORT


If ReportCaster is listening on that port and there is not a firewall, etc, blocking access, you will see something like this:


¼φ


If you receive the message:
"Could not open connection to the host, on port RCPORT: Connect failed"

or any other message where it does not connect then you have the port wrong, or a firewall is blocking access.

Thanks,
Doug Logan


WF 71.x, 76.x, 7701, 8.0 Beta OS: Linux, Win2k3, Win2k, Win2k8, WinXP


 
Posts: 203 | Registered: November 19, 2007Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Majid Jeddi:
There is a windows service running on that server called:TCP/IP Print Server.
Just stop it run the java code and see if that is still working.


This service does not exist in my environment.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Guru
posted Hide Post
Hi,

Even if it is not recommended and to be fixed about this issue i would first:
1/Disable the firewall on the network connection
2/ also consider disable the Antivirus if there is one.

Then retry.

Regards.


WebFocus 7.6.5
AND WebLogic server as web server
sql2005 as database server
 
Posts: 273 | Location: Europe | Registered: May 31, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Problems getting started with ReportCaster API

Copyright © 1996-2020 Information Builders