Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java Servers
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
Other Java Products
Deploying EJB in Glassfish
shriram iyer
Ranch Hand
Posts: 43
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
i am trying to deploy an
EJB
in Glassfish.
my ejb-jar.xml is as follows
<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" metadata-complete="false" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"> <enterprise-beans> <session> <ejb-name>StatelessSessionBean</ejb-name> <ejb-class>enterprise.automatic_timer_ejb.StatelessSessionBean</ejb-class> <resource-ref> <res-ref-name>jdbc/SamplesDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> </resource-ref> </session> </enterprise-beans> </ejb-jar>
my sun-ejb-jar.xml is as follows
<?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"> <sun-ejb-jar> <enterprise-beans> <ejb> <ejb-name>StatelessSessionBean</ejb-name> <jndi-name>SSB</jndi-name> <resource-ref> <res-ref-name>jdbc/SamplesDB</res-ref-name> <jndi-name>jdbc/__default</jndi-name> </resource-ref> </ejb> </enterprise-beans> </sun-ejb-jar>
my client is as follows
package enterprise.automatic_timer_client; import java.util.List; import java.util.Properties; import javax.naming.InitialContext; import enterprise.automatic_timer_ejb.StatelessSession; public class AutomaticTimerJavaClient { public static void main(String args[]) throws Exception { System.out.println("Waiting for the timer to expire"); Thread.sleep(7000); System.out.println("Logged timeouts : " ); List<String> result = getRecords(); for (String s : result) { System.out.println(s); } } public static List<String> getRecords() { try { Properties props=new Properties(); props.put("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory"); InitialContext ic = new InitialContext(props); StatelessSession sless = (StatelessSession) ic.lookup("java:global/aut/StatelessSessionBean"); return (sless.getRecords()); } catch(Exception e) { e.printStackTrace(); } return null; } }
i am using a Stateless Session Bean
I am getting look up failed,when i try to run above code
Cheers
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
InitialContext for EJB 2.x JNDI on Glassfish v2ur2 under Windows Vista
MDB for a topic and the deployment descriptor
need help on log4j.properties
problem in acessing session bean using jndi
ejb2 beans from jboss4 to jboss5 need different naming lookup patterns
More...