• Post Reply Bookmark Topic Watch Topic
  • New Topic

very urgent->plz help:error when connecting to cmp

 
jaspal singh
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

Im trying to connect to cmp class.while connecting im getting following exception:

as always..thanx to u in advance.

javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Files/Apache]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:649)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.n4n.hello.ServerLookup.getServer(ServerLookup.java:28)
at org.apache.jsp.entity_jsp._jspService(org.apache.jsp.entity_jsp:52)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Files/Apache
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:127)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:196)
at $Proxy0.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:530)
... 24 more
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.net.MalformedURLException: no protocol: Files/Apache
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:249)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.net.MalformedURLException: no protocol: Files/Apache
at java.net.URL.<init>(URL.java:537)
at java.net.URL.<init>(URL.java:434)
at java.net.URL.<init>(URL.java:383)
at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:747)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:147)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:74)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:297)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:246)
... 6 more
Jan 11, 2006 4:55:29 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.entity_jsp._jspService(org.apache.jsp.entity_jsp:53)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like an error try to find the EJB server, where are the web and business tiers located, i.e. web on tomcat in linux, ejb on jboss in linux?

Then how are you initialising your IntitialContext?
[ January 11, 2006: Message edited by: Daniel Rhoades ]
 
jaspal singh
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya...client calls for service from tomcat, its a jsp page.

the request is served by the cmp runnin on jboss.

using windows nt professional.

actually context is found.

"System.out.println("Inside Server"+serverName);
Context ctx = getInitialContext();
System.out.println("Context Found");//this is printed
Object obj = ctx.lookup(serverName);"//so here is problm.
System.out.println("Lookup Completed");//this does not print

[ January 11, 2006: Message edited by: jaspal singh ]


///whole class is below:
package com.n4n.hello;

import java.util.*;
import java.rmi.*;
import java.rmi.registry.*;
import javax.naming.*;
import javax.rmi.*;
import javax.ejb.*;

public class ServerLookup
{
private static Context CONTEXT = null;

private static Hashtable SERVERS = new Hashtable();


private static Hashtable CLASS_MAPPINGS = new Hashtable();

public static final String HelloServerRemoteName = "HelloServer";

public static Object getServer(String serverName) throws RemoteException
{
Object server = null;
try{
System.out.println("Inside Server"+serverName);
Context ctx = getInitialContext();
System.out.println("Context Found");
Object obj = ctx.lookup(serverName);
System.out.println("Lookup Completed");
Class homeClass = getHomeClass(serverName);
System.out.println("Home Found");
EJBHome home = (EJBHome)PortableRemoteObject.narrow(obj, homeClass);
System.out.println("Narrow Completed");
server = homeClass.getDeclaredMethod("create", null).invoke(home, null);
System.out.println("Instance Created");

}
catch(Exception e)
{
e.printStackTrace();
}
return server;
}
private static Class getHomeClass(String remoteName) throws ClassNotFoundException
{
Class cls = (Class)CLASS_MAPPINGS.get(remoteName);
if(cls == null)
{
if(remoteName.equalsIgnoreCase(HelloServerRemoteName))
cls = Class.forName("com.n4n.hello.IHelloHome");
}
return cls;
}
public static InitialContext getInitialContext() throws javax.naming.NamingException
{
java.util.Hashtable JNDIParm = new java.util.Hashtable();
JNDIParm.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
JNDIParm.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
JNDIParm.put(Context.PROVIDER_URL, "192.168.111.79:2016");
return new InitialContext(JNDIParm);
}
}
[ January 11, 2006: Message edited by: jaspal singh ]
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you doing:
<code>
Object obj = ctx.lookup(serverName);
</code>

When you already have an IntitialContext capable of getting an EJB home?

The serverName String probably isn't a valid JNDI URI, so it might be causing the MalformedURLException from the lookup method
 
jaspal singh
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actully both are required.

u get context insatance and then u lookup for the component.

and wats more.this code runs on most of the machines.only 2-3 hav problem.


hop u got that
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then it might be a path issue - I've heard JNDI on Windows machines can have issues if the path to the J2EE server directories have spaces in - that might explain why your code fails on only some machines.

PS: Sorry I didn't realised that serverName was a component you were trying to lookup - I thought you were still trying to initialise the environment, I got confused by the variable's name.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest making sure that the JBoss JNDI provider libraries are on the classpath of your webapp in Tomcat. Just having the Sun JNDI jars isn't sufficient. Those just allow JNDI to be used, but aren't enough to make it work.

As to why some machines hit this problem and others don't, it could be that the different machines have manually-applied hacks. I've lost a lot of time in the past where some random subset of people had manually dropped libraries into a server's own lib directory and I didn't know it. Our tendency is to start by blaming our own code (because most of the time we should), but sometimes its an issue in the environment the code is running in.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!