raj kiyare

Greenhorn
+ Follow
since Apr 21, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by raj kiyare

sorry for replying late. I was not online for few days. I'm learnig JEE. So ran a ejb2 app in JBoss 4 and it was working fine and I wanted to run EJB3 in JBOSS 6. but was not finding any jee jar file. so please tell me what jar files i should add for all jee apps.could you list them. what jar file i should use for what jee app. like you gave for ejb.
13 years ago
hi,
there is no j2ee jar file in jboss/client folder. where is located. i'm using jboss 6.
13 years ago
could someone explain me clearly about jstl. not the technical part. how to download what to use. there are may sites each site gives different procedure some say download from apache and some say download jwsdp from sun to install install. are jstl from apache and sun same. what is the difference. what should i download. and what will be compatible with tomcat 5.5.

i tried downloading jstl from apache from this page http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html

In tis page i selected link apache jakarta project mirror. i got some links like this
BCEL
BSF
Cactus
JCS
JMeter
Regexp


i thought these might different sites to download jstl .
i clicked on one of them. what i'm getting is something like jcs.zip or bsf .zip . i unzipped it. but there is no jstl.jar standard.jar . how to download these and where to?. ialso download sjwsdp2 from sun.but it is not installing it asking for tomcat 5 and i'm using tomcat 5. some please help me.
13 years ago
hi,
i'm trying to install jwsdp 2 . i'm using tomcat 5.5 . but jwsdp2 is not recognizing tomcat 5.5 . it is looking for tomcat 5 or sun java application server. could you please tell what version of jwsdp is compatible with tomcat 5.5 . and where i can download it. insun websie on jwsdp 2 is available. i was looking to download jawsdp 1.3 but i cant find it anywhere. or jwsdp1.4 will do. just want to try. and see what works.
13 years ago
i'm using ejb 2 with myeclipse 9 and weblogic 9 . i'm learning java ee. was trying to use myeclipse.just testing with ejb2 have not yet started ejb3. getting following error when i run my client app.

error:
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at WishClient.main(WishClient.java:13)


my files


Wish.java

import java.rmi.RemoteException;

public interface Wish
extends javax.ejb.EJBObject
{
public String getMonthName() throws RemoteException;
public String getDayName() throws RemoteException;
public String generateWishMsg(String name) throws RemoteException;
}



WishHome.java

public interface WishHome
extends javax.ejb.EJBHome
{
// public static final String COMP_NAME="java:comp/env/ejb/Wish";
// public static final String JNDI_NAME="Wish";

public Wish create()
throws javax.ejb.CreateException,java.rmi.RemoteException;

}


WishClient.java

import java.util.*;
import javax.naming.*;
public class WishClient {


public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
Hashtable ht= new Hashtable();

ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
InitialContext ic = new InitialContext();
WishHome hor=(WishHome)ic.lookup("WishJndi");
Wish eor=hor.create();
System.out.println("Week Day Name =" +eor.getDayName());
System.out.println("Month Name =" +eor.getMonthName());
System.out.println("Wish Message =" +eor.generateWishMsg("Raj"));
}

}


WishBean.java

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.util.*;


public class WishBean implements SessionBean {

/** The session context */
private SessionContext context;

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

public WishBean() {
// TODO Auto-generated constructor stub
}

public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}


public void setSessionContext(SessionContext newContext)
throws EJBException {
context = newContext;
}

public String getMonthName(){
System.out.println("getMonthName()");
String months[]=new String[]{"jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};
Calendar cl=Calendar.getInstance();
int m=cl.get(Calendar.MONTH);
return months[m];
}

public String getDayName(){
System.out.println("getDayName()");
String weeks[]=new String[]{"","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
Calendar cl=Calendar.getInstance();
int w=cl.get(Calendar.DAY_OF_WEEK);
return weeks[w];
}


public String generateWishMsg(String name) throws EJBException {
// rename and start putting your business logic here
System.out.println("generateWishMsg()");
Calendar cl=Calendar.getInstance();
int h=cl.get(Calendar.HOUR_OF_DAY);
if(h<=12)
return "Good Morning" + name;
else if(h<=16)
return "Good Afternoon" + name;
else
return "Good Evening" + name;
}

}


ejb-jar.xml

<ejb-jar >
<enterprise-beans>
<session >
<ejb-name>ABC</ejb-name>

<home>WishHome</home>
<remote>Wish</remote>

<ejb-class>WishBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>

</session>

</enterprise-beans>

</ejb-jar>


weblogic-ejb-jar.xml


<weblogic-ejb-jar>

<weblogic-enterprise-bean>
<ejb-name>ABC</ejb-name>
<jndi-name>WishJndi</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>

1. can someone please tell me why i'm getting error. how should i resolve it.
2.when i'm using xdoclet to generate bean, home interface and xml files. it automatically generating jndi name. like this


public static final String COMP_NAME="java:comp/env/ejb/Wish";
public static final String JNDI_NAME="Wish";

so i commented them and used my own jndi name in weblogic -ejb-jar.xml. is it wrong to do that?. how come these variables have me declared in my home interface. why and how are they used. and i did not understand the structure --> java:comp/env/ejb/Wish .. what does it mean?. i'm a newbie . so please explain clearly.
It got solved. it was due to java version mismatch. i compiled with jdk 1.6. and deployed. in weblogic 9. which was using jdk1.5.
so i compiled all the classes with jdk1.5 and deployed. it worked. !!!. however when i tried setting my domain to use jdk1.6 it was able to create domain. but the server was not starting. so i again shifted to weblogic default jdk.15
In the console i'm getting this message

unable to load class specified in ejb-jar.xml. class bytes found but defineclass() failed for 'HelloBean'

Matthew Brown wrote:

raj kiyare wrote:So first is it compulsory to do in exception handling in JSP also.


Well, ideally you shouldn't need to do any exception handling in the JSP because you shouldn't have any Java code in the JSP. All that should be in a servlet.




So do you mean when I write java scriplets i need to write exception handling explicitly.?
Hi,
I'm trying to deploy HelloComp.jar in weblogic 9(console deployment) but it is giving the following error. This is my first ejb deployment. I'm learning JSP and ejb.

error:


An error occurred during activation of changes, please see the log for details.
Unable to find constructor for the Exception class weblogic.ejb20.deployer.DeploymentDescriptorException
weblogic.ejb20.deployer.DeploymentDescriptorException.<init>(java.lang.String)

I'm giving my files below.

Hello.java

import javax.ejb.*;
import java.rmi.*;
public interface Hello extends EJBObject
{
public String sayHello() throws RemoteException;
}

HelloHome.java


import javax.ejb.*;
import java.rmi.*;
public interface HelloHome extends EJBHome
{
public Hello create() throws RemoteException, CreateException;
}

HelloBean.java


import java.rmi.*;
import javax.ejb.*;
public class HelloBean implements SessionBean
{
public void ejbActivate()
{
System.out.println(" \n In ejbActivate() \n");
}
public void ejbPassivate()
{
System.out.println(" \n In ejbPassivate() \n");
}
public void setSessionContext(SessionContext ctx)
{
System.out.println(" \n In setSessionContext() \n");
}
public void ejbCreate()
{
System.out.println(" \n In ejbCreate() \n");
}
public void ejbRemove()
{
System.out.println(" \n In ejbRemove() \n");
}
public String sayHello()
{
System.out.println(" \n Hello \n");
return "Hello !!!";
}
}


ejb-jar.xml

<ejb-jar
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
version="2.1">
<enterprise-beans>
<session>
<ejb-name>ABC</ejb-name>
<home>HelloHome</home>
<remote>Hello</remote>
<ejb-class>HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>

weblogic-ejb-jar.xml

<weblogic-ejb-jar
xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
<weblogic-enterprise-bean>
<ejb-name>ABC</ejb-name>
<jndi-name>HelloJndi</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>


Someone please tell me why i'm getting error.

Also i tried hard deployment i.e i tried keeping hellocomp.jar in in autodeploy folder. but when i opened my admin console. it is not showing i deployed any component?
sorry for replying late. was not online for few days. anyway.

i tried making the following changes.

i just added try catch block like this



now i'm not getting error. and it is calculating avg also.
I'm a new to JSP. i read that you need not do exception handling in JSP. it is automatic. i mean it will automatically have exception handling in JSP equivalent servelt.
So first is it compulsory to do in exception handling in JSP also.
second. Though it is not giving any errors . it is not inserting the data in table can you say why?
Thank you Paul for letting me know the mistake. Thank you Bibeault for the information . will follow your advice.
13 years ago
JSP
have just started learning JSP. was learning about declaraton tags and scriptlets. and this was my first code. so its looks like i have a lot to learn. anyway could you please tell what was the error in my code. thanks in advance.
13 years ago
JSP
Hi,
I'm getting the following error while using Prepared statement. Could some one tell me where i'm going wrong.

error:


type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /DBTest.jsp:31

28: res = "Fail";
29: else
30: res = "Pass";
31: ps.setInt(1,no);
32: ps.setString(2,name);
33: ps.setInt(3,total);
34: ps.setFloat(4,avg);


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:506)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:395)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause

java.lang.NullPointerException
org.apache.jsp.DBTest_jsp._jspService(DBTest_jsp.java:91)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


files i'm using

input.html



DBTest.jsp