JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   On Github   Forums 
November 18, 2019, 07:57:27 AM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: Call the JPPF resource adapter in main class  (Read 2047 times)

ygzx_114

  • Guest
Call the JPPF resource adapter in main class
« on: February 24, 2012, 03:08:22 AM »

Hello  Laurent,
     I have built the JPPF resource adapter successful with jboss6.
      We have a project which use Tomcat, So we hope call the JPPF resource adapter in tomcat.
      So I try this in a main class first as the following code:
 
     public static void main(String []args)
     {
         try
        {
   Properties p = new Properties();
   p.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
             p.setProperty("java.naming.provider.url", "jnp://localhost:1099");
   Context context = new InitialContext(p);
   String jndiName = "java:eis/JPPFConnectionFactory";
   Object o = context.lookup(jndiName);
   System.out.println(o);
   context.close();
          }
         catch (Exception e)
        {
   System.out.println(e);
        }     
     }

       I deployed the JPPF resource adapter and start the jboss, there is a Exception while running this main class:
                 (javax.naming.NameNotFoundException: eis not bound )


    sincerely
    DoubleT     
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2256
    • JPPF Web site
Re: Call the JPPF resource adapter in main class
« Reply #1 on: February 24, 2012, 05:45:05 AM »

Hi DoubleT,

My understanding is that you are trying, from a standalone appplication or Tomcat instance, to invoke a remote JPPF reource adaptor deployed in JBoss, is this correct?
If yes, then I don't see any way this can work, this is definitely not what the J2EE connector was intended for.
What you would need to do is to embed a straight (J2SE) JPPF client in your application.
For instance, for a Tomcat web application packaged as a war you would need the following:

- in YourWebApp.war/WEB-INF/lib:
jppf-client.jar
jppf-common-node.jar
jppf-common.jar
slf4j-api-1.6.1.jar
slf4j-jdk14-1.6.1.jar
jmxremote_optional.jar

- and also add a jppf.properties configuration file in YourWebApp.war/WEB-INF/classes

Another approach would be to define in JBoss a web service front-end for the JPPF resource adapter, and invoke this web service from your standalone or Tomcat application.

I hope this helps.

SIncerely,
-Laurent
Logged

ygzx_114

  • Guest
Re: Call the JPPF resource adapter in main class
« Reply #2 on: February 24, 2012, 08:54:36 AM »

Hello  Laurent,
    Thanks for your reply, what I want to do is just embed a straight (J2SE) JPPF client in my application.
    and your reply helps me a lot. Thanks again. ;)

 sincerely
  DoubleT 
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads