Mark Curlette

Ranch Hand
+ Follow
since May 26, 2011
Mark likes ...
Java
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Curlette

Yes, I just changed it to
as you suggested, and it gave me the error message saying that



Does anyone have an aswer why it could not perform the look up? It seems to be very straight forward as it explains in the book , but it did turn out so.

Thanks in advance for your help,

Mark
9 years ago
Good morning All,
Hope you all have a great Friday . I am struggling with the error from my listener servlet and I could not figure it out why it can not find my resource instance eventhough i declared it in both my web.xml and context.xml.
I am going to post my codes and my error message here; and hopefully you may tell me what's going on.

For the information, I am using Tomcat 7.0 web server.

I declared a resource reference named TimerManager in my web.xml and my context.xml, and i try to look for it using InitialContext from my ServletContextListener.


Thanks so much in advance.

My ServletContextListener is as following:



my web.xml is as following :




My context.xml is as following :



and finally my error message is :

9 years ago
Hello All,
Hope you have a good week. I am struggling with the error which is it can not find resource instance from my ServletContextListener. It seems that it should be working but it did not. I can not figure out why and I'd like to get your help.
If you happen to know what I did wrong then please show me. For the information, I am using Tomcat 7.0 web server.

I declared a resource reference named TimerManager in my web.xml and my context.xml, and i try to look for it using InitialContext from my ServletContextListener.


Thanks so much in advance.


My ServletContextListener is as following:


My web.xml is as following:




My context.xml is as following:



The error I got :

9 years ago
Thank you very much Tim. You are absolutely right. I got rid of resource reference and replace it with your env-entry and it worked well.
I was able to Lookup: 4000000 from both of my jsp and eclipse console.

I would like to ask you an additional question if you don't mind relating to a class project which simply print out a stock quote and email in every ten minutes. It requires using the servlet context listener.

I would like to ask you please check my logic and please correct me if you spot any flaw in my logic.

Thanks so much for all of your helps.

I plan to do the following :

1. Create MyServletContextListener



My question is that can i replace the resource ref in the above code with the env-entry ? Please correct me if i am wrong because I think i need the resource refereence to get to the timer instance of the QuoteTimerListener in the code below.

2. Create a stock QuoteTimerListener which is called by the above MyServletContextListener




3. I have the web.xml defined as :



4. and my content.xml is defined as




9 years ago
Hello Tim,

Thanks for the pointer, I add the resource name reference to my context.xml but somehow Tomcat still gave me the error message saying that " javax.naming.NamingException: Cannot create resource instance with root cause".

I did not know why it did not work as it should. Please take a look to see if you could find anything unusual.

Thanks so much in advance for all of your help!!

Tom

my web.xml again is as following :




My context.xml is as the following:




and finally the following run time exception error saying it can not create the resource reference

9 years ago
Hello,

I am new to Tomcat , and I tried to create a school project using eclipse and Tomcat 7.0.

I received a javax.naming.NamingException: Cannot create resource instance with root cause which I think it may relate to the Tomcat server. I tried to solve it but with my limited understanding of the Tomcat server, i was not able to find a good explanation for the problem.

So i hope if you could guide me to why did i have this kind of error and how to resolve it.

My simple jsp is calling a resource reference which i declared in the web.xml file




My web.xml file which contains the above resource reference as following





I don't know why it gave the error since the jsp is calling a resource reference, and the resource reference is defined in the web.xml. The error is as followed:




I read some related article and it suggested that I need to declare the resource ref in context.xml. I don't why since I already declared it in web.xml. Is is not enough for Tomcat 7 to recognize?

If i declare it again in context.xml, then should it be exacly the same as I declared it in web.xml ?? such as the following :




Thanks so much in advance for your consideration.

Tom
9 years ago
Hello Bill,

Here is exception i got from console. Hope it helps.

javax.naming.NamingException: Cannot create resource instance
at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:146)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
at org.apache.naming.NamingContext.lookup(NamingContext.java:826)
at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
at org.apache.naming.NamingContext.lookup(NamingContext.java:145)
at org.apache.naming.NamingContext.lookup(NamingContext.java:814)
at org.apache.naming.NamingContext.lookup(NamingContext.java:159)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:158)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at org.minh.MyServletContextListener.contextInitialized(MyServletContextListener.java:54)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
===> Stock quote is org.minh.StockQuoteTimerListener@18607df6
Jul 23, 2013 2:46:20 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.minh.MyServletContextListener
java.lang.NullPointerException
at org.minh.MyServletContextListener.contextInitialized(MyServletContextListener.java:66)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4701)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5204)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5199)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
9 years ago
Hello ,

I have a simple program in eclipse which i tried to call a resource reference that I have created in web.xml file; but it gave me an error saying that it could not create a resource instance at this line of the code in the servlet listener
mgr = (TimerManager) itx.lookup("java:comp/env/timerRef");
My question is that I did not know why it gave such error since the program only tried to look up for a resource reference NOT creating it. The error simply did not make sense.
If you know what happening , please let me know.
Thanks so much in advance!!



my web.xml






My MyServletContextListener tried to look for the resource ref in the web.xml ; but i got a run time exception error saying "can not create resource instance" . The error points to this line of the code "mgr = (TimerManager) itx.lookup("java:comp/env/timerRef");"





My StockQuote bean is

9 years ago
Hello All,

Hope you had a nice weekend.

I try to install WAS 6.0 in my RAD 7.5. I used the IBM installation Manager to install WAS 6.0 and it gave me error message saying that

"CRIMA1071E: The installation package 'IBM® WebSphere® Application Server Version 6.0 Test Environment' requires components supplied by other packages.
The required components might be supplied by the specified features of the following installation packages:
Package: Rational Application Developer 7.5.0 -- Features: Tools for WebSphere® Application Server, version 6.0

To fix the problem, take one of the following steps:
-- Cancel this installation and install a package with the required features.
-- Cancel this installation and modify the package to add the required features.
The following additional components are required in installation location 'IBM Software Delivery Platform':
In installation context "com.ibm.sdp.eclipse.ide":
Component "com.ibm.rational.was.v60.option" required by component "com.ibm.rational.was.v60.tools.require" is not in the current feature selection
In installation context "com.ibm.sdp.eclipse.ide":
Component "com.ibm.rational.was.v60.option" required by component "com.ibm.rational.was.v60.tools.require" is not in the current feature selection"



I don't know where i can get those components as listed in the messages:

"CRIMA1071E: The installation package 'IBM® WebSphere® Application Server Version 6.0 Test Environment' requires components supplied by other packages.
The required components might be supplied by the specified features of the following installation packages:
Package: Rational Application Developer 7.5.0 -- Features: Tools for WebSphere® Application Server, version 6.0

To fix the problem, take one of the following steps:
-
Component "com.ibm.rational.was.v60.option" required by component "com.ibm.rational.was.v60.tools.require"



Please let me know if you happen to know how to resolve this.



Thanks so much in advance,

Mark
9 years ago
Hello All,
Hope you all have a good week. I am having a basic websphere application server question and I'd like to seek your help if you know the answer.

I have created a new Java dynamic project in RAD 7.5.5, and I'd like to know if is it ok to run WAS 6 in RAD 7.5.5 ?

Please give me all possible advices and alternatives for running WAS 6.0 in RAD 7.5.5.

Thanks so much in advance for all of your helps,

Minh
9 years ago
Hello Jeanne;

I am using RAD 7.5; and for your reference, i used RAD 6 before.

Could you please tell me why version of RAD make a difference in my case?

Thanks alot;

Bob
9 years ago
Hello all,


Please could somebody enlight me how the below project got created


The above Email Config project contains the source folder, JRE System Library and WebSphere Application Server Version 6.

I tried to go new -> project -> new java project to create a project which contains all of the above such as source folder, JRE System Library , and Web Sphere Application Server Version 6;

but i was not successful. It only gave me the source folder and JRE system library when i did new -> project -> new java project.

If you would not mind , could you show me what i need to do inn order to create a project which contains src, JRE system library, and websphere application server ?

Thanks so much in advance,

Bon


9 years ago
Hello,

Hope you all have a good week. I have a question related to the planning of a student project using ServletContextListening and servlet instances.
I would like to have a walk through of my planning with you , and ask you if it sounds ok to you , or do i need to make any change to it.
I have a scenario where I plan to use the ServletContextListener's ContextInitialized method to get a JSON object by using HTTPClient get method on a xml published site. I then use the Context.setAttribute on the JSON object to have it as
an application scope attribute which will be available to all of my servlets and jsp in my application. I then have jsp calling a servlet in which the servlet will get the JSON application scope, parse through it , and return whatever defined values to my jsp.
Please let me know if the planning is ok.

Thanks,
Bob
9 years ago