ServerException deploying bookstore servlet example
I am trying to run the examples in the tutorial addendum (1.4 beta). I am using JSDK 1.4.1 and J2EE 1.4 on Windows XP.
I have run ant build and ant package-bookstore in the bookstore directory.
I then ran ant build in the bookstore1 directory and ran ant package. Everything built successfully. Then I started the J2EE server by typing j2ee at the command prompt and ran ant deploy. I got the following output:
C:\j2sdkee1.4\doc\tutorial\examples\web\bookstore1>j2ee
Redirecting application output to C:\j2sdkee1.4\logs\launcher.server.log
C:\j2sdkee1.4\doc\tutorial\examples\web\bookstore1>ant deploy
Buildfile: build.xml
set-deploytool:
deploy:
[exec] Could not connect to localhost
[exec] com.sun.enterprise.tools.deployment.main.ServerException: Could not
connect to localhost
[exec] at com.sun.enterprise.tools.deployment.main.ServerManager.getJar
Installer(ServerManager.java:587)
[exec] at com.sun.enterprise.tools.deployment.main.Main.deployModule(Ma
in.java:538)
[exec] at com.sun.enterprise.tools.deployment.main.Main.internalMain(Ma
in.java:205)
[exec] at com.sun.enterprise.tools.deployment.main.Main.main(Main.java:
114)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] Sender object Deploytool (Main) : Could not connect to localhost
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:324)
[exec] at org.apache.commons.launcher.ChildMain.run(ChildMain.java:280)
[exec] Error occurred: com.sun.enterprise.tools.deployment.main.ServerExcep
tion: Could not connect to localhost
[exec] com.sun.enterprise.tools.deployment.main.ServerException: Could not
connect to localhost
[exec] at com.sun.enterprise.tools.deployment.main.ServerManager.getJar
Installer(ServerManager.java:587)
[exec] at com.sun.enterprise.tools.deployment.main.Main.deployModule(Ma
in.java:538)
[exec] at com.sun.enterprise.tools.deployment.main.Main.internalMain(Ma
in.java:205)
[exec] at com.sun.enterprise.tools.deployment.main.Main.main(Main.java:
114)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[exec] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[exec] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[exec] at java.lang.reflect.Method.invoke(Method.java:324)
[exec] at org.apache.commons.launcher.ChildMain.run(ChildMain.java:280)
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 8 seconds
C:\j2sdkee1.4\doc\tutorial\examples\web\bookstore1>
I'd really appreciate any help on this...
Thanks,
Francois
you donnot complete to start the j2ee.
type the following:
j2ee
then wait for several minutes
Similar Messages
-
J2EE tutorial (June 17 '04) servlet example compilation error
This is a copy of my previous post on the same topic, but this one has a more self-desriptive subject line. Apologies for duplication.
I am trying the first servlet example in the J2EE tutorial, June 17, 2004, pgs 443 - 448. I have completed all the steps as described. However, the URL results in the following error. I would like to point out that I am using the URL http://localhost:8081/bookstore1/bookstore (instead of port 8080 because the admin console suggests that port 8081 is an available http port):
Assistance would be appreciated.
HTTP Status 404 - /bookstore1/bookstore
type Status report
message /bookstore1/bookstore
description The requested resource (/bookstore1/bookstore) is not available.
Sun-Java-System/Application-Server-PE-8.0
I looked at the logviewer and there are 3 severe errors in the log:
1. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: javax.enterprise.system.container.web
Name-Value Pairs:
_ThreadID=12;
Record Number: 754
Message ID: WebModule[bookstore1]Exception sending context initialized event to listener instance of class listeners.ContextListener java.lang.NoClassDefFoundError
Complete Message
exception/OrderException
at listeners.ContextListener.contextInitialized(Unknown Source)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3679)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4140)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:873)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:171)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:855)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:623)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:947)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:729)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:147)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:224)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:488)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:475)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:302)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:107)
at com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance.multicastEvent(ManagedServerInstance.java:3880)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.server.core.jmx.Introspector.invokeMethodOn(Introspector.java:181)
at com.sun.enterprise.admin.server.core.mbean.config.AdminBase.invoke(AdminBase.java:86)
at com.sun.enterprise.admin.server.core.mbean.config.ConfigMBeanBase.invoke(ConfigMBeanBase.java:680)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.deployment.phasing.DeploymentService.multicastEvent(DeploymentService.java:341)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:284)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:115)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:74)
at com.sun.enterprise.deployment.phasing.DeploymentService.executePhases(DeploymentService.java:233)
at com.sun.enterprise.deployment.phasing.DeploymentService.deploy(DeploymentService.java:150)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:287)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:280)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:583)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
at java.lang.Thread.run(Thread.java:534)
2. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 755
Message ID:
Complete Message
Error listenerStart
3. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 756
Message ID:
Complete Message
Context startup failed due to previous errorsI had the same problem. It was caused by not including \j2eetutorial14\examples\web\bookstore\dist\bookstore.jar in the bookstore1.war. You may need to build the bookstore.jar file first if you haven�t already.
-
To Deploy a Servlet using Tomcat
I am trying to deploy an example servlet in tomcat.
my example servlet code is
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class HitServlet extends HttpServlet {
private int mCount;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String message = "Hits: " + ++mCount;
response.setContentType("text/plain");
response.setContentLength(message.length());
PrintWriter out = response.getWriter();
out.println(message); } }
i 've placed my servlet in the directory
webapps/midp/WEB-INF/classes/HitServlet.java
i've successfully compiled the code. Then started the tomcat server & thro' IE tried to open the url to http://localhost:8080/midp/hits.
but i 'm receiving the error the servlet bob is missing. i've placed the web.xml & server.xml in the folders specified in the tutorial. in server.xml i've added the code
<Context path="/midp" docBase="midp" debug="0" reloadable="true" privileged="true"/>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>bob</servlet-name> <servlet-class>HitServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>bob</servlet-name> <url-pattern>/hits</url-pattern> </servlet-mapping> </web-app>
If u can guide me to deploy the servlet it'll be very helpfull.
With Best Regards
Ramkumarone idea that I have is the CATALINA_HOME and CATALINA_BASE.
We use CATALINA_BASE to install our stuff in another directory than that of the tomcat installation.
in the tomcat-engine.log you should se sth similar to:
2003-06-18 09:19:04 StandardHost[localhost]: Installing web application at context path /hits from URL file:<xxx/webapps/midp>
2003-06-18 09:19:04 WebappLoader[/gtfn]: Deploying class repositories to work directory $CATALINA_BASE/work/Apache/localhost/gtfn
... -
Hi,
I am trying to deploy a servlet in Tom cat.
I could not access the servlet after deployment. Plz help me.
Here is my servlet code.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class ProcessData extends HttpServlet
public void init(ServletConfig config) throws ServletException
super.init(config);
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException, NumberFormatException
res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println("I am in Servlet");
I compiled it and copied the class file into the
Tomcat classes (WEB-INF directory) folder.
and made an entry in web.xml as,
<servlet>
<servlet-name>SendData</servlet-name>
<servlet-class>SendData</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SendData</servlet-name>
<url-pattern>servlet/SendData</url-pattern>
</servlet-mapping>
WEB_INF is present here,
D:\tomcat\tomcat-jwsdp-1.4\webapps\servlets-examples\WEB-INF
I am trying to access the servlet by using,
http://localhost:8888/servlets-examples/servlet/SendDataHi,
I am getting this error....
HTTP Status 404 - /servlets-examples/servlet/SendData
type Status report
message /servlets-examples/servlet/SendData
description The requested resource (/servlets-examples/servlet/SendData) is not available.
Thx,
Babloo -
Compiled Tomcat Servlet Example & got JAR, not WAR?
Is there a basic reference on how to create a simple servlet with NetBeans 4.1 and deploy it to Tomcat?
When I created the project I chose Samples->Web->Tomcat Servlet Example, and yet it does not create a WAR file on compilation.
And of course once I'm past that I have to figure out how to edit the XML file, I gather.
I need a reference that will hold me by the hand and walk me through it once to kick start me.
After that I think I can make it without having to ask such newbie questions.Hi,
not sure to what extent you are clear in build.xml file (done thru ant).
what i can tell you is, ant creates any archive file (be it .jar, .war, .ear) with the tasks named "jar" (<jar jarfile="yourfilename.jar"..>), "war" and "ear". But both war and ear are the extensions of the jar only.
You can achieve creation of any archive file with the jar task itself.
you need to take care of the following...
(1) you can /should edit the extension of the files at every stage.. first .jar and then .war and then .ear (if necessary) => basic flow
(2) at every step, you have to have a file inclusion inside the corresponding archive file..
say for example, for a .jar file you should include all the compiled .class files, and ejb-jar.xml (incase you use ejbs) and other built-in jar files....
In case of .war files (web archive) you should include the web.xml file, any static files (html, jsp etc), any tld files - it goes with your application's nature and requirement.....
fyi, i m including a sample build.xml file which i use for a webapplication, so it deals with war...
<?xml version="1.0" encoding="UTF-8"?>
<project name="ServletsReqDispFwd" default="deploy">
<property name="top" value="."/>
<property name="webinf" value="${top}/WEB-INF"/>
<property name="lib" value="${webinf}/lib"></property>
<property name="classes" value="WEB-INF/classes"/>
<property name="jboss.dir" value="D:\jboss-3.2.2RC3\server\default\deploy"></property>
<property name="tomcat.dir" value="D:\jakarta-tomcat-4.1.27\webapps"></property>
<property name="warfile" value="ServletsReqDispFwd.war"></property>
<property name="src" value="${top}/src"/>
<property name="web.xml" value="WEB-INF/web.xml"/>
<target name="package">
<javac srcdir="${src}" destdir="${classes}"
listfiles="true" debug="true" verbose="true"
classpath="${lib}/*.jar"/>
<war warfile="${warfile}" webxml="${web.xml}">
<webinf dir="${top}">
<include name="**/*web*.xml"/>
<include name="**/*application*.xml"/>
<exclude name="src/**/*.xml"/>
</webinf>
<lib dir="${lib}">
<include name="*.jar"/>
</lib>
<fileset dir="." includes="**/*.html"/>
<classes dir="${classes}" includes="**/*.class"></classes>
</war>
</target>
<target name="deploy" depends="clean,package">
<copy file="${warfile}" todir="${tomcat.dir}" overwrite="true"></copy>
</target>
<target name="clean">
<delete dir="${classes}">
<filename name="*.class"/>
</delete>
<delete>
<fileset dir="${top}" includes="${warfile}"/>
</delete>
<delete>
<fileset dir="${tomcat.dir}" includes="${warfile}"/>
</delete>
</target>
</project>hope this contribues to a certain extent to help you edit the buildfile (xml file as you go) to meet your requirement..... -
How can i deploy a servlet with eclispe
Hello,
will any one of u give me the steps to deploy a servlet with eclipse on portal server(J2EE Engine),
in help of eclipse they given as, whole webapplication deployement, but that is also giving me a error, the procedure they given is, once we created a .war file for our servlet project we need to refer this to a .Ear file, and then this Ear can be deployed in to the server. Is it the same and only procedure to deploy a servlet with eclipse, or if there is any other method,please give me the steps also.
when i am deploying with the .Ear file, it is giving the error as,
Jun 4, 2005 11:34:31 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
[001]Deployment aborted
Deployment exception : Cannot determine sdm host (is empty). Please configure your engine/sdm correctly !
but the sdm is working on the server with the same host, and local deployement is also done successfully, but from my system im not able to deploy!
Thanks&Regards,
Sireesha.Yeah, i am able to see the J2EE engine clusters, there the message server port is given as 3601. becoz scs instance number is 1 here. so it is not the problem,
the error it is giving as,
Jun 6, 2005 11:37:28 AM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
[001]Deployment aborted
Settings
SDM host : obtdev9
SDM port : 50018
URL to deploy : file:/C:/DOCUME1/sireesha.b/LOCALS1/Temp/temp56446MyServletEAR.ear
Deployment exception : Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
Inner exception was :
Server obtdev9 did not accept login request as apiadmin on port 50018 - CmdXmlFactory could not find Top Element within String: "null".
is this may be the problem with port number?
i am not knowing what is happening here...
if you know the exact error based on the error messgae please help me,
thanks to u for helping in this problem,
Regards,
sireesha. -
Am getting the following error while running the servlet example
Hi,
am getting the following error while running the servlet example
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
edu.dao.StudentDao.insertStudent(StudentDao.java:18)
edu.servlet.StudentServlet.doGet(StudentServlet.java:25)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.
Thanks
//sreekanthHi,
the following code i have written in StudentDao
package edu.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.apache.commons.dbutils.DbUtils;
import edu.model.Student;
import edu.util.DBUtil;
public class StudentDao {
public void insertStudent(Student student) {
String stuQuery = "INSERT INTO STUDENT VALUES(?,?)";
Connection connection = DBUtil.getConnection();
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection.prepareStatement(stuQuery);
preparedStatement.setString(1,student.getStudentNo());
preparedStatement.setString(2, student.getStudentName());
preparedStatement.executeUpdate();
} catch(SQLException e){
System.out.println("..Sql exception......");
}finally {
DbUtils.closeQuietly(connection,preparedStatement,null);
} -
How to embed URL of deployed java servlet into Android code
I have deployed my servlet code on cloud which access the database cloud , but when i try to access the URL of deployed application , it asks for my credentials (username and password)....
Now that i want to embedd my servlet link on cloud to my android app code , how to escape the credentials , or is their any way so that i can add my username and password in my servlet code itself. This is my servlet code and it is working fine..
Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
// out.print("system");
try {
ctx = new InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("javatrial5196db");
// out.print(ds.toString());
conn = ds.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from test");
while (rs.next()) {
out.println(rs.getString("id") + " " + rs.getString("password") + "<br>");
conn.close();
stmt.close();
} catch (Exception e) {
out.print(e);What is the intended behavior here, how will the user be authenticated if credentials are not obtained from the user ? By default the JCS applications will be secured and the system will prompt for login, you can disable the login by adding "<login-config/>". You can also configure the authentication to use BASIC / FORM authentication instead. Hard coding credentials to servlet / DB table does not sound like a good solution to me though.. For details on security refer to this document.
Jani Rautiainen
Fusion Applications Developer Relations
https://blogs.oracle.com/fadevrel/ -
How to deploy a servlet on WebLogic 6.1
I have tried to deploy a servlet using WL6.1 following the instructions at this URL
: http://edocs.beasys.com/wls/docs61/quickstart/quick_start.html
but whenever I try to access the servlet from the web browser I get a HTTP 404 -
Not Found message. The only step I omitted was step 2, as my servlet does not have
package.
Could anyone please advise ? Thanks.
The inner classes are located in the same directory as the servlet itself, so isn't
that part of the classpath by default. (i.e. java classes in the same package
in the same folder find each other just fine).
"Deepak Vohra" <[email protected]> wrote:
>
>Add the directory containing the inner classes to the Classpath.
>
>thanks,
>
>Deepak
>
>"Brian Schneider" <[email protected]> wrote:
>>
>>Yeah I've done that many times and redployed the war file. I even stopped
>>and
>>started the server each time still to no avail. Very frustrating.
>>
>>"Deepak Vohra" <[email protected]> wrote:
>>>
>>>Redeploy web application after servlet has been modified.
>>>
>>>http://edocs.bea.com/wls/docs70/webapp/
>>>
>>>
>>>thanks,
>>>
>>>Deepak
>>>
>>>
>>>
>>>"Brian Schneider" <[email protected]> wrote:
>>>>
>>>>Makes sense. I made those public and for some reason it still is
>doing
>>>>the same
>>>>thing:( Thanks again. Anything else would be great.
>>>>
>>>>"Deepak Vohra" <[email protected]> wrote:
>>>>>
>>>>>If a servlet as inner classes, the inner classes are loaded by a
>different
>>>>>classloader
>>>>>than the Servlet class. For the servlet class to acces the inner
>classes
>>>>>make
>>>>>the inner classes public.
>>>>>
>>>>>
>>>>>"Brian Schneider" <[email protected]> wrote:
>>>>>>
>>>>>>Does it matter if the ExcelExport has inner classes (i.e. when compiled,
>>>>>>3 class
>>>>>>files exist)? The JspView is only one class.
>>>>>>
>>>>>>"Brian Schneider" <[email protected]> wrote:
>>>>>>>
>>>>>>>Yes... the compiled class is in the WEB-INF\classes\export (just
>>>as
>>>>>>the
>>>>>>>JspView
>>>>>>>is in the WEB-INF\classes\view folder).
>>>>>>>
>>>>>>>
>>>>>>>"Deepak Vohra" <[email protected]> wrote:
>>>>>>>>
>>>>>>>>Is the ExportExcel servlet in the DefaultWebApp/WEB-INF/classes/export
>>>>>>>>directory?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>Brian Schneider <[email protected]> wrote:
>>>>>>>>>I am getting the same problem... but with my package defined.
>>
>>>The
>>>>>>>weird
>>>>>>>>>thing is the JspView works fine but the ExcelExport does not,
>>even
>>>>>>>though
>>>>>>>>>(to me) they are configured the same. Here's the details of
>my
>>>>web.xml.
>>>>>>>>>
>>>>>>>>> <servlet>
>>>>>>>>> <servlet-name>JspView</servlet-name>
>>>>>>>>> <servlet-class>view.JspView</servlet-class>
>>>>>>>>> </servlet>
>>>>>>>>> <servlet>
>>>>>>>>> <servlet-name>ExportExcel</servlet-name>
>>>>>>>>> <servlet-class>export.ExportExcel</servlet-class>
>>>>>>>>> </servlet>
>>>>>>>>> <servlet-mapping>
>>>>>>>>> <servlet-name>JspView</servlet-name>
>>>>>>>>> <url-pattern>/servlet/view.JspView</url-pattern>
>>>>>>>>> </servlet-mapping>
>>>>>>>>> <servlet-mapping>
>>>>>>>>> <servlet-name>ExportExcel</servlet-name>
>>>>>>>>> <url-pattern>/servlet/export.ExportExcel</url-pattern>
>>>>>>>>> </servlet-mapping>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
-
Deployment of Servlets with JDeveloper
Dear Sir,
I am facing problems for using initialised parameters in the servlets while deploying them(servlets) through JDeveloper.
Kindly, let me know how I can remove hardcoded driver and ipaddresses from my file and still use them with JDeveloper(i.e. in generalised form).
Thanks
Arvind
nullJDeveloper has an in built OC4J(an servlet and EJB container). It deploys in this app server.
-
Deploying a servlet in tomcat 5.0
I install tomcat 5.0 in my pc
I can run HelloWorldExample in browser using the following URL:
http://localhost:8080/servlets-examples/servlet/HelloWorldExample
I copy the HelloWorldExample.class into folder :
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF\classes
I also change the web.xml (path -- C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT\WEB-INF)to include the following:
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>
<servlet>
<servlet-name>HelloWorldExample</servlet-name>
<servlet-class>HelloWorldExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HelloWorldExample</servlet-name>
<url-pattern>/HelloWorldExample</url-pattern>
</servlet-mapping>
but when I type http://localhost:8080/servlet/HelloWorldExample I go an error 404 The requested resource/servlet/HelloWorldExample) is not available.
I set the JAVA_HOME to j2sdk folder C:\j2sdk1.4.2_04\
Am I missing sth in classpath?
And in tomcat 5.0, it is a must to specify all servlet in web.xml?
Is there any way I just copy the class into the folder and no need to specify the name in web.xml?
Thank you in advance!Hi there,
actually I can run the example servlet by:
http://localhost:8080/servlets-examples/servlet/HelloWorldExample
today I change the web.xml in conf folder, I enable the following lines which are originally remarked:
(original line 90 to 102)
<servlet>
<servlet-name>invoker</servlet-name>
<servlet-class>
org.apache.catalina.servlets.InvokerServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
(original line 319 to 324)
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
then I have the following error when I type:
HTTP Status 500
java.util.MissingResourceException: Can't find bundle for base name LocalStrings, locale zh_TW
java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
java.util.ResourceBundle.getBundleImpl(Unknown Source)
java.util.ResourceBundle.getBundle(Unknown Source)
HelloWorldExample.doGet(HelloWorldExample.java:39)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
what should I do?
Thank you! -
Deploying a Servlet in Web Logic Server 6.0
Hi,
I am trying to deploy a simple servlet in WebLogic Server.
I have done the following steps.
1) Compiled the MyWorld.Java Servlet Successfully in c:test\ Directory..
2) Created WEB-INF/Classes Directory in the home Directory of WebApplication Directory..
C:\bea\wlserver6.0\config\mydomain\applications\
3) Copied the Class file into the WebApplication Directory i.e
C:\bea\wlserver6.0\config\mydomain\applications\WEB-INF/Classes
4) Executed in the Browser using following URL:
http://127.0.0.1:7001/MyWorld
But, I am getting this error:
Error 404--Not Found
Please let me know if the above procedure is wrong, then what are the exact steps
involved in Deploying a servlet in WebLogic Server.
Thanks,
Ram.
My installation has a DefaultWebApp directory under mydomain/applications,
try moving everything down there. (I'm on 6.1 but I think 6.0 is the same)
Eliot Stock
eliot [ at ] carbonfive [ dot ] com
http://carbonfive.com
"Ram" <[email protected]> wrote in message
news:3bc71641$[email protected]..
>
> Hi,
>
> I am trying to deploy a simple servlet in WebLogic Server.
> I have done the following steps.
>
> 1) Compiled the MyWorld.Java Servlet Successfully in c:test\ Directory..
>
> 2) Created WEB-INF/Classes Directory in the home Directory of
WebApplication Directory..
> C:\bea\wlserver6.0\config\mydomain\applications\
> 3) Copied the Class file into the WebApplication Directory i.e
>
> C:\bea\wlserver6.0\config\mydomain\applications\WEB-INF/Classes
>
> 4) Executed in the Browser using following URL:
> http://127.0.0.1:7001/MyWorld
>
> But, I am getting this error:
>
> Error 404--Not Found
>
> Please let me know if the above procedure is wrong, then what are the
exact steps
> involved in Deploying a servlet in WebLogic Server.
>
> Thanks,
> Ram.
>
-
SIMPLEST servlet example please
Hi,
I was wondering if someone could post a java servlet example that accepts a string array (let's say we pass "A" and "B") and returns back a string array (let's say "1" and "2") without having to use a doGet or doPost. This would simply be passed as a value as one normally might, using a procedure or function.
Help on this is greatly appreciated. I am using this to access DB information, and already have the rest of the code finished, however I must implement this as a servlet.
Thanks...Hello lafnjack,
A servlet is a kind of plugin-class that is connected to a HTTP-server to handle HTTP requests by interpreting the request itself and generating the response.
Therefore, a servlet is called through methods that are in parallel to the HTTP requests GET, POST and in some cases the other variants. Having said this, it should be obvious that a servlet has no more options for functioning than implementing doGet/doPost etc functions.
Silvio Bierman -
How to deploy a servlet in EBS R11
I need to deploy a personal servlet in EBS R11, and I have no idea about where or how to do that.
Please can some one help me?
thinks a lotBrahim,
There is are some testing servlets used in 11i,
For testing purpose you can deploy your servlet in the following directory,
$COMMON_TOP/java/oracle/apps/fnd/test
The standard testing servlet can be accessed from
http://host:port/oa_servlets/oracle.apps.fnd.test.HelloWorldServlet
Thanks.
With Regards,
Kali.
OSSI. -
Problem when deploy my servlet
I have developed a simple servlet.
There are some code to do file operation in
my program. When I use JDeveloper to develop
and test, it works well. This is just because
the file it need just locates in the current
directory.
But after I deploying it, it can't access
that file any more. Now I just
wonder how could I tell it where to get
the file, just write the absolute file path,
or could I set some envirenment variables.
Platform: win2k server
Thanks
nullIt could be that you haven't set the classpath correctly in the runtime environment, or it could be that you didn't package all of the files you needed when you deployed your servlet.
The online documentation explains how to deploy a servlet. In JDev 3.1, you'll find this information under:
User Guides
-> Developing Applications
-> Developing Web Applications
-> Developing Java Servlets
-> Deploying Java Servlets
Blaise
Maybe you are looking for
-
Hi there folks... I am about to lose my freakin' mind. I have tried almost everything with no luck. I have a 4th gen 40gb. My iTunes refuses to recognize my iPod. I THINK my Windows is seeing it, as when I go into My Computer, I see E: Removable Disc
-
Can I make a photo clip longer than 4 seconds?
I want to leave more time to read the title I have going over a photo clip, so want to lengthen the clip more than 4 seconds. I tried copying and pasting the photo to make it 8 seconds long and the title dragging across the two, but 8 seconds is long
-
Alternative approaches for Portlet backing File
Hi All, What would be the best alternate approach if i need to replace all the portlet backing files? Thanks in Advance, Mohan
-
Collision Detections in Tilemaps
I need some help with collision detection with tilemaps. I have the following code for the tilemap: import java.awt.*; public class TileMap { final int EMPTY = 0; final int WALL = 1; private static final int WIDTH = 30; private st
-
Is there any process to retrieve DELETED DATA in any stage either PO,GR,IR
is there any process to retrieve DELETED DATA in any stage either PO,GR,IR >????