Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Enterprise java bean help

Enterprise java bean help

Scheduled Pinned Locked Moved Java
javacomsysadmindockersecurity
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    crain1981
    wrote on last edited by
    #1

    I need to know if there is anyone that can help with this ejb's. I'm just trying to set up a simple timer. I want to set it up in intervals plus I need to know what all does the ejb needs. And its ejb3.0 and ejb is Enterprise Java Beans. The code is below: Client: -> did have something but wasn't working correctly. <pre>package ejb30.STClient; import ejb30.STBean.*; import javax.ejb.EJB; import javax.ejb.TimerService; import javax.naming.*; public class Client { }</pre> Remote: <pre>package ejb30.STBean; import javax.ejb.Remote; import javax.naming.NamingException; @Remote public interface STBeanRemote { public void Timer(); } </pre> Bean: <pre>package ejb30.STBean; import javax.annotation.Resource; import javax.ejb.Stateless; import javax.ejb.TimedObject; import javax.ejb.TimerService; import sun.misc.Timer; /** * Session Bean implementation class STBean */ @Stateless public class STBean implements STBeanRemote, TimedObject { @Resource private TimerService gog; /** * Default constructor. */ public void setSessionContext() { } public void Timer() { Timer ts = (Timer) gog.createTimer(0, 15000, null); } @Override public void ejbTimeout(javax.ejb.Timer timer) { // TODO Auto-generated method stub System.out.println("I'm working"); } } </pre> XML: <pre><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar\_3\_0-0.dtd"> <ejb-jar xmlns ="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://ww.w3.org/2001/XMLSchema-instance" metadata-complete="true" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/nx/javaee/ejb-jar\_3\_0.xsd"> <enterprise-beans> <session> <display-name>STBean</display-name> <ejb-name>STBean</ejb-name> <business-remote>ejb30.STBean.STBeanRemote</business-remote> <ejb-class>ejb30.STBean.STBean</ejb-class> <session-type>Stateless</session-type> <transaction>Container</transaction> <security-identity> <use-caller-identity /> &lt

    I 1 Reply Last reply
    0
    • C crain1981

      I need to know if there is anyone that can help with this ejb's. I'm just trying to set up a simple timer. I want to set it up in intervals plus I need to know what all does the ejb needs. And its ejb3.0 and ejb is Enterprise Java Beans. The code is below: Client: -> did have something but wasn't working correctly. <pre>package ejb30.STClient; import ejb30.STBean.*; import javax.ejb.EJB; import javax.ejb.TimerService; import javax.naming.*; public class Client { }</pre> Remote: <pre>package ejb30.STBean; import javax.ejb.Remote; import javax.naming.NamingException; @Remote public interface STBeanRemote { public void Timer(); } </pre> Bean: <pre>package ejb30.STBean; import javax.annotation.Resource; import javax.ejb.Stateless; import javax.ejb.TimedObject; import javax.ejb.TimerService; import sun.misc.Timer; /** * Session Bean implementation class STBean */ @Stateless public class STBean implements STBeanRemote, TimedObject { @Resource private TimerService gog; /** * Default constructor. */ public void setSessionContext() { } public void Timer() { Timer ts = (Timer) gog.createTimer(0, 15000, null); } @Override public void ejbTimeout(javax.ejb.Timer timer) { // TODO Auto-generated method stub System.out.println("I'm working"); } } </pre> XML: <pre><?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 EJB 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar\_3\_0-0.dtd"> <ejb-jar xmlns ="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://ww.w3.org/2001/XMLSchema-instance" metadata-complete="true" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/nx/javaee/ejb-jar\_3\_0.xsd"> <enterprise-beans> <session> <display-name>STBean</display-name> <ejb-name>STBean</ejb-name> <business-remote>ejb30.STBean.STBeanRemote</business-remote> <ejb-class>ejb30.STBean.STBean</ejb-class> <session-type>Stateless</session-type> <transaction>Container</transaction> <security-identity> <use-caller-identity /> &lt

      I Offline
      I Offline
      ISoftwareDev
      wrote on last edited by
      #2

      You should fine all the info in the Java EE Tutorial in the "Using the Timer Service" section. http://java.sun.com/javaee/5/docs/tutorial/doc/bnboy.html[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups