Announcement

Collapse
No announcement yet.

How to make channel to run jar files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    jar problem

    Hi there,

    As for your null constructor problem, hopefully you solved it, but if not you should just get rid of it. I'm 99% sure classes don't always have to have constructors.

    As to your channel problem, in my channel which references a java program I used the class name as well in the object declaration. Try this:

    var object = new Packages.qr.qr();
    object.execute;


    Hope that works. Also just so we are clear, does your program run as expected if you run it in eclipse? Thanks for the info.

    -Mireth

    Comment


    • #17
      Thanks Mireth

      Hi Thanks for the help


      But I have made that expirience on mrth channel.


      var object = new Packages.qr.qr();
      object.execute;



      Althout and in the response of your last line .

      On eclipse the program is runnable and executing like is programmed, althout it does not work on mirth.

      Errors


      [2010-08-18 13:11:03,890] FATAL (org.mule.impl.DefaultComponentExceptionStrategy:8 4): The error is: null
      java.lang.NullPointerException
      at com.webreach.mirth.connectors.js.JavaScriptMessage Receiver.poll(JavaScriptMessageReceiver.java:88)
      at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:90)
      at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
      at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
      at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
      at java.lang.Thread.run(Unknown Source)

      [2010-08-18 13:09:08,875] FATAL (org.mule.impl.DefaultComponentExceptionStrategy:8 3): The Default Component Exception Strategy has been invoked but there is no current event on the context


      [2010-08-18 13:11:23,906] ERROR (com.webreach.mirth.connectors.js.JavaScriptMessag eReceiver:152): org.mozilla.javascript.EcmaError: TypeError: [JavaPackage testefinal] is not a function, it is object. (cd8d54a5-375b-4f02-9951-88025c3fd4d2#3)
      Edit/Delete Message


      Could it be something wrong with configuration on channel ?

      Comment


      • #18
        Brad

        Hi there .


        What is intented to do with mirth channel and the jar file is to do a query and retrive with dcm4chee tool.

        dcmqr -L DCM4CHEE:11113 [email protected]:104 -cmove DCM4CHEE -qPatientID=123456 -cstoredest c:\test

        So this is the purpose for the batch file that not run.

        Any help Brad ?

        Comment


        • #19
          The only thing I can think of you haven't posted a screen of is the placement of your jar file. If you are getting a null pointer exception maybe it can't find your jar file. Are you sure you have it in the correct folder? The "Mirth/lib/custom" one?

          Also, if you haven't already done it, try getting rid of your null constructor. Maybe the program runs through eclipse which clearly notices the null constructor, but when you call the method through Mirth it hangs. Let me know how it goes.
          Last edited by Mireth; 08-20-2010, 07:47 AM.

          Comment


          • #20
            the null constructor isn't an issue.

            ANYWAYS, this process works for me. Your situation is much more complicated, but try this simple hello world jar to get started.

            1. create new java project in eclipse
            2. use this code:
            Code:
            public class qr {
            
            	public qr(){
            		
            	}
            	
            	public String execute(){
            		return "works";
            	}
            }
            3. export to jar in eclipse
            4. take jar and put it in the custom-lib folder in mirth
            5. restart Mirth Service
            6. Create a simple Channel
            7. XML input, XML output, javascript reader, channel writer(I would attach my channel but it's in Mirth 2.0)
            8. use this code in the javascript reader:

            Code:
            var object = new Packages.qr();
            logger.error(object.execute());
            
            return "<xml><a>a</a></xml>";
            9. Deploy channel

            Result: A log out of "works";

            This works. Take this example as a starting point and modify it for your own needs. If you are still stuck consider purchasing Mirth support with channel support, they will walk you through every step.
            -Brad

            Comment


            • #21
              Mireth

              Hi there,


              Sorry for the delay on my awnser,

              But I've attachedwith the place of the files on mirth.

              The null constructor is not appearing at the moment after start the mirth channel I've always got the error.

              Thanks in advanced.
              Attached Files

              Comment


              • #22
                Thanks once again Brad

                Hi Brad,


                I've got a problem running the code you posted on eclipse.

                I attached a screenshot to see it.

                I've been googling around since then and I hear that could be missing the function main .

                for example:

                public static void main(String[] args)

                {

                }




                Is it possible ?


                I could test in another development software.

                What you sugest ?
                Attached Files

                Comment


                • #23
                  The code I posted was not meant to be run in eclipse, but it is callable from a jar. But yes, if you want to run it you will need a main method like the one you posted. This is not necessary for running the jar.

                  Comment


                  • #24
                    One more thing Bradd

                    Hi there,


                    What software are you using to develop.

                    I would like to replicate your enviroment to mine just to check this situation.

                    Is it possible ?

                    Thanks

                    Comment


                    • #25
                      Originally posted by Dr. L View Post
                      Hi there,


                      What software are you using to develop.

                      I would like to replicate your enviroment to mine just to check this situation.

                      Is it possible ?

                      Thanks
                      I'm pretty sure they all use Eclipse to develop. I was on the last developer call and that is what they told me. You can download the normal "Java Developer" edition and have their environment. Hope that helps.
                      Jimmy
                      - Denver, Colorado

                      Comment


                      • #26
                        metropath

                        Hi there,

                        I would like to know where I'm a missing.

                        Comment


                        • #27
                          if you *really* want your program to run in eclipse(which isn't necessary) all you have to do is add a main method. Below is the modified source code:

                          Code:
                          public class qr {
                          
                              public qr(){
                                  
                              }
                              
                              public String execute(){
                                  return "works";
                              }
                              
                              public static void main (String[] args){
                                  qr q = new qr();
                                  System.out.println(q.execute());
                              }
                          }

                          Comment


                          • #28
                            Bradd

                            Hi bradd

                            I've tried the steps has indicated in the second page of these posts and the result was:

                            ERROR-301: Transformer conversion error
                            ERROR MESSAGE: Error adapting message
                            org.xml.sax.SAXParseException: Content is not allowed in prolog.
                            at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
                            at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
                            at com.webreach.mirth.server.mule.adaptors.XMLAdaptor .populateMessage(XMLAdaptor.java:28)
                            at com.webreach.mirth.server.mule.adaptors.Adaptor.ge tMessage(Adaptor.java:52)
                            at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.transform(JavaScriptTransformer.ja va:316)
                            at org.mule.transformers.AbstractEventAwareTransforme r.doTransform(AbstractEventAwareTransformer.java:4 8)
                            at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
                            at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                            at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:200)
                            at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
                            at org.mule.routing.inbound.SelectiveConsumer.isMatch (SelectiveConsumer.java:61)
                            at org.mule.routing.inbound.InboundMessageRouter.rout e(InboundMessageRouter.java:83)
                            at org.mule.providers.AbstractMessageReceiver$Default InternalMessageListener.onMessage(AbstractMessageR eceiver.java:493)
                            at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:272)
                            at org.mule.providers.AbstractMessageReceiver.routeMe ssage(AbstractMessageReceiver.java:231)
                            at com.webreach.mirth.connectors.js.JavaScriptMessage Receiver.processMessage(JavaScriptMessageReceiver. java:109)
                            at com.webreach.mirth.connectors.js.JavaScriptMessage Receiver.poll(JavaScriptMessageReceiver.java:90)
                            at org.mule.providers.PollingMessageReceiver.run(Poll ingMessageReceiver.java:90)
                            at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
                            at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
                            at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
                            at java.lang.Thread.run(Unknown Source)


                            Althoug I have got the word "works" but with error is that what you want me to test ?

                            Is this normal or not ?

                            I have attached one screenshot of error when channel are running and the detailed error on the beginning.


                            Thanks in advanced.


                            Version Mirth Connect Administrator 1.8.2.4472
                            Attached Files

                            Comment


                            • #29
                              ah, look at that, it works. It's throwing that error because you probably aren't passing a message after using the jar. Anyways use this example and build on it and you will be fine.

                              Comment


                              • #30
                                hi,

                                Here is my Error :

                                ERROR-300: Transformer error
                                ERROR MESSAGE: Error evaluating transformer
                                com.webreach.mirth.server.MirthJavascriptTransform erException:
                                CHANNEL: RemoteNotification-RX
                                CONNECTOR: Testing
                                SCRIPT SOURCE:
                                SOURCE CODE:
                                9:
                                10: var idrecord = msg['cud_objets_id'].toString();
                                11: var numobj = msg['cud_objets_numobj'].toString();
                                12: var cud = msg['cud_objets_cud'].toString();
                                13: var trt = msg['cud_objets_fgtrt'].toString();
                                14: var MyCls = new Packages.testmirthws.Main();
                                15: MyCls.DoTest(idrecord,numobj);
                                16: var t = MyCls.getT();
                                17:
                                18: }
                                LINE NUMBER: 14
                                DETAILS: TypeError: [JavaPackage testmirthws.Main] is not a function, it is object.


                                I made a java class with Netbeans IDE 6.5.1 using this post.

                                Here is java code :

                                package testmirthws;

                                public class Main {

                                private static TestingWS t = new TestingWS();

                                public static void main(String[] args) {
                                System.out.println("HELLO");
                                }

                                public static TestingWS getT() {
                                return t;
                                }

                                public static void setT(TestingWS aT) {
                                t = aT;
                                }

                                public void DoTest(String a, String b) {
                                System.out.println("Welcome to 'DoTest'");
                                t.setCode(a);
                                t.setCodeType(b);
                                }

                                }

                                Any idea ?
                                I need some help.
                                Thanx

                                Comment

                                Working...
                                X