File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Products
»
Other Java Products and Servers
Author
Deploying EJB in Glassfish
shriram iyer
Ranch Hand
Joined: Dec 10, 2003
Posts: 43
posted
Dec 04, 2011 10:56:27
0
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
I agree. Here's the link:
http://aspose.com/file-tools
subject: Deploying EJB in Glassfish
Similar Threads
need help on log4j.properties
ejb2 beans from jboss4 to jboss5 need different naming lookup patterns
problem in acessing session bean using jndi
MDB for a topic and the deployment descriptor
InitialContext for EJB 2.x JNDI on Glassfish v2ur2 under Windows Vista
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter