File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to recognize jndi name when using myeclipse3.8.3

 
sreenivas jeenor
Ranch Hand
Posts: 125
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

I m using myeclipse 3.8.3 tool, weblogic server 7.0.
i m able to deploy j2ee enterprise application,but when executing the server cannot recognize jndi name.

in details.
--------------------
this is calcBEan.java
------------------------
/*
* Created on Jan 21, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package session.ejb;

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

import javax.ejb.CreateException;

/**
* XDoclet-based session bean. The class must be declared
* public according to the EJB specification.
*
* To generate the EJB related files to this EJB:
*- Add Standard EJB module to XDoclet project properties
*- Customize XDoclet configuration for your appserver
*- Run XDoclet
*
* Below are the xdoclet-related tags needed for this EJB.
*
* @ejb.bean name="Calc"
* display-name="Name for Calc"
* description="Description for Calc"
* jndi-name="ejb/Calc"
* type="Stateless"
* view-type="remote"
*/
public class CalcBean implements SessionBean {

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

/**
*
*/
public CalcBean() {
super();
// TODO Auto-generated constructor stub
}

/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbRemove()
*/
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub

}

/**
* Set the associated session context. The container calls this method
* after the instance creation.
*
* The enterprise bean instance should store the reference to the context
* object in an instance variable.
*
* This method is called with no transaction context.
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public void setSessionContext(SessionContext newContext)
throws EJBException {
context = newContext;
}

/**
* An ejbCreate method as required by the EJB specification.
*
* The container calls the instance?s <code>ejbCreate</code> method whose
* signature matches the signature of the <code>create</code> method invoked
* by the client. The input parameters sent from the client are passed to
* the <code>ejbCreate</code> method. Each session bean class must have at
* least one <code>ejbCreate</code> method. The number and signatures
* of a session bean?s <code>create</code> methods are specific to each
* session bean class.
*
* @throws CreateException Thrown if method fails due to system-level error.
*
* @ejb.create-method
*
*/
public void ejbCreate() throws CreateException {
// TODO Add ejbCreate method implementation
}

/**
* An example business method
*
* @ejb.interface-method view-type = "remote"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public void replaceWithRealBusinessMethod() throws EJBException {
// rename and start putting your business logic here
}
/**
* calculates Bonus for members.
* @ejb.interface-method
*/
public double calcBonus(int multiplier,double bonus){
double calc = (multiplier* bonus);
return calc;
}

}
---------------------
this is my servlet class
---------------------------
/*
* Created on Jan 21, 2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package servlets;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.naming.*;
import session.ejb.*;


/**
* @author user8
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class BonusServlet extends HttpServlet {
CalcHome homecalc;
/**
* Constructor of the object.
*/
public BonusServlet() {
super();
}

/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}

/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String socsec= null;
int multiplier = 0;
double calc = 0.0;
String title="EJB Example";

response.setContentType("text/html");
PrintWriter out = response.getWriter();
out
.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD>");
out.println(" <BODY>");
try{
Calc calculation;
String strMutt= request.getParameter("multiplier");
Integer intl = new Integer(strMutt);
multiplier = intl.intValue();
socsec= request.getParameter("socsec");
double bonus= 100.0;
calculation = homecalc.create();
calc = calculation.calcBonus(multiplier,bonus);
}catch(Exception ex){
ex.printStackTrace();
}
out.print("<h1>Bonus Calculation</h1> ");

out.print("<p>SOcSEC:"+socsec+"</p>");
out.println("<p>multiplier:"+multiplier+"</p>");
out.println("Bonus Amount:"+calc+"</p>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}

/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/


/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occure
*/
public void init() throws ServletException {
try{
InitialContext ic = new InitialContext();
Object obj = ic.lookup("ejb/Calc");
homecalc =(CalcHome)obj;
}catch(Exception e){
e.printStackTrace();
}
}

}
--------------------------
server error
-----------------------
Starting WebLogic Server...
<Jan 22, 2005 10:13:55 AM GMT+05:30> <Warning> <Management> <000000> < -Dweblogic.Domain=<domainName> is no longer a required command line option, if you don't pass it in the domain name can be be inferred from the configuration file : config.xml>
<Jan 22, 2005 10:13:57 AM GMT+05:30> <Notice> <Management> <140005> <Loading configuration C:\bea\user_projects\mydomain\config.xml>
<Jan 22, 2005 10:14:06 AM GMT+05:30> <Notice> <Security> <090082> <Security initializing using realm myrealm.>
<Jan 22, 2005 10:14:07 AM GMT+05:30> <Notice> <WebLogicServer> <000327> <Starting WebLogic Admin Server "myserver" for domain "mydomain">
activating app: _appsdir_Bonus2_dir
<Jan 22, 2005 10:14:24 AM GMT+05:30> <Error> <Deployer> <149027> <Unable to activate application, _appsdir_Bonus2_dir, from source, C:\bea\user_projects\mydomain\applications\Bonus2. Reason: No deployment found at C:\bea\user_projects\mydomain\applications\Bonus2.>
caught exception deploying app _appsdir_Bonus2_dir
<Jan 22, 2005 10:14:24 AM GMT+05:30> <Notice> <Management> <141052> <Application Poller started for development server.>
<Jan 22, 2005 10:14:25 AM GMT+05:30> <Notice> <Security> <090092> <SSL will load trusted CAs from the JDK cacerts KeyStore: C:\j2sdk1.4.2_03\jre\lib\security\cacerts for realm myrealm on server myserver.>
<Jan 22, 2005 10:14:25 AM GMT+05:30> <Alert> <WebLogicServer> <000297> <Inconsistent security configuration, java.lang.Exception: Certificate expired or not yet valid: fingerprint = 56b7dfac29e39c21027973c248d8c1bb, not before = Wed May 31 03:08:01 GMT+05:30 2000, not after = Fri May 14 03:08:01 GMT+05:30 2004, holder = C=US SP=California L=San Francisco O=BEA WebLogic CN=weblogic.bea.com Email=support@bea.com , issuer = C=US SP=California L=San Francisco O=BEA WebLogic OU=Security CN=Demo Certificate Authority Email=support@bea.com , key = modulus length=65 exponent length=3>
java.lang.Exception: Certificate expired or not yet valid: fingerprint = 56b7dfac29e39c21027973c248d8c1bb, not before = Wed May 31 03:08:01 GMT+05:30 2000, not after = Fri May 14 03:08:01 GMT+05:30 2004, holder = C=US SP=California L=San Francisco O=BEA WebLogic CN=weblogic.bea.com Email=support@bea.com , issuer = C=US SP=California L=San Francisco O=BEA WebLogic OU=Security CN=Demo Certificate Authority Email=support@bea.com , key = modulus length=65 exponent length=3
at weblogic.t3.srvr.SSLListenThread.<init>(SSLListenThread.java:537)
at weblogic.t3.srvr.SSLListenThread.<init>(SSLListenThread.java:288)
at weblogic.t3.srvr.T3Srvr.initializeListenThreads(T3Srvr.java:1518)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:858)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:294)
at weblogic.Server.main(Server.java:31)
<Jan 22, 2005 10:14:25 AM GMT+05:30> <Emergency> <Security> <090034> <Not listening for SSL, java.io.IOException: Inconsistent security configuration, java.lang.Exception: Certificate expired or not yet valid: fingerprint = 56b7dfac29e39c21027973c248d8c1bb, not before = Wed May 31 03:08:01 GMT+05:30 2000, not after = Fri May 14 03:08:01 GMT+05:30 2004, holder = C=US SP=California L=San Francisco O=BEA WebLogic CN=weblogic.bea.com Email=support@bea.com , issuer = C=US SP=California L=San Francisco O=BEA WebLogic OU=Security CN=Demo Certificate Authority Email=support@bea.com , key = modulus length=65 exponent length=3.>
<Jan 22, 2005 10:14:26 AM GMT+05:30> <Notice> <WebLogicServer> <000331> <Started WebLogic Admin Server "myserver" for domain "mydomain" running in Development Mode>
<Jan 22, 2005 10:14:26 AM GMT+05:30> <Notice> <WebLogicServer> <000354> <Thread "ListenThread.Default" listening on port 7001>
<Jan 22, 2005 10:14:26 AM GMT+05:30> <Notice> <WebLogicServer> <000365> <Server state changed to RUNNING>
<Jan 22, 2005 10:14:26 AM GMT+05:30> <Notice> <WebLogicServer> <000360> <Server started in RUNNING mode>
javax.naming.NameNotFoundException: Unable to resolve 'ejb.Calc' Resolved: 'ejb' Unresolved:'Calc' ; remaining name 'Calc'
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at servlets.BonusServlet.init(BonusServlet.java:111)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:792)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:743)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:687)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:447)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:287)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:436)
at java.lang.Integer.<init>(Integer.java:609)
at servlets.BonusServlet.doGet(BonusServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
javax.naming.NameNotFoundException: Unable to resolve 'Calc' Resolved: '' Unresolved:'Calc' ; remaining name 'Calc'
at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:262)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:229)
at weblogic.jndi.internal.ServerNamingNode_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at servlets.BonusServlet.init(BonusServlet.java:111)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:792)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:743)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:687)
at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:604)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:451)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:287)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:436)
at java.lang.Integer.<init>(Integer.java:609)
at servlets.BonusServlet.doGet(BonusServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:436)
at java.lang.Integer.<init>(Integer.java:609)
at servlets.BonusServlet.doGet(BonusServlet.java:71)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:945)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:332)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5363)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:721)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3043)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2466)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic