This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
sang tran
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18094
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Siva Jagadeesan
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic