[jboss-user] [Beginners Corner] - Re: application clients in JBOSS 4.2.2

sajhak do-not-reply at jboss.com
Tue Mar 11 02:04:05 EDT 2008


thanks for the detailed description PeterJ ,

 so i thought of trying EJB stuff with a little support of the IDE this time.But it gives me lot of troubles.I ll list the steps i followed to test my EJB , so that will be easy for u to  help me on this issue.

* My EJB (Bean class and the Remote interface) is packaged into a .jar archive including its ejb-jar.xml file and jboss.xml file ( i have attached both files for your reference ).

* My application client ( only the application's main class ) in archived into a .jar .

* Both the jars are copied into the JBOSS deploy directory.

* Set the classpath to both the .jar archives.

  but when i run the app client from the command line i get the follwing exception ...

 
C:\Documents and Settings\saji>java dev.saji.ejb.client.SearchNamesClient

javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.lookup(Unknown Source)
        at dev.saji.ejb.client.SearchNamesClient.doTest(SearchNamesClient.java:33)
        at dev.saji.ejb.client.SearchNamesClient.main(SearchNamesClient.java:24)


 do i have to package the Remote interface with the application client as well ?
 if you have , please  give me some references about EJB or j2EE that you recommends .  


PS : here s the config files ..
 
ejb-jar.xml
===========
<?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"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
		  http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
         version="3.0">
    <enterprise-beans>
        
            <ejb-name>SearchNames</ejb-name>
            <ejb-class>dev.saji.ejb.ejb.beans.SearchNamesBean</ejb-class>
        
    </enterprise-beans>
</ejb-jar>




jboss.xml
=========
<?xml version="1.0"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.2//EN"
        "http://www.jboss.org/j2ee/dtd/jboss_4_2.dtd">

    <enterprise-beans>
        
            <ejb-name>SearchNames</ejb-name>
            <jndi-name>dev.saji.ejb.ejb.SearchNames</jndi-name>
        
    </enterprise-beans>


 




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135525#4135525

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135525



More information about the jboss-user mailing list