在servlet中调用和其他地方没有什么不同
解决方案 »
- 一次性按钮
- struts1.2问题
- 请问大家,jsp中如何退到上一页,并且自动刷新一次上一页(仅仅立即刷新一次而已)
- 用jfreechart图片中文乱码显示问题
- 动态生成中文XML文件的问题。
- 请教高手了~~ 偶是新新手
- if(request.getParameter("ForInsuS").trim().compareTo("ON")==0){sql += "and ForInsu='"+request.getParameter("ForInsuS")+"'";}
- 菜鸟刚学jsp,别人教给我一条sql语句,是查询表里的数据,不过不是模糊查询的,哪位高手告诉我模糊查询的语句怎么写?
- include文件中图片出不来,在线等待
- 用tomcat+jsp做web服务,如何做压力测试?
- 如何在jsp页面中使用ocx控件?
- jive论坛问题:public void setModerationMinThreadValue(int value)
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import com.javapro.ejb.StringProcessor;
import com.javapro.ejb.StringProcessorHome;public class Client { public static void main(String[] args) { // first argument must be the input
if (args.length==0) {
System.out.println("Please specify the input to convert to upper case.");
return;
}
String input = args[0]; // preparing properties for constructing an InitialContext object
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.PROVIDER_URL, "192.168.0.8:1099"); try {
// Get an initial context
InitialContext jndiContext = new InitialContext(properties);
System.out.println("Got context"); // Get a reference to the Bean
Object ref = jndiContext.lookup("StringProcessor");
System.out.println("Got reference"); // Get a reference from this to the Bean's Home interface
StringProcessorHome home = (StringProcessorHome)
PortableRemoteObject.narrow (ref, StringProcessorHome.class); // Create an Adder object from the Home interface
StringProcessor sp = home.create();
System.out.println ("Uppercase of '" + input + "' is " +
sp.toUpperCase(input));
}
catch(Exception e) {
System.out.println(e.toString());
}
}
}嵌入servlet中后在InitialContext jndiContext = new InitialContext(properties);这捕捉到了错误,错误提示说:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
不知为何,请大家指教
properties.put(Context.PROVIDER_URL, "192.168.0.8:1099");这两句注释掉吧
以前的java程序呢?