Invoking servlet at Click of a JButton.
I have a swing application running fine.I now want to introduce a functionality for opening a new popup window on the click of a JButton in my appln., similar to window.open() method in javascript.When I click a JButton , a servlet gets invoked, talks to the database and gives some results. I want these results to be displayed in the new popup window.
Thks.
if you have an applet then try this:
URL pageURL = null;
try {
pageURL = new URL("your servlet path");
} catch (Exception e) {
System.out.println(e);
return;
getAppletContext().showDocument(pageURL, "_blank");
for an application you need to retrieve the servlet result and display it in a HTML parser container.
Similar Messages
-
Invoking a second servlet when clicking submit in first servlet
I have 3 files Test.html, Test.java and Test1. java
Test and Test1 are servlets.
I am invoking servlet Test after submitiing from Test.html.
servlet Test displays a submit button. I want to invoke servlet Test1 when I click on submit button in Test. but it is showing and error the erro r is mentioned below.
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Cannot allocate servlet instance for path /examples/servlet/Test1
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:388)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at filters.ExampleFilter.doFilter(ExampleFilter.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at filters.ExampleFilter.doFilter(ExampleFilter.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
root cause
java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardWrapper can not access a member of class Test1 with modifiers ""
at sun.reflect.Reflection.ensureMemberAccess(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:856)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:621)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at filters.ExampleFilter.doFilter(ExampleFilter.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at filters.ExampleFilter.doFilter(ExampleFilter.java:102)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
Apache Tomcat/4.1.31
I am using Apache Tomcat/4.1.31 as web server. can you tell me what is the reason i am stuck with this problem and my tool development is halted because of this.
Can any one provide me solution for this. Also if have to make any changes in web.xml. please tell me what are the changes and in which folder can i find web.xml.How do we call a servlet directly from the browser rather calling it through a html file. I am using Tomcat 4.1 and all my servlet class files are stored under the path mentioned below:
C:\Program Files\Apache Group\Tomcat 4.1\webapps\examples\WEB-INF\classes\
my servelt name is "Test1". -
How can I invoke servlet from an <af:form> tag ?
Hi Zaro,
it depends what you'd like to do.
1. Put the result into the page: Use normal links, eg. <af:objectImage source="/graphservlet"/>2. Use it as a navigation step: edit your faces-config.xml
--olaf -
Hi all;
this is the process.
1. Servlet received / creates msg.
2. Servlet Enqueues Msg on JMS queue.
3. MDB dequeues.
-- processes against DB
-- composes respoonse.
4. mdb invokes servlet with response.
servlet need not maintain state.
State information can be passed in Msg (Query and Response)
I was just wanting to find out if this possible in oc4j.
apparently, there is a process in weblogic 6.1 to support this.
Any help is appreciated.
thanks.
jayantI would assume that you would need to do a "createSipApplicationSession" on your sip factory and then get the ID from there.
Then create a request from your session and send it.
Wouldn't you want each outgoing call to be associated with a different sip app session? -
How to configure IIS webserver with weblogic so that I can
invoke servlets without the .wlforward extension
As per the documentation iisforward.dll is registered as a filter and .wlforward
has also been
included as a special file type. However this requires me to key-in ".wlforward"
after my servlet name.
What I want is something like this
http://iis/MyServlet
Please help me find a solution to this
Thanks,
RishiI am able to invoke the servlet without the wlforward extension now.
However, now I am required to add /weblogic before the servlet
name otherwise it does not execute the pathtrim property.
I have tried with the pathprepend thing also.
Can we get rid of the /weblogic part also. I just want to execute
my servlet as http://iis/myServlet.
Your help in this regard is greatly appreciated...
Thanks..
"Rishi" <[email protected]> wrote:
>
Thanks for the reply Kumar.
I did follow the instructions as given in the Weblogic documentation
The documentation said to add iisforward.dll as a filter service
and register .wlforward as a special
file type to be handled by iisproxy.dll. For this,
while configuring the IIS server in the Home Directory tab
I added an extension ".wlforward" and the executable as
iisproxy.dll. Is this the way it should have been done...
I also modified the iisproxy.ini file as per the documentation.
I have added the WLForwardPath property and set it to /weblogic.
My server works fine when I give the url as
http://iis/myServlet.wlforward
but it does not work for
http://iis/myServlet and this is the way i'd want it to work.
Please tell me if I am missing something on the configuration part
and if there is something special that needs to be done. I shall
be grateful to you.
Kumar Allamraju <[email protected]> wrote:
http://e-docs.bea.com/wls/docs61/adminguide/isapi.html#101184
Rishi wrote:
How to configure IIS webserver with weblogic so that I can
invoke servlets without the .wlforward extension
As per the documentation iisforward.dll is registered as a filter
and
.wlforward
has also been
included as a special file type. However this requires me to key-in".wlforward"
after my servlet name.
What I want is something like this
http://iis/MyServlet
Please help me find a solution to this
Thanks,
Rishi -
Re: How do I invoke Servlets...continued
Hi Howard,
Could you show us web.xml?
Regards,
Slava Imeshev
"Howard Hyde" <[email protected]> wrote in message
news:3ccedf8a$[email protected]..
> My posting appears to have been truncated, so here is the remainder:
> (continued)
> 'Pilot' is a servlet defined and mapped in my web.xml file. But when I
attempt
> to invoke the servlet in the app with any of the following:
> http://localhost:7001/pilots/Pilot
> http://localhost:7001/pilots/pilot
> http://localhost:7001/pilots/servlet/Pilot
> http://localhost:7001/pilots/servlet/pilot
>
> ... I get a 404 error.
>
> However, the following JSP, which is part of the same web application
component
> of the Enterprise app, works:
> http://localhost:7001/pilots/Rating.jsp
>
> So the question of the day once again, is:
>
> How do I invoke servlets in an enterprise application?
>
> Best regards,
>
> Howard
> 818-366-2686
and to add to matt's post:
in the servlet init() method trace out some debug to ensure that new
versions of your servlet are actually being deployed:
..init() {
System.out.println( getServletName() + " was deployed at " + " new
Date(System.currentTimeMillis()) );
"Matt Krevs" <[email protected]> wrote in message
news:[email protected]...
> 1. What stack trace do you receive, if any, when your call to your servlet
> doesnt work
>
> 2. Is your servlet in a package? If it is then you need to specify the
> package in the servlet-class element
>
> 3. Is it possible that your servlet-name and/or servlet-class elements in
> web.xml have some spaces in them? Maybe you should remove the line feeds
> etc. and specify your servlet elements as you have your servlet-mapping
> elements
>
> eg like this
>
> <servlet>
> <servlet-name>Pilot</servlet-name>
> <servlet-class>FrmPilot2</servlet-class>
> <load-on-startup>0</load-on-startup>
> </servlet>
>
> 4. Do you get any deployment errors when weblogic starts up?
>
> 5. Try setting the load-on-startup parameter to a positive number. You may
> receive a helpful? stacktrace when weblogic starts up
>
>
> "Howard Hyde" <[email protected]> wrote in message
> news:[email protected]...
> > The following are EXCERPTS from the web.xml file:
> >
> > <web-app>
> > <servlet>
> > <servlet-name>
> > Pilot
> > </servlet-name>
> > <servlet-class>
> > FrmPilot2
> > </servlet-class>
> > <load-on-startup>
> > 0
> > </load-on-startup>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>Pilot</servlet-name>
> > <url-pattern>/Pilot</url-pattern>
> > </servlet-mapping>
> >
> > </web-app>
> >
> >
>
>
-
How do I invoke Servlets...continued
My posting appears to have been truncated, so here is the remainder:
(continued)
'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
to invoke the servlet in the app with any of the following:
http://localhost:7001/pilots/Pilot
http://localhost:7001/pilots/pilot
http://localhost:7001/pilots/servlet/Pilot
http://localhost:7001/pilots/servlet/pilot
... I get a 404 error.
However, the following JSP, which is part of the same web application component
of the Enterprise app, works:
http://localhost:7001/pilots/Rating.jsp
So the question of the day once again, is:
How do I invoke servlets in an enterprise application?
Best regards,
Howard
818-366-2686
My posting appears to have been truncated, so here is the remainder:
(continued)
'Pilot' is a servlet defined and mapped in my web.xml file. But when I attempt
to invoke the servlet in the app with any of the following:
http://localhost:7001/pilots/Pilot
http://localhost:7001/pilots/pilot
http://localhost:7001/pilots/servlet/Pilot
http://localhost:7001/pilots/servlet/pilot
... I get a 404 error.
However, the following JSP, which is part of the same web application component
of the Enterprise app, works:
http://localhost:7001/pilots/Rating.jsp
So the question of the day once again, is:
How do I invoke servlets in an enterprise application?
Best regards,
Howard
818-366-2686
-
Hi,
I am interested in knowing why we should avoid invoker servlets?
what are short comings of invoker servlet?
( Yes for invoker servlets completer path up to servlet is to be given)
ThanksThe Invoker servlet is a built int servlet mapped such that allows you to invoke any servlet by using the URL: /servletPackage/servletClassName. While this is good to get started and to know, you should never use it in a production environment.
If you give password protected access to a folder, say Employees and map a servlet to /Employees/MyServlet, the servlet is also protected. Only people with the authorized username/password combinations can run the servlet. But if you allow the default mapping with the Invoker servlet, then the same servlet will also be accessible to everyone as /servlet/MyServlet in which case your authorization fails and everyone has access to your servlet's functionality, potentially modifying data etc.
This is only the authorization aspect. Other than this, the Invoker servlet makes it hard for you to hide your actual package/ classnames. Other features like init parameters and filters are also not possible in this case.
This is why you should NOT use the Invoker servlet. Even the Tomcat FAQ says you should not.
Read more here:
[1] http://faq.javaranch.com/view?InvokerServlet
[2] http://jakarta.apache.org/tomcat/faq/misc.html#evil
P.S. a_joseph also had a valid point and he gave you the same link also.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://www.catb.org/~esr/faqs/smart-questions.html
---------------------------------------------------------------- -
I want clicking sound on JButton, so that when it is clicked a sound will be heared (Just like in web sites)
Some body please help...
Thanks & Regards.
Salman Pirzada.Add an ActionListener to your button to play a sound. Take a look at the Java [url http://java.sun.com/docs/books/tutorial/]Sound tutorial.
-
Invoke servlet with javascript
Hello.
I need to invoke a servlet with javascript when the user clicks a button.
Is there a way to invoke the servlet without submitting the page ?
Thanks in advance.onchange="location.replace('ServletName');"
-
[b]Run time error in Invoking Servlet to J2ME tool kit[/b]
I am tried to invoke a servlet to my J2ME tool kit.
invoking will happen when user press command button on
the mobile phone, but when i do this there were run
time error called
"Warning: To avoid potential deadlock, operations that
may block, such asnetworking, should be performed in a
different thread than the commandAction() handler."
There are no compile errors and also i am using Jrun
webserver.
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ServletInvoke extends MIDlet implements CommandListener
String url="http://localhost:8100/servlet/HelloServlet";
private Display dis;
private Command cmd;
private Form frm;
public ServletInvoke()
dis=Display.getDisplay(this);
public void startApp()
frm=new Form("My Project");
cmd=new Command("Click",Command.SCREEN,2);
frm.addCommand(cmd);
frm.setCommandListener(this);
dis.setCurrent(frm);
public void pauseApp()
public void destroyApp(boolean unconditional)
void invokeServlet(String url)throws IOException
HttpConnection c=null;
InputStream is=null;
StringBuffer b=new StringBuffer ();
TextBox t=null;
try
c=(HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("IF-Modified-Since","20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("Content-Language","en-CA");
is=c.openDataInputStream();
int ch;
while((ch=is.read())!=-1)
b.append((char)ch);
t=new TextBox("First Servlet",b.toString(),1024,0);
finally
if(is!=null)
is.close();
if(is!=null)
c.close();
dis.setCurrent(t);
public void commandAction(Command command,Displayable dis)
if(command==cmd)
try
invokeServlet(url);
catch(IOException e)
System.out.println("IOException"+e);
//e.printStacktrace();
}PLS if can give me a working sample code as a soluation to above problem.import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ServletInvoke extends MIDlet implements CommandListener
String url="http://localhost:8100/servlet/HelloServlet";
private Display dis;
private Command cmd;
private Form frm;
public ServletInvoke()
dis=Display.getDisplay(this);
public void startApp()
frm=new Form("My Project");
cmd=new Command("Click",Command.SCREEN,2);
frm.addCommand(cmd);
frm.setCommandListener(this);
dis.setCurrent(frm);
public void pauseApp()
public void destroyApp(boolean unconditional)
public void commandAction(Command command,Displayable dis)
if(command==cmd)
try
HTTPConnection conn = new HTTPConnection();
conn.invokeServlet(url);
catch(IOException e)
System.out.println("IOException"+e);
//e.printStacktrace();
class HTTPConnection extends Thread
String url = null;
HTTPConnection()
void invokeServlet(String url)
this.url = url;
start();
public void run()
HttpConnection c=null;
InputStream is=null;
StringBuffer b=new StringBuffer ();
TextBox t=null;
try
c=(HttpConnection)Connector.open(url);
c.setRequestMethod(HttpConnection.GET);
c.setRequestProperty("IF-Modified-Since","20 Jan 2001 16:19:14 GMT");
c.setRequestProperty("Content-Language","en-CA");
is=c.openDataInputStream();
int ch;
while((ch=is.read())!=-1)
b.append((char)ch);
t=new TextBox("First Servlet",b.toString(),1024,0);
finally
if(is!=null)
is.close();
if(is!=null)
c.close();
dis.setCurrent(t);
} -
404 error while invoking servlet in weblogic 6.0
Hi,
When I try to invoke a servlet from weblogic 6.0, I am getting
404 error. I have copied the HelloWorldServlet class into defaultWebAppl_Server/WEB_INF/CLASSES
directory and when I invoke the HelloWorldservlet, its giving file
not found(404) error. I am doing exactly what has been given in
the "quick start to servlets" in weblogic 6.0. I am using Windows
NT.
I have also another problem when I use java utils.dbping to test
the connection to my oracle8.1.8, its giving licence file not found.
Could some one help me out from this.
Thanks in advance,
Ramu
Hi kumar,
I have been keep trying to solve that. After some time Suddenly
"Error 404" disappeared and instead "Error 500" came. Okay kumar,
here is what I am doing...
I have installed weblogic6.0(eval), oracle 8.1.6 on Windows NT4.0.
I have installed oracle Enterprise edition from CD "ORACLE 8.1.6
for NT".
I installed the weblogic under D: drive.
I did class path settings as given in documentation. But Iam not
sure whether I need to do any other class path settings.
I was able to run pet store application given in weblogic server.
I went to "quick start" section and ran HelloWorld.jsp page from
"DefaultWebApp_myServer" directory.
I was not able to run servlet program as per given in the "quick
start". I am getting
"Error 500---Internal server error"
The server encountered an unexpected condition which prevented
it from fulfilling the request"
I have modified the web.xml under WEB-INF of DefaultWebApp_myServer
as per given in the quick start.
Here is the quick start link For you reference(as what I talking
about)
http://edocs.beasys.com/wls/docs60/quickstart/quick_start.html
In the web.xml, I have given <servlet-class> as just HelloWorldServlet,
since I directly copied the file from some other examples directory.
But still I am getting 500 error.
Here is the url that I am invoking...Http://ramup:7001/quickStartServlet
Coming to your oracle connection test, I did exactly what you said.
kumar, I have executed the command
"D:\bea\wlserver6.0\config\mydomain>java -classpath %classpath%;D:\bea
utils.dbping ORACLE
>scott tiger TestDB"
Where TestDB is the database that I have created while installing,
but I am not aware of the instance you said.
Here is what I got after executing the command.
--------*******-------Pasting the ms-dos command results----**-
// This mode is superior, especially in serverside classes because
// it avoids DriverManager calls are class synchronized, and will
// bottleneck any other JDBC in the server, even already-running
// connections, because all JDBC drivers use DriverManager.println()
// to log info and exceptions, and that call is also class synchronized.
// For repeated connecting, a single driver instance can be re-used.
**** or ****
Class.forName("weblogic.jdbc.oci.Driver").newInstance();
java.sql.Connection conn =
DriverManager.getConnection("jdbc:weblogic:oracle:TestDB", "scott",
"tiger")
**** or ****
java.util.Properties props = new java.util.Properties();
props.put("user", "scott");
props.put("password", "tiger");
props.put("server", "TestDB");
Class.forName("weblogic.jdbc.oci.Driver").newInstance();
java.sql.Connection conn =
DriverManager.getConnection("jdbc:weblogic:oracle", props);
D:\bea\wlserver6.0\config\mydomain>
--------*******-------Pasting the ms-dos command results----**-
I think I have connection to database, thanks for your suggestion.
Kumar, I have not seen weblogic.properties file any where in D:\bea
directory.
Kumar, if you have some time can you jot down the classpath settings
and path settings for executing SERVLETS/EJB programs.
Thanks for helping me out..,
Ramu
Kumar Allamraju <[email protected]> wrote:
>Assuming you registered the helloworld servlet in web.xml,
>could you show me the url
>that you typed in the browser window? :)
>
>
>Regarding the dbping problem, make sure license.bea is
>in the classpath
>
>ie.. java -classpath %classpath%;D:\bea utils.dbping ORACLE
>scott tiger [instance-name]
>
>PS: I'm assuming WLS is installed in D:\bea directory.
>
>--
>Kumar
>
>
>Ramu wrote:
>
>> Hi,
>>
>> When I try to invoke a servlet from weblogic 6.0, I
>am getting
>> 404 error. I have copied the HelloWorldServlet class
>into defaultWebAppl_Server/WEB_INF/CLASSES
>> directory and when I invoke the HelloWorldservlet, its
>giving file
>> not found(404) error. I am doing exactly what has been
>given in
>> the "quick start to servlets" in weblogic 6.0. I am
>using Windows
>> NT.
>>
>> I have also another problem when I use java utils.dbping
>to test
>> the connection to my oracle8.1.8, its giving licence
>file not found.
>>
>> Could some one help me out from this.
>>
>> Thanks in advance,
>> Ramu
>
-
Error 404 invoking servlet in tomcat
OK Im new in this and I have searched the forums and do most of the answers but I cant make my servlet to work. So here is how I have my structure
MEDEX \ WEB-INF -> all JSP files
MEDEX \ WEB-INF \ classes -> all CLASS files
MEDEX \ WEB-INF \ servlet -> SERVLET CLASS FILE
I have a page called index.jsp that invokes the servlet by a form like this:
<form name="form1" method="post" action="http:\\localhost:80\Medex\WEB-INF\servlet">
this is what I have in my web.xml
<display-name>Servlet SvMedex</display-name>
<servlet>
<servlet-name>SvMedex</servlet-name>
<servlet-class>SvMedex</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SvMedex</servlet-name>
<url-pattern>http:\\localhost:80\Medex\WEB-INF\servlet</url-pattern>
</servlet-mapping>
<-- <resource-ref>
<res-ref-name>http:\\localhost:80\Medex\WEB-INF\bd</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-->
</web-app>
I dont have a server.xml since I edited the server.xml in tomcat/conf to evoke anonimous servlets... that will be while I test
PLease IM DESPERATE ! any help is really appreciated.<url-pattern>http:\\localhost:80\Medex\WEB-INF\servle
t</url-pattern>URL patterns are specified relative to the webapp. If you use a url-pattern of /SvMedex, your servlet will be available at http://localhost:80/Medex/SvMedex -
Error in invoking servlet from JSP
Hi - again!
after being thoroughly reprimanded for posting on the wrong board, and hence seeing the error in my ways, all help greatly appreciated....
I have read elsewhere that it is possible to call a servlet (which produces HTML) from within a JSP, thus keeping a nice clean MVC paradigm and making it easier for non-java people to design the front-end.
I am having difficulty getting it to work and any help is much appreciated:
My servlet (Mole):
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.write("###some html stored in DB#####");
} finally {
out.close();
}my JSP:
<jsp:include page="Mole" flush="false"></jsp:include>the error I get
Internal error flushing the buffer in release()
StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.io.IOException: Stream closed
at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:257)
at org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:206)
at org.apache.jsp.CMS.services_jsp._jspService(services_jsp.java from :176)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)Any pointer as to what I am donig wrong?
many thanks
Hin your web.xml
<servlet>
<servlet-name>Mole</servlet-name>
<servlet-class>srvlt.Mole</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Mole</servlet-name>
<url-pattern>/Mole</url-pattern>
</servlet-mapping>
package srvlt;
// Import servlet packages
import javax.servlet.*;
import javax.servlet.http.*;
// Import other Java packages
import java.io.*;
public class Mole extends HttpServlet {
public void init() throws ServletException {}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
out.write("###some html stored in DB#####");
} finally {
out.close();
}in your jsp
<jsp:include page="/Mole" flush="false"></jsp:include> -
Unable to invoke Servlet Directly in address bar in Weblogic10.3
Hi,
I am trying to invoke the servlet directly in the address bar as below
http://localhost:7004/servlet/loginToApp
but It's giving me following error :
Error 404--Not Found
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.4.5 404 Not Found
The server has not found anything matching the Request-URI...................
but the same servlet is getting invoked when I use it in jsp form submit
<html>
<body>
<form method="post" action = "http://localhost:7004/servlet/loginToApp">
<input type="submit"/>
</form>
</body>
</html>
in web.xml I have
<servlet>
<servlet-name>loginToApp</servlet-name>
<display-name>loginToApp</display-name>
<description></description>
<servlet-class>abc.Common.ClientBeans.LoginToApp</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>loginToApp</servlet-name>
<url-pattern>/servlet/loginToApp</url-pattern>
</servlet-mapping>
This works fine on Weblogic 8.3.
Please Help here.Hard to tell exactly.
I note that your JSP page does a "POST" submit, whereas when you enter the direct URL of the servlet on the address bar, it'll result in a "GET" request.
<form method="post" action = "http://localhost:7004/servlet/loginToApp">
I don't know what error WLS will return if the servlet can't handle a GET, but it may be something to look at.
Do you have a doGet() method in your servlet code?
-steve-
Maybe you are looking for
-
How can I clone my old macbook to my new Macbook Pro 768GB SSD
Hi, I have a 2 year old macbook and have just received my new Macbook Pro Retina dispaly with a 768gb SSD. How can I clone my old drive to my new Macbook as the unit is sealed so I cant ge the drive out. thanks.
-
DISM restorehealth error 14098
We have a windows server 2012 box that is hosted remotely. I've been trying to install a security patch and the windows update component appears to be corrupted. The error code i'm getting is 80073712. It will download the updates but fails to instal
-
ITUNES 7 BUG NO ARTWORK IN IPOD
NO ARTWORK TRANSFERED TO UPDATED 5TH GEN IPOD = I updated to iTunes 7 twice (first time it erased my purchased item authorization). For second install I successfully updated the iPod firmware. PROBLEM now is it will not transfer the song artwork. TRI
-
Messages in mail not displaying properly
Hi folks, I'm experiencing a problem periodically with MacMail (V. 2.1.3) on my ibook G4 (OS X.4.11). Every so often (seems more frequently of late) I'll get a message and read it perhaps on my desktop at work or in my home office. I'll go to answer
-
The problem about factory unlocked
ATT has free factory unlocked 4S, whether the user contracts to did not expire, but the user contracts expire automatically unlock. When Verizon companies began to factory unlocked?