Webservice storing and JSP reading
Hi Folks,
I have a EJB turned into a webservice and deployed in Weblogic 8.1. Now when this webservice is invoked, I want to show the received message in a browser. What I want to do is write a java class with 'setmessage' and 'getmessage' methods. Then I would use setmessage method to set the received message. My JSP then would ping the variable every 10 sec or so and show it in the browser. Is this feasible?
I tried creating an EAR with EJBJAR and WAR and a COMMON.jar which had the java class. It worked.
But with EJB turning into a webserivce...(using servicegen), it automatically creates a EAR, with the web-services.war coming in.
I tried to include the common.jar and my war in the generated EAR, but then the JSP/servlet in the war AND the ejb-jar doesnt seem to know anything abt the java class in the common.jar
Any clues, other ways to do this?
This code
Map<Integer, Object> readMap = Collections.synchronizedMap(new TreeMap<Integer, Object>());
//read from input stream
readMap = input.readObject();Should be
Map<Integer, Object> readMap = (Map<Integer, Object>)input.readObject();
Similar Messages
-
Hi Folks,
I have been stuck with this issue for quite sometime now. I have developed a simple webservice using a java class. It looks something like this..
public class ReceiveMessageClass{
public void receiveMessage(String msg){
logIt(msg);
//Store 'msg' in a memory variable so that the JSP can ping it every 10 sec and read it..
}Now, I need a webpage to look at all the messages I recieve at this webservice. Sounds pretty easy? I have done this with Axis. I can create a WAR and my webservice and my JSP can co-exist and share a variable in memory. But with weblogic, a EAR is created and I am not sure how to get my JSP into the EAR. I am not sure how I can store this 'msg' into memory(some static vbl) and then have my JSP read it and display it.
Any suggestions?I do not see any weblogic classes in the stack trace. So could this
be something to do with tomcat?
If you are just using the client side of the web services stack, you
only need the Client.jar and webserviceclient.jar file in your war.
Regards,
-manoj.
http://manojc.com
"Stephen Zeng" <[email protected]> wrote in message
news:3ef1d72c$[email protected]..
>
I have packed Client.jar, weblogic.jar, webservices.jar and jsp as aseperated
war to call web sevice and run sucessfully in WLS7.0. But when I ran inTomcat
4.0.1, I got the following error. I try set javax.xml.rpc.ServiceFactoryas context
param in web.xml, but no use. <p>
java.lang.ClassCastException <br>
atjavax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.
java:93)<br>
atorg.apache.jasper.parser.ParserUtils.parseXMLDocument(ParserUtils.java:183)<
br>
atorg.apache.jasper.compiler.TldLocationsCache.processWebDotXml(TldLocationsCa
che.java:165)<br>
atorg.apache.jasper.compiler.TldLocationsCache.(TldLocationsCache.java:138)
atorg.apache.jasper.EmbededServletOptions.(EmbededServletOptions.java:324)
at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:266)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:852)
atorg.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
atorg.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
atorg.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
Stephen -
User Authentication using Servlet and JSp
Hi,
I am developing a web app where i need to implement user Authentication to allow members to view and upload files on a certain directory say /data
For this i am using a servlet as a controller which then forwads request to other jsps/servlets based on user response. I tried using servlet mapping in web.xml so that all browser requests would be directed to controller servlet and would branch from there on. However the problem all RequestDispatcher.forward() requests redirected to the servlet putting it in a loop.
Is there another way to achieve this. (Apart from using form-based Basic Authentication).
I am using Resin 1.2.8 servlet/jsp container.
Any response as soon as possible would be appreciated.
Thanks,
KushagraRequestDispatcher.forward() cause the HTTP request to be sent through the request processing flow as if the original request for the resource being forwarded to.
It seems the servlet mapping you are talking about in web.xml should be made more specific. i.e. the mapping should be such that only your so called controller servlet will match up.
You might want to specify the mapping for the controller servlet to be noticeably/effectively different from the mapping for other servlets and JSPs. -
Consume Axis2 webservice in a JSP using Tomcat
Hey,
I desperately try to consume a Netbeans created Axis2 web service in a jsp.
i am able to consume the web service in a Java test class as well as in j2me using the created stubs from WTK.
But now I would like to consume the webservice in a jsp.
First i tried to use the netbeans client generator (which does work out in a regular test class), As soon as i try to invoke the webservice in the jsp, i get an exception (i currently don't have access to the exact message, i will append that asap) . It stated, my part tag needed a type value (currently there's an element attribute included as i am using document style). I tried the same using a hello world class generated by netbeans using netbeans stubs...same error.
Then I switched to java2wsdl, when using those stubs, i got another exception "axis2 webservice could not be generated".
Then i tried using a soap call with the axis service class for preventing auto generated stubs. all of the 3 ways did work out in a java test class.
But now i get the following exception:
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.apache.commons.logging.LogFactory
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.test_jsp._jspService(test_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803).
The thing is: i did include the common-logging.jar in the project lib and it seems to work out smoothly when compiling. but at runtime i always get the same exception.
i also put the library in the tomcat lib folder (after that in the lib/common folder) - same result. i tried downloading a new jar. still no changes (all of those folder arse included in my classpath).
then i included the logging jar in my java/lib/ext folder.
After that a new jar was missing (mail.jar). but my axis2 engine doesn't run anymore (apparently some conflict with other libraries).
Now i dunno what to do anymore. even the simpelst hrllo world web service doesn't work in jsp.
If i tried to invoke non axis2 webservices in a jsp - it does work out. but that's not an option for meThere is a folder for shared packages
tomcat_root\lib; or
tomcat_root\common
also most versions have a lib or common folder for each webapp for packages that are not to be shared.
tomcat_root\webapps\appname\web-inf\lib
Agreed that it is strange to allow servlets to import from the classes foler but not JSPs. It should make no difference but it is convension to place single classes in the same folder as the app's directory and packages (especially jar's) in the lib directory. -
How can i use JAVA BEAN and JSP?
well, i have developed all my web apps by using pure JSP only, i know this sucks, but i dont know how to start on using beans... what directory should i put them into... etc... what are the good programminmg practices/standards/techniques when incorporating beans in jsp???
Standards are pretty loose, but generally, Beans hold a lot of the backend logic for your JSP. This can include data validation before entering into the database, database inserts, queries, data manipulation. The JSP should really only contain code that will retrieve the data from the bean and appropriately output it.
As far as using them, you can use the <jsp:useBean> tag in your JSP. As long as the bean is stored somewhere that your classpath points to, you're all set. From then on, you can use it like any other object in your JSP. -
Problem with storing and retriving a different langauge font in mysql
hi,
i have problem with storing and retriving a different character set in
mysql database ( for example storing kannada font text in database)
it simply store what ever typed in JTextField in database in the
formate ??????????? and it showing ???????? .
please what can i do this problem.
thanks
dayaMySQL does not know about what type of Font you use or store. that is applicatioon specific. All it knows is the character set that you are storing and the data type and data. THere are something you should know when working with database and Java:
1. make sure you know what character set is used for the database table.
2. make sure you know what character set is used by Java (default to UTF-8 ..
sort off - there are few character that it cannot save). You can enforce the
character set being sent to the database by the String's getBytes(String charsetName) method.
3. make sure the application you use to view the table use the correct character set
if it use a different character set, then any character that it does not recogized
will be replaced with a quetion mark '?'....eventhough the data is correct. -
Ideas pls for a small application on java and jsp?
hi ,
I would like to create an application which for resume. I would like to codify the java code . The java code should be able to autogenerate jsp file's since the output of the resume would be on an jsp page. To add it simply a wizard for dynamic resume creation using java swings and jsp. Code for jsp should be autogenerated please note it.
Ideas please!
Thanks in advanceI'd like to add more information to Patreck's suggestion.
JSP pages are wonderful if you need the web server to perform some actions before sending you the final web page.
Here, you don't need the web server to do anything because your Swing application can do it for you. As Patreck implies, Swing can make a connection to the database, retrieve any information you want, perform whatever logic you need, and write the output to an HTML file.
To give you an example, you can use Internet Explorer to view a basic web page on your hard disk. You can also use Microsoft Word to view the same basic web page. They both do the same task and there is no need to force IE to use its Word plug-in in order to view the web page.
JSPs are not necessary because Swing will do all of the work for you. You only need JSPs if you want people to use your program through a web browser because they can't do Swing inside a web browser. You should only use one or the other, not both. Understand now?
If you really really must generate JSP code from a Swing application, then just write out the JSP stuff in the file. For example...
public void createWebPage( Printwriter pw, String myName ) {
pw.println( "<% String myJSPName = \"" + myName + "\" %>" );
pw.println( "<HTML>");
pw.println( "<HEAD>");
pw.println( "<TITLE>My Resume</TITLE>" );
pw.println( "</HEAD>");
pw.println( "<BODY>" );
pw.println( "<H1>My name is " + myName + " and my JSP name is <%= myJSPName %></H1>" );
pw.println( "</BODY>" );
pw.println( "</HTML>" );
}As you can see, it's pointless to embed JSP when you can do all the programming within Swing first and just write out the correct response. -
iPod will not play any music. Seems like it is in “Pause” mode. No sound from either the head phones or internal speaker. I have 418 songs stored and none will play. I have tried resetting, turning on and off the iPod, etc. but to no avail.
Try restoring from backup. Next would be a restore to factory defaults/new iPod.
-
Hi frnds i want to help in servlet,java bean and JSP
hi friends i'm right now in M.SC(IT) and i want to do project in SERVLET,,JAVA BEANS and JSP ,
so pls give me a title about that
NOTE: I develop a project in group(2 persons there)
my email id is : [email protected] , [email protected] , [email protected]You cannot pair your iPod to a cell phone, so forget about it.
The only way you can get free WiFi is to hang out at a Denny's, a Starbucks, or a truck stop, and I don't think your parents would approve.... -
Carousel don't show images, only the page name and a "read more" link
Good morning.
I'm trying to get a carousel in my page. I already set a image to one page and on my carousel component, I selected that page.
When I see the carousel, it shows me the page inputed name and a "read more" link instead of the image.
Can anyone tell me what's wrong or missed?
Heres a print screen:
Thanks.What did I do to correct this problem:
When I create a page renderer component, the same automatically creates a jsp file, with the same name as the component. In my Geometrixx copy sites, there's always a "content.jsp" file in the components, despite of the one with the same name of the component. So, instead of build my pages in the componentname.jsp, i'm doing this is these content.jsp. Just doing this, the carroussel works perfectly. For sure is something that I miss in my own jsp files, but even with the same code (copy > paste), in my jsp the carroussel don't work. Anyway, now I can use it. -
After I have downloaded Acrobat Professional 9.0 updates and Acrobat Reader 9 updates, both update installations fail.
Acrobat Reader 9 problems
I thought that there could be a conflict between Acrobat Reader 9, which I have also installed, and Acrobat Professional 9.0, so I tried to remove Acrobat Reader 9, but the patch package could not be found. I then ran the Windows Install Cleanup tool, but Acrobat Reader 9 is still on my system. I now cannot reinstall it, nor can I really remove it
I’d like to remove Acrobat Reader 9 entirely because I already have Acrobat Professional 9.0, but how?
Acrobat Professional 9.0 problems
When I try to remove Acrobat Professional 9.0 in order to re-install it from disk, I get the message that the patch package could not be found. When I insert the disk to try to repair Acrobat Professional 9.0, I get the message that the patch package could not be opened. When I try to use the Repair Acrobat Installation option in the Help menu of the program, nothing happens.
I’m hesitant to run the Windows Install Cleanup tool on Acrobat Professional 9.0 because of the problems I got with Acrobat Reader 9 after running the Windows Install Cleanup tool.
How can I re-install Acrobat Professional 9.0 from disk?Amanda,
As Van says, yes you can have both seleced at the same time. I suspect there are other issues on your machine that are creating your problems. FWIW, I too have been running FM9 on a win7 64-bit platform with no issues.
The Roaming Profile is used typicaly with remote logins across a WAN (wide area network), however, application specific gets stored there - depending upon the application. Since you've seemed to have resolved the issue by deleting (or disabling the profile, i.e. the apps won't look there) the Roaming profile folder, it sounds like there might have been something corrupt or erroneous in the Acrobat data folders. When you installed your FM versions, did you deselect the accompanying PDFcreator option? If not and you had an existing Acrobat installation, then some items would have been overwritten, creating some issues for you. -
Creating FOrums with Servlet and JSP
Hi everyone,
Is there a good resource that explains how to build a forum using servlets and JSP technology?
Regards,
Basil Mahdiplease let me know here if you find any useful resources...I am in the process of writing my own searchable threaded forum for my company with JSP's/servlets. It's a very slow process at the moment though...if I ever finish it, I'll gladly share it.
-
How to master good design with EJB and JSP?
I use JSP to calling EJB. But the .jsp file is complex and it's difficult to maintain...I just want to work higher efficent with EJB,JSP and JavaBean. I want to know is there a good design with EJB and JSP? and is there any good material about MVC for EJB,JSP and JavaBean?
You should read the J2EE blueprint available on this website. Better download the PDF, and print it for yourself so you can read it anytime.
-
WL vs. WL-express and JSP vs. javascript/SQL
folks-
i am trying to convince a certain party to
disband a web-based job tracking system being
written in ASP, javascript, html, css and SQL.
it will be hosted on MS webserver running NT.
i am trying to convince them to use JSP and
WL express. i have done two years of EJB
component work on weblogic, however, i have not
done work with JSP or thin-clients. i was mostly
business-logic.
anyway i have some questions and need some
direction. i already know JSP is better than
ASP/javascript etc. because:
* ASP is proprietary. ditto for VBscript
* with an IDE creating JSP is easy and JSP
automatically creates servlets which is way
faster than by hand
* JSP is JAVA based and hence benefits from
all the portability pluses of JAVA
but here are the more difficult questions:
* why is WL express better than an MS
web server? (not including WL market share
and size. after all MS can claim that)
* since WL express does not have an EJB
container, how do you access the database?
via JDBC? does one just have JDBC code
floating around?
* since there is no EJB container how does
one separate presentation from logic from
data access? this is a major downside of
javascript, html, css and SQL etc.
* if a web app grows beyond JSP with WL express
into the need for an EJB container, i would
think that most of the app needs to re-written
as business-logic must be refactored into EJBs
and all JDBC code will be replaced by container
managed beans. this sounds a like a lot of
rework.
* isn't JSP slower than javascript as the
servlet and hmtl code is bounced back and
force across the network?
with respect to architecture, scalability,
and robustness what are the downsides to an
MS webserver and non-JSP coding?* since WL express does not have an EJB
container, how do you access the database?
via JDBC? does one just have JDBC code
floating around?
Use JDO or an OR-mapper or embed JDBC into your own data access classes.
* since there is no EJB container how does
one separate presentation from logic from
data access? this is a major downside of
javascript, html, css and SQL etc.
Presentation=JSP
Logic=Servlet
Data access=JDO or similar
* if a web app grows beyond JSP with WL express
into the need for an EJB container, i would
think that most of the app needs to re-written
as business-logic must be refactored into EJBs
and all JDBC code will be replaced by container
managed beans. this sounds a like a lot of
rework.
You should be able to tell up front if it a tx-intensive app that requires
WLS.
* isn't JSP slower than javascript as the
servlet and hmtl code is bounced back and
force across the network?
They aren't exclusive. For dynamic pages, use Javascript on the front end,
JSP on the back.
* with respect to architecture, scalability,
and robustness what are the downsides to an
MS webserver and non-JSP coding?
In the real world, and for most apps, while Java has the architectural edge,
they both have similar scalability and similar robustness. MS gives you no
choice though, and you rewrite every time they see a new buzzword. You can't
leave MS-land without abandoning almost everything. You can leave WLS in a
week if you have to.
It's an investment. Invest wisely.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"shane miller" <[email protected]> wrote in message
news:[email protected]...
folks-
i am trying to convince a certain party to
disband a web-based job tracking system being
written in ASP, javascript, html, css and SQL.
it will be hosted on MS webserver running NT.
i am trying to convince them to use JSP and
WL express. i have done two years of EJB
component work on weblogic, however, i have not
done work with JSP or thin-clients. i was mostly
business-logic.
anyway i have some questions and need some
direction. i already know JSP is better than
ASP/javascript etc. because:
* ASP is proprietary. ditto for VBscript
* with an IDE creating JSP is easy and JSP
automatically creates servlets which is way
faster than by hand
* JSP is JAVA based and hence benefits from
all the portability pluses of JAVA
but here are the more difficult questions:
* why is WL express better than an MS
web server? (not including WL market share
and size. after all MS can claim that)
* since WL express does not have an EJB
container, how do you access the database?
via JDBC? does one just have JDBC code
floating around?
* since there is no EJB container how does
one separate presentation from logic from
data access? this is a major downside of
javascript, html, css and SQL etc.
* if a web app grows beyond JSP with WL express
into the need for an EJB container, i would
think that most of the app needs to re-written
as business-logic must be refactored into EJBs
and all JDBC code will be replaced by container
managed beans. this sounds a like a lot of
rework.
* isn't JSP slower than javascript as the
servlet and hmtl code is bounced back and
force across the network?
with respect to architecture, scalability,
and robustness what are the downsides to an
MS webserver and non-JSP coding? -
I'm developing web application with OAS
4.0.8.1 and JDeveloper 3.0 and I want to call
JSP from servlet using "RequestDispatcher".
I downloaded JSP for OAS from www.olab.com.
In the Release note, there is a description
about RequestDispatcher, but I cannot
understand about details.
In what configuration can I use servlet and
JSP together with RequestDispatcher. Anyone
scceeded about that?
nullwan (guest) wrote:
: Hi everyone,
: I am using OAS 4.0.8 on Solaris 2.6. After viewing servlet
: and JSP samples, I am kind of confuse whether OAS supports the
: following options
: 1. JSP
: 2. servlet chaining
: 3. running JDeveloper DB Servlet wizard
: (oracle.jdeveloper.servlet.*) and Java Business Objects
: (oracle.jbo.rt.cs)
: Thank you for your time.
I found a white paper 408newfead.pdf, that says under "Future
Directions" that it will add jsp support. I read somewhere (I
can't remember where exactly :( ) that said 4.0.8.1 would
support
JSPs. I don't know if this release is out yet.
I wish Oracle would get with the times and put out a product that
is consistent with the technology they are touting as the
future.
Having us download Suns server to run servlets and JSP is
ridiculous for the worlds second largest software company!
null
Maybe you are looking for
-
Ipod updater 2006-06-28 problems
is anyone else having problems with playing their purchased songs after they update their nano to 2006-06-28? Mine would just shut off when i try to play one. so, i just restored it back to the previous updater and it works fine now. Anyone?
-
How to see the list of Negative wagetypes in a SAP system
Hi I want to see the list of all wagetypes where the user enters negative number, Is there any standard report or Table where can i find these, please provide the path. please help Regards Sangitha
-
Problem associated with Command Line arguments
hi , I am not able to pass a file path as command line argument in java. Actually i want to run a java program from the command prompt passing a file path . Something like this i tried to do , but its not working. D:\VISHAL\src> java CopyFile C:\Docu
-
IPhoto 08 support raw files from the Canon S90?
Does iPhoto 08 v7.1.5 support raw conversion, and raw files taken with a Canon S90? Greg
-
Hi , sorry I am posting it again here as this section is more appropritate one I guess. I am not an extensitve sql or pl/sql writer. I am basically java developer, I want help in extracting a part of xml in clob data field. the Clob field has data li