Hi
My name is Bach Ong, i'm currently perform re-configuring Crystal reports 2008 to connect via
Java bean to Jboss server, this uses look up service on JBoss server. The connection is using Connect
look up using the properties:
java.naming.provider.url=jnp://emgsydapp121:10499
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
for file CRConfig.xml i put as follows:
<JDBCURL></JDBCURL>
<JDBCClassName></JDBCClassName>
<JDBCUserName></JDBCUserName>
<JNDIURL>jnp://emgsydapp121:10499</JNDIURL>
<JNDIConnectionFactory>org.jnp.interfaces.NamingContextFactor
y</JNDIConnectionFactory>
<JNDIInitContext>/</JNDIInitContext>
<JNDIUserName></JNDIUserName>
Can you advise us if this step is correct, and is there any
documentation that can guide us to right direction.
for Java testing in Eclipse using remote call class it is working suing the following code:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
InitialContext ctx = new InitialContext(p);
Date asAtDate = CrystalUtils.convertToDate("2014-01-01", CrystalUtils.relativeToToday(0), false);
String asxCode = "BHP";
ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
InitialContext context = new InitialContext(p);
ClosingPricesReportService ejb = (ClosingPricesReportService) context.lookup(ClosingPricesReportService.REMOTE_JNDI);
ClosingPricesReport report = ejb.createMTMClosingPriceReport(criteria);
System.out.println(report.getClosingPrices()[0].getClosingPrice());
testval = report.getClosingPrices()[0].getClosingPrice().toString();
System.out.println(testval);
***
when i run the tes code the results as follow:
10:49:45,244 DEBUG [SecurityAssociation ] Using ThreadLocal: false
10:49:45,338 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] constructed
10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connecting
10:49:45,338 DEBUG [MicroSocketClientInvoker ] Creating semaphore with size 50
10:49:45,338 DEBUG [MicroRemoteClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] connected
10:49:45,369 DEBUG [ClientSocketWrapper ] reset timeout: 0
10:49:45,650 DEBUG [InvokerRegistry ] removed SocketClientInvoker[709446e4, socket://emgsydapp121:10473] from registry
10:49:45,650 DEBUG [MicroSocketClientInvoker ] SocketClientInvoker[709446e4, socket://emgsydapp121:10473] disconnecting ...
10:49:45,650 DEBUG [SocketWrapper ] ClientSocketWrapper[Socket[addr=/10.137.2.40,port=10473,localport=64150].2cba5bdb] closing
37.99000000000000198951966012828052043914794921875
37.99000000000000198951966012828052043914794921875
Can anyone assist me in convert the above settings to get access by Crystal reports.
My attemp current are below:
//********************************************************************************************************************************
public class CFDClosingPricesRpt extends CrystalReport {
//Constructor
public CFDClosingPricesRpt(){
super(ClosingPriceBean.INSTANCE);
}
/**
* Returns the ResultSet for this report to Crystal.
* @param asxCode
* @param asAtDateString
* @return
*/
public ResultSet getNewReport(String asxCode, String asAtDateString) {
try {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://emgsydapp121:10499");
//InitialContext ctx = new InitialContext(p);
clearCachedReportBeans();
Date asAtDate = CrystalUtils.convertToDate("2013-01-01", CrystalUtils.relativeToToday(0), false);
asxCode = "BHP";
ClosingPricesReportRequest criteria = new ClosingPricesReportRequest(asAtDate, asxCode);
//ClosingPricesReportService ejb = (ClosingPricesReportService) ctx.lookup(ClosingPricesReportService.REMOTE_JNDI);
ClosingPricesReportService ejb = (ClosingPricesReportService) ServiceLocator.getInstance().getService(ClosingPricesReportService.REMOTE_JNDI);
ClosingPricesReport report = ejb.createClosingPriceReport(criteria);
// assemble Crystal-friendly DTO
Collection closingPrices = Arrays.asList(report.getClosingPrices());
for (Iterator iter = closingPrices.iterator(); iter.hasNext();) {
MBLXClosingPrice cp = (MBLXClosingPrice) iter.next();
if (cp==null) continue;
addReportBean(new ClosingPriceBean( report.getSuppliedDate(),
cp.getClosingPrice(),
cp.getAsxCode()));
}
} catch (Throwable x) {
saveErrorMessage(x);
}
return getAsResultSet();
}
}
//********************************************************************************************************************************
Thanks
Bach Ong