ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Error trying to locate a Java Class /method - MB8.0.0.0.3

Post new topic  Reply to topic
 Error trying to locate a Java Class /method - MB8.0.0.0.3 « View previous topic :: View next topic » 
Author Message
abcnil
PostPosted: Fri Jun 06, 2014 8:09 am    Post subject: Error trying to locate a Java Class /method - MB8.0.0.0.3 Reply with quote

Apprentice

Joined: 29 Mar 2012
Posts: 36

MB8 with Fix pack3.

I am trying to use java routine from my Esql

Esql:

Calling Function:

Code:
SET outTimeChar = CAST(inputMsgRef.q1:ExecTimestamp AS CHARACTER);
      CALL setDateFormat(outTimeChar) INTO returnValue;


Declaring Function :
Code:

   CREATE FUNCTION setDateFormat( IN inDate CHARACTER) RETURNS CHARACTER
   LANGUAGE JAVA
   EXTERNAL NAME "com.test.GetDate.changeTimeZone";



Java class:
Code:
package com.test;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.TimeZone;

import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;

class GetDate {
   public static String changeTimeZone(String inDate) throws Exception {
      String outDate;
      DatatypeFactory factory = DatatypeFactory.newInstance();

      XMLGregorianCalendar xmlCal = factory.newXMLGregorianCalendar(inDate);

      Calendar cal = xmlCal.toGregorianCalendar();

      DateFormat korFormat = new SimpleDateFormat(
            "yyyy-MM-dd-HH.mm.ss.SSSSSS");

      // TimeZone cetTime = TimeZone.getTimeZone("CET");

      korFormat.setTimeZone(TimeZone.getTimeZone("EET"));

      outDate = korFormat.format(cal.getTime());
      ;
      return outDate;
   }
}




Here is the exception:


Quote:
ExceptionList
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\ImbDataFlowNode.cpp
Line:INTEGER:1154
Function:CHARACTER:ImbDataFlowNode::createExceptionList
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:cam_CardHandling_Response_Flow#FCMComposite_1_1
Label:CHARACTER:cam_CardHandling_Response_Flow.MQ Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Node throwing exception
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\ImbComputeNode.cpp
Line:INTEGER:497
Function:CHARACTER:ImbComputeNode::evaluate
Type:CHARACTER:ComIbmComputeNode
Name:CHARACTER:cam_CardHandling_Response_Flow#FCMComposite_1_3.cam_CardHandling_NewCardOrder_Response_SF#FCMComposite_1_3
Label:CHARACTER:cam_CardHandling_Response_Flow.Compute
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\ImbRdl\ImbRdlRoutine.cpp
Line:INTEGER:2111
Function:CHARACTER:SqlRoutine::resolveExternalJavaParameters
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:3202
Text:CHARACTER:An error occured whilst trying to locate a Java Class / method
Insert
Type:INTEGER:5
Text:CHARACTER:.NewCardOrder_Response_SubFlow_Compute.setDateFormat
Insert
Type:INTEGER:5
Text:CHARACTER:1.2
Insert
Type:INTEGER:5
Text:CHARACTER:com.test.GetDate.changeTimeZone
Insert
Type:INTEGER:5
Text:CHARACTER:setDateFormat
RecoverableException
File:CHARACTER:F:\build\slot1\S800_P\src\DataFlowEngine\ImbRdl\ImbRdlExternalJava.cpp
Line:INTEGER:1138
Function:CHARACTER:ESQL2JavaMethodResolver::decodeReturnStatus
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2927
Text:CHARACTER:The Java method has a throws clause
Insert
Type:INTEGER:5
Text:CHARACTER:com.test.GetDate.changeTimeZone



I have Application refering Lib
and Lib contains Esql and JavaProject with mentioned class.



Checked other post for similar issue/ checked documentation. All look fine to me..Not able to trace whats wrong...
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jun 06, 2014 9:16 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Quote:

Text:CHARACTER:The Java method has a throws clause
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jun 06, 2014 9:16 am    Post subject: Re: Error trying to locate a Java Class /method - MB8.0.0.0. Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Understand that me taking about Java is like a blind guy giving a lecture on Picasso and the abstract movement.

Having said that, this doesn't look good:

abcnil wrote:
Text:CHARACTER:The Java method has a throws clause


Which lines up with the documentation on the CREATE FUNCTION statement which says:

Quote:
In addition, the Java method is not allowed to have exception throws clause in its signature.


Which my seeing eye dog claims you have.

Also, why are you breaking out of ESQL to do this? Are you trying to fudge this problem?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jun 06, 2014 1:21 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Excellent thought of fixing the date display problem with Java.

However you have a few problems here... DateFormat and SimpleDateFormat are not thread safe... nor is Date... you should use ThreadLocal for those... or synchronize your method...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
abcnil
PostPosted: Sun Jun 08, 2014 8:59 pm    Post subject: Reply with quote

Apprentice

Joined: 29 Mar 2012
Posts: 36

Thanks All,

This solved the problem

Quote:
In addition, the Java method is not allowed to have exception throws clause in its signature.


Thanks Vitor for pointing this out

And yes, i am trying around to tackle the issue of ESQL Timestamp issue by using java function. because its problem with current MB version we are using. Management here is not ready to wait for next fix.
so need to have some workaround. Obviosly I am NOT happy with this approach
Back to top
View user's profile Send private message
abcnil
PostPosted: Sun Jun 08, 2014 9:01 pm    Post subject: Reply with quote

Apprentice

Joined: 29 Mar 2012
Posts: 36

fjb_saper wrote:
Excellent thought of fixing the date display problem with Java.

However you have a few problems here... DateFormat and SimpleDateFormat are not thread safe... nor is Date... you should use ThreadLocal for those... or synchronize your method...

Have fun


Thanks fjb_saper, I will improve it in my code
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Error trying to locate a Java Class /method - MB8.0.0.0.3
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.