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 » java class not found exception

Post new topic  Reply to topic Goto page 1, 2  Next
 java class not found exception « View previous topic :: View next topic » 
Author Message
sunny7413
PostPosted: Wed Oct 02, 2013 11:14 pm    Post subject: java class not found exception Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

hi
i am trying to invoke the java method from esql when iam trying execute the code it giving the java class not found exception. i tried resolving the issue by checking the previous forum posts but unable to resolve the issue.Can anyone help me in resolving this thanks.u can find my code in next post.
Back to top
View user's profile Send private message
sunny7413
PostPosted: Wed Oct 02, 2013 11:25 pm    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

Esql Procedure
Code:

CREATE PROCEDURE InvokeEmailAttachmentJava(IN host CHARACTER,IN port CHARACTER,IN username CHARACTER,IN password CHARACTER,IN directory CHARACTER,INOUT OM REFERENCE)
RETURNS CHARACTER
LANGUAGE JAVA
EXTERNAL NAME "sun.com.EmailAttachmentReceiver.InvokeEmailAttachmentJava";

java method
Code:

 public static void InvokeEmailAttachmentJava(String host,String port,String userName,String password,String saveDirectory,MbElement[] response) throws Exception {

Esql Code
Code:

DECLARE OM REFERENCE TO OutputRoot;
CREATE LASTCHILD OF OM DOMAIN('XMLNSC');      
MOVE OM TO OM.XMLNSC;
CREATE FIELD OM.Response;

DECLARE host,port,username,password,directory CHAR;
SET host = COALESCE(EV.MRM.Email_Credentials.Email_Host,'');
SET port = COALESCE(EV.MRM.Email_Credentials.Email_Port, '');
SET username = COALESCE(EV.MRM.Email_Credentials.UserName, '');
SET password = COALESCE(EV.MRM.Email_Credentials.Pwd, '');
SET directory = COALESCE(EV.MRM.Email_Credentials.directory, '');
SET EV.response =src.InvokeEmailAttachmentJava(host,port,username,password,directory,OM);
Back to top
View user's profile Send private message
Simbu
PostPosted: Thu Oct 03, 2013 12:38 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

there is a mismatch between the ESQL procedure and java method with return-type
Back to top
View user's profile Send private message
vishnurajnr
PostPosted: Thu Oct 03, 2013 1:21 am    Post subject: Reply with quote

Centurion

Joined: 08 Aug 2011
Posts: 134
Location: Trivandrum

Hope you have done the steps mentioned in InfoCenter to invoke JAVA from ESQL.

http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak04960_.htm
_________________
-------
A man is great by deeds, not by birth...!
Back to top
View user's profile Send private message Visit poster's website
sunny7413
PostPosted: Thu Oct 03, 2013 2:54 am    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

i have already tried removing RETURN CHARACHTER CLAUSE FROM ESQL.
it is giving the same exception
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Oct 03, 2013 3:00 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

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

_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sunny7413
PostPosted: Thu Oct 03, 2013 3:16 am    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

i removed the throws statement but it didnt work
Back to top
View user's profile Send private message
vishnurajnr
PostPosted: Thu Oct 03, 2013 3:31 am    Post subject: Reply with quote

Centurion

Joined: 08 Aug 2011
Posts: 134
Location: Trivandrum

Quote:
Deploying Java classes
You can deploy your Java classes to a broker within a Java Archive (JAR) file, by using one of the following two methods:
1. Add the JAR file to the broker archive (BAR) file

The most efficient and flexible method of deploying to the broker is to add your JAR file to the BAR file. You can do this manually or automatically using the WebSphere Message Broker Toolkit.
If the WebSphere Message Broker Toolkit finds the correct Java class inside a referenced Java project open in the workspace, it automatically compiles the Java class into a JAR file and adds it to the BAR file. This procedure is the same procedure that you follow to deploy a JavaCompute node inside a JAR, as described in User-defined node class loading.
When you deploy a JAR file from the WebSphere Message Broker Toolkit, the flow that has been redeployed reloads the JAR file contained in the BAR file.
The files are also reloaded if the message flow that references a Java class is stopped and restarted. Ensure that you stop and restart (or redeploy) all flows that reference the JAR file that you want to update. This action avoids the problem of some flows running with the old version of the JAR file and other flows running with the new version.
The WebSphere Message Broker Toolkit deploys only JAR files; it does not deploy stand-alone Java class files.

2. Store the JAR file in either of the following locations:
a.The workpath/shared-classes/ folder on the machine running the broker
b.The CLASSPATH environment variable on the computer running the broker
You must complete this action manually; you cannot use the WebSphere Message Broker Toolkit.
In this method, redeploying the message flow does not reload the referenced Java classes; neither does stopping and restarting the message flow. The only way to reload the classes in this case is to stop and restart the broker itself.
To enable the broker to find a Java class, ensure that it is in one of the preceding locations. If the broker cannot find the specified class, it generates an exception.

Although you have the choices shown previously when you deploy the JAR file, by using the WebSphere Message Broker Toolkit to deploy the BAR file provides the greatest flexibility when redeploying the JAR file.

_________________
-------
A man is great by deeds, not by birth...!
Back to top
View user's profile Send private message Visit poster's website
lancelotlinc
PostPosted: Thu Oct 03, 2013 3:39 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

sunny7413 wrote:
i removed the throws statement but it didnt work


You need to clean your workspace and "Build for mqsipackagebar" before your Java changes will be reflected.

This task is basic simple stuff. You should be able to figure this out on your own. Posting here "it still does not work" is not helpful to you or us.

You may not be cut out to be a developer. Go back to System Admin if you cannot perform basic development tasks or troubleshooting tasks.

If you still insist on posting here, include relevant information in your post, such as a User Trace.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sunny7413
PostPosted: Thu Oct 03, 2013 3:41 am    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

i have tried keeping the jar in both shared classes and bar file but result will be the same.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Oct 03, 2013 3:42 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

sunny7413 wrote:
i have tried keeping the jar in both shared classes and bar file but result will be the same.


Again, you don't seem to have a knack for software development. Choose one way or the other but not both. Which one is getting loaded ? As a developer you should know this.

Your class specification is also incorrect.

Code:
"sun.com.EmailAttachmentReceiver.InvokeEmailAttachmentJava";


I'm not going to tell you why it is incorrect as its a basic simple thing. As a developer you should figure this out for yourself.

For other forum readers: let her fish for her own dinner.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sunny7413
PostPosted: Thu Oct 03, 2013 3:56 am    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

i mean to say that i have done the both things one after other(keeping jar in shared classes and including the jar in bar).we have cleaned the project many times and here is the trace.

Code:

2013-10-03 12:31:29.119956     7008   UserTrace   BIP2632I: Message received and propagated to 'out' terminal of MQ input node 'src.sipot_email.MQ Input'.
2013-10-03 12:31:29.125963     7008   Error       BIP2628E: Exception condition detected on input node 'src.sipot_email.MQ Input'.
                                       The input node 'src.sipot_email.MQ Input' detected an error whilst processing a message.  The message flow has been rolled-back and, if the message was being processed in a unit of work, it will remain on the input queue to be processed again.  Following messages will indicate the cause of this exception.
                                       Check the error messages which follow to determine why the exception was generated, and take action as described by those messages.
2013-10-03 12:31:29.126127     7008   RecoverableException  BIP2230E: Error detected whilst processing a message in node 'src.sipot_email.Compute'.
                                       The message broker detected an error whilst processing a message in node 'src.sipot_email.Compute'. An exception has been thrown to cut short the processing of the message.
                                       See the following messages for details of the error.
2013-10-03 12:31:29.126144     7008   RecoverableException  BIP3202E: ('src.InvokeEmailAttachmentJava', '1.12') : An error occurred when trying to resolve the Java class or method ''sipot.com.EmailAttachmentReceiver.InvokeEmailAttachmentJava'' which is referred to by the routine ''InvokeEmailAttachmentJava''.
                                       Further messages are generated that explain the error in more detail.
                                       Correct the syntax of your Java expression in node ''src.InvokeEmailAttachmentJava'', around line and column ''1.12'', then redeploy the message flow.
2013-10-03 12:31:29.126165     7008   RecoverableException  BIP2943E: The Java Method ''sipot.com.EmailAttachmentReceiver.InvokeEmailAttachmentJava'' could not be found as its containing class could not be found in the broker classpath
                                       The specified Java Method ''sipot.com.EmailAttachmentReceiver.InvokeEmailAttachmentJava'' belongs to a class that could not be found in the broker classpath. Ensure that the fully qualified name of the method is correct and that its containing class or jar file is in the broker classpath.
                                       Examine and correct the SQL program.
2013-10-03 12:31:30.126468     7008   Error       BIP2648E: Message backed out to a queue; node 'src.sipot_email.MQ Input'.
                                       Node 'src.sipot_email.MQ Input' has received a message which has previously been backed out one or more times because of a processing error in the main path of the message flow. The failure terminal is not attached, so the message broker is putting the message directly to the requeue or dead letter backout queue associated with this node. The MQMD 'backoutCount' of the message now equals the 'backoutThreshold' defined for the WebSphere MQ input queue.
                                       Examine previous messages and the message flow to determine why the message is being backed out.  Correct this situation if possible.  Perform any local error recovery processing required.
2013-10-03 12:31:30.126905     7008   UserTrace   BIP2638I: The MQ output node 'src.sipot_email.MQ Input' attempted to write a message to queue ''SYSTEM.DEAD.LETTER.QUEUE'' connected to queue manager ''MB7QMGR''. The MQCC was '0' and the MQRC was '0'.
2013-10-03 12:31:30.126937     7008   UserTrace   BIP2615I: The WebSphere MQ input node 'src.sipot_email.MQ Input' has backed out the message to the backout requeue or the dead letter queue.
                                       Message backout processing has been invoked, and the message has either been backed out by being written to the backout requeue or dead letter queue, as determined by the WebSphere MQ queue manager and queue configuration.
                                       No user action required.

Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Oct 03, 2013 3:59 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Are you just going to ignore the post about not putting the Jar in two places or that your class specification is not correct ?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sunny7413
PostPosted: Thu Oct 03, 2013 4:08 am    Post subject: Reply with quote

Apprentice

Joined: 02 Oct 2013
Posts: 29

1st i kept the jar file in bar and tested but no luck and we removed the jar from bar and kept it in the shared classes and restarted the broker but no luck.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Thu Oct 03, 2013 4:10 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

sunny7413 wrote:
1st i kept the jar file in bar and tested but no luck and we removed the jar from bar and kept it in the shared classes and restarted the broker but no luck.


Luck has nothing to do with it. This is a proven part of the product. It works. When properly implemented by a skilled and experienced developer.

Examples of this working product feature are included in the documentation. Follow the documentation precisely and you will achieve your goal.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » java class not found exception
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.