satyajit bhosale

Greenhorn
+ Follow
since Jun 15, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by satyajit bhosale

Hi Souvik and Avinash,

Thank you very much for your reply. The links are useful.
I will let you know the error I am getting.

Thanks,
Satyajit

Avinash Ga wrote:Study materials by Milkalai and Ivan are great to start with. Also consider reading Java Web Services Up and Running by Martin Kalin and Java Web Services Architecture by James Mcgovern and team....



Hi,

My query is regarding practical of OCPJWSD. Can you please suggest some link(s) or books for practical?
Currently, I am stuck to following example/situation -
- Environment: Eclipse, Tomcat 7.0, JDK 1.7, Axis2.
- Create a WebService with annotation @WebService, @WebMethod, @SOAPBinding.
Here, I am unable to create a WSDL. I am trying to access a webservice using standalone client and stub.

If you have any input, please comment.

Thanks in advance,
Satyajit Bhosale
hi,

I am new to ejb. I am trying to solve simple CMP entity bean.
But, confused between CMP & BMP codings like -
In CMP should i put a select query in deployment descriptor (ejb-jar.xml) or in Bean class?

Can anyone please send me a link for a simple example of CMP bean code?


thanks,
satyajit
yes, client is in the same application. I deployed a jar including
6 files given above.
I am using Eclipse as an editor.
hi,

I am using JBoss as Application Server.
These are the details of my code for accessing Local ejb -

1. Client : MyLocalEJBClient.java -
----------------------------------

public static void main(String[] args) {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
MyLocalEJB localEJB;

try {
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("MyLocalEJB");

MyLocalEJBHome home = (MyLocalEJBHome) obj;
localEJB = home.create();
localEJB.hi();

} catch (NamingException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
}

}
==================================================================

2. Local interface : MyLocalEJB.java -
---------------------------------
public interface MyLocalEJB extends EJBLocalObject {
public void hi();
}
==================================================================

3. LocalHome interface : MyLocalEJBHome.java
-------------------
public interface MyLocalEJBHome extends EJBLocalHome {
public MyLocalEJB create() throws CreateException;
}
==================================================================

4. Bean class: MyLocalEJBBean -
---------------------------

public class MyLocalEJBBean implements SessionBean {

SessionContext ctx = null;

public void ejbCreate() throws EJBException {
System.out.println("ejbCreate() ...");
}

public void ejbActivate() throws EJBException {
System.out.println("ejbActivate()...");
}

public void ejbPassivate() throws EJBException {
System.out.println("ejbPassivate()...");
}

public void ejbRemove() throws EJBException {
System.out.println("ejbRemove()...");
}

public void setSessionContext(SessionContext ctx) throws EJBException {
this.ctx = ctx;
}

public void hi() {
System.out.println("hi() ....");
}
}
==================================================================

5. ejb-jar.xml -

<ejb-jar>
<enterprise-beans>
<session>
<ejb-name> MyLocalEJB </ejb-name>
<local-home> MyLocalEJBHome </local-home>
<local> MyLocalEJB </local>
<ejb-class> MyLocalEJBBean </ejb-class>
<session-type> Stateless </session-type>
<transaction-type> Container </transaction-type>
</session>
</enterprise-beans>

<assembly-descriptor>
<security-role>
<role-name>everyone</role-name>
</security-role>

<method-permission>
<description><![CDATA[description not supported yet by ejbdoclet]]></description>
<role-name>everyone</role-name>
<!--<unchecked/> -->
<method>
<ejb-name>MyLocalEJB</ejb-name>
<method-intf>Local</method-intf>
<method-name>*</method-name>
</method>
</method-permission>
</assembly-descriptor>

</ejb-jar>

==================================================================

5. jboss.xml -

<jboss>
<enterprise-beans>
<session>
<ejb-name> MyLocalEJB </ejb-name>
<local-jndi-name> MyLocalEJB </local-jndi-name>
</session>
</enterprise-beans>
</jboss>

==================================================================

Thanks,
satyajit
Use Application Server - JBoss
Adv -
1. Open source
2. Less memory consuming

Books -
1. Orielly - Thorough concepts are given.
2. Mastering EJB.
hi,

I am getting following exception while accessing LOCAL ejb --

Exception in thread "main" java.lang.NullPointerException
at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
at $Proxy0.create(Unknown Source)
at MyLocalEJBClient.main(MyLocalEJBClient.java:26)

I am using JBoss.
And this is my Client code --
-------------------------------------------------------------------
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
MyLocalEJB localEJB;

try {
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("MyLocalEJB");

MyLocalEJBHome home = (MyLocalEJBHome) obj;
localEJB = home.create();
localEJB.hi();

} catch (NamingException e) {
e.printStackTrace();
} catch (CreateException e) {
e.printStackTrace();
}

-------------------------------------------------------------------

Can anybody please help?


Thanks,
Satyajit
yes, Remote ejb works fine.
I am using JBoss 3.2.6, jdk 1.4.2

thanks,
satyajit
hi,

I am getting following exception while accessing local ejb --

java.lang.NullPointerException
at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
at $Proxy0.create(Unknown Source)
at HelloEJBClient.main(HelloEJBClient.java:36)
-------------------------------------------------------------------------

My client code --
HelloEJBClient.java -
--------------------
public class HelloEJBClient {

public static void main(String[] args) {
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, "java.naming.security.principal");
env.put(Context.SECURITY_CREDENTIALS, "java.naming.security.credentials");
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.factory.url.pkgs","org.jboss.naming rg.jnp.interfaces");

try {
Context ctx = new InitialContext(env);
Object obj = ctx.lookup("HelloLocalEJB");
HelloEJBHome home = (HelloEJBHome) obj;
HelloEJB helloWorld = home.create();
helloWorld.hello();
} catch(Exception e) {
e.printStackTrace();
}
}
}

----------------------------------------------------------------------

jboss.xml --
---------

<jboss>
<enterprise-beans>
<session>
<ejb-name> HelloLocalEJB </ejb-name>
<jndi-name> HelloLocalEJB </jndi-name>
<local-jndi-name> HelloLocalEJB </local-jndi-name>
</session>
</enterprise-beans>

<enforce-ejb-restrictions></enforce-ejb-restrictions>
<container-configurations></container-configurations>
<unauthenticated-principal></unauthenticated-principal>

<resource-managers>
</resource-managers>


</jboss>

----------------------------------------------------------------------

ejb-jar.xml --
-----------

<ejb-jar>

<display-name> HelloLocalEJB</display-name>

<enterprise-beans>
<session>
<ejb-name> HelloLocalEJB </ejb-name>
<local-home> HelloEJBHome </local-home>
<local> HelloEJB </local>

<ejb-class> HelloEJBBean </ejb-class>
<session-type> Stateless </session-type>
<transaction-type> Container </transaction-type>
</session>
</enterprise-beans>

<assembly-descriptor>
<security-role>
<role-name> everyone </role-name>
</security-role>

<method-permission>
<role-name> everyone </role-name>
<method>
<ejb-name> HelloLocalEJB </ejb-name>
<method-intf> Local </method-intf>
<method-name> * </method-name>
</method>
</method-permission>

</assembly-descriptor>

</ejb-jar>

----------------------------------------------------------------------


Thanks,
satyajit
Can someone please tell me which books to refer for giving SCBCD?

thanks