aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Can I get the contexts in JSP as same as in standalone JavaApp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can I get the contexts in JSP as same as in standalone JavaApp " Watch "Can I get the contexts in JSP as same as in standalone JavaApp " New topic
Author

Can I get the contexts in JSP as same as in standalone JavaApp

sang tran
Greenhorn

Joined: Jun 11, 2002
Posts: 4
I am working on JBuilder6 and JBoss-3.0.0.
My jndi.properties is
-----------------------java.naming.factory.initial=org.jnp.interfaces.Na ingContextFactory
java.naming.provider.url=localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming rg.jnp.interfaces
-----------------------
Then in my standalone java app, I wrote:
Context context = new InitialContext()
--> it run well
but in my JSP, I got an error:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
-----------------------
Anyone can tell me why I got that error ?
Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16065
    
  21

I recommend you check your CLASSPATH. Not the one you started from, but the one JBoss is actually using. They're frequently not the same, as many of us have discovered, to our sorrow.
In fact, many appservers have 4 or 5 or even more internal classpaths, depending on what part of the system you're working with.


Customer surveys are for companies who didn't pay proper attention to begin with.
Siva Jagadeesan
Ranch Hand

Joined: Oct 31, 2000
Posts: 160
You can get context in a JSP as you do using Java App. Becoz the JSP is convereted into Servlet. So it doesn't matter if u r using JSP or a Java application. It is all the same.
But I think it is not good to call EJB from JSP. We should be using JSP only for the presentation and it should be free of any business logic or interaction with EJB
I think it will be great if you can learn about these design patterns
1) MVC
2) Session Facade
3) Business Delegate
Lov
Siva


Rgds<p>--Siva Jagadeesan<br /><a href="http://java2simple.blog-city.com" target="_blank" rel="nofollow">http://java2simple.blog-city.com</a><br />Sun Certified Java2 Programmer<br />Sun Certified Web Component Developer<br />BEA Certified Weblogic Server 7 Enterprise Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I get the contexts in JSP as same as in standalone JavaApp