WebSphere Portal Server - NameNotFoundException: Name comp/env/service not found in context "java:".

This is Interesting: Free IT Magazines  
Home > Archive > WebSphere Portal Server > November 2005 > NameNotFoundException: Name comp/env/service not found in context "java:".





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author NameNotFoundException: Name comp/env/service not found in context "java:".

2005-11-28, 6:05 pm


I have to create a portlet that access a Remote Web Service. I've created a Portlet Project on WSAD 5.1.2 with Portal Toolkit 5.0.2.3 and later I've imported a ".wsdl" file to have the definition of Web Service. In this ways I've generated the the proxy
/client classes with right click - Web Services - Generate Client Option of WSAD.
When I install the portlet on WebSphere Portal 5.0 and execute one of the methods of the proxy class I get this Error:

javax.naming.NameNotFoundException: Name comp/env/service not found in context "java:".

The Proxy class throws an exception on this sentence:

javax.naming.InitialContext ctx = new javax.naming.InitialContext();

procesoSeleccionSoap = ((org.tempuri.ProcesoSeleccion)ctx.lookup("java:comp/env/service/ProcesoSeleccion")).getProcesoSeleccionSoap();

The error occurs on this part of sentence:
ctx.lookup("java:comp/env/service/ProcesoSeleccion")

Why can I do? I have to define "service/ProcesoSeleccion" on any xml configuration file? WSAD has been generated all xml configuration files that are necessary, I supose.
I have created a Web Service Project with the same and runs ok! What's the problem of portlet?
fang

2005-11-28, 8:50 pm

Is this a typo "ProcesoSeleccion"?

<bascard@yahoo.com> wrote in message
news:697810132.1133192671426.JavaMail.wassrvr@ltsgwas007.sby.ibm.com...
>
> I have to create a portlet that access a Remote Web Service. I've

created a Portlet Project on WSAD 5.1.2 with Portal Toolkit 5.0.2.3 and
later I've imported a ".wsdl" file to have the definition of Web Service. In
this ways I've generated the the proxy/client classes with right click - Web
Services - Generate Client Option of WSAD.
> When I install the portlet on WebSphere Portal 5.0 and execute one of the

methods of the proxy class I get this Error:
>
> javax.naming.NameNotFoundException: Name comp/env/service not found in

context "java:".
>
> The Proxy class throws an exception on this sentence:
>
> javax.naming.InitialContext ctx = new javax.naming.InitialContext();
>
> procesoSeleccionSoap =

((org.tempuri.ProcesoSeleccion)ctx.lookup("java:comp/env/service/ProcesoSele
ccion")). getProcesoSeleccionSoap();
>
> The error occurs on this part of sentence:
> ctx.lookup("java:comp/env/service/ProcesoSeleccion")
>
> Why can I do? I have to define "service/ProcesoSeleccion" on any xml

configuration file? WSAD has been generated all xml configuration files that
are necessary, I supose.
> I have created a Web Service Project with the same and runs ok! What's the

problem of portlet?


2005-11-29, 7:51 am

A3Pre --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\A3Pre
BannerNavidad --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\BannerNavidad
Busacador Portal --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\Busacador Portal
ContentManagement --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\ContentManagement
DefaultEAR --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\DefaultEAR
EJBTest --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\EJBTest
EJBTestEAR --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\EJBTestEAR
Forum --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\Forum
MyTools --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\MyTools
Organigram --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\Organigram
Profile --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\Profile
RelatedLinks --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\RelatedLinks
Tramites --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\Tramites
WorkFlowAdmin --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowAdmin
WorkFlowLists --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowLists\WorkflowLists
WorkFlowPage --> C:\Documents and Settings\pawa\My Documents\IBM\wssitedev51\workspace\Work
flowPage



> Is this a typo "ProcesoSeleccion"?
>
> <bascard@yahoo.com> wrote in message
> news:697810132.1133192671426.JavaMail.wassrvr@ltsgwas0
> 07.sby.ibm.com...
> Web Service. I've
> created a Portlet Project on WSAD 5.1.2 with Portal
> Toolkit 5.0.2.3 and
> later I've imported a ".wsdl" file to have the
> definition of Web Service. In
> this ways I've generated the the proxy/client classes
> with right click - Web
> Services - Generate Client Option of WSAD.
> and execute one of the
> methods of the proxy class I get this Error:
> comp/env/service not found in
> context "java:".
> sentence:
> javax.naming.InitialContext();
> ((org.tempuri.ProcesoSeleccion)ctx.lookup("java:comp/e
> nv/service/ProcesoSele
> ccion")).getProcesoSeleccionSoap();
>
> ctx.lookup("java:comp/env/service/ProcesoSeleccion")
> "service/ProcesoSeleccion" on any xml
> configuration file? WSAD has been generated all xml
> configuration files that
> are necessary, I supose.
> and runs ok! What's the
> problem of portlet?
>
>





Yes! ProcesoSeleccion is the name of WebService. I'm a junior developer on WebSphere Portal and portlets, but I cannot understand why does not work, if exist a web service project that has been generated from wsdl file and wotks fine, why if I do the same
in portlet project doesn't works correctly! I think that int Web Service project config xml files like 'webserviceclient.xml','ProcesoSeleccion_mapping.xml','ibm-webservicesclient-bnd.xml','ibm-webservicesclient-ext.xml' are loaded correctly on runtime b
ut in WebShpere Portal this xml config files are not the same, but I don't know nothing about that.

On the other hand, I can modify proxy class changing value of _useJNDI property to false and then proxy class tries to create a ProcesoSeleccionLocator (extends com.ibm.ws.webservices.engine.client.Service and use a default constructor! Only adds 2 method
s, no change nothing!) and I get this other error:

java.lang.NoClassDefFoundError: com/ibm/ws/security/util/AccessController at com.ibm.ws.protocol.Protocols.(Protocols.java:44) at com.ibm.ws.webservices.engine.client.Service.(Service.java:173) at org.tempuri.EmpleadoSoapProxy._initEmpleadoSoapProxy(Emple
adoSoapProxy.java:44) at org.apache.jsp._PUEmpleadoPortletView._jspService(_PUEmpleadoPortletView.java:156) at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:364) at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:694) at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:7
92) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServle
t.java:174) at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet ...


YOU CAN SEE THE CODE HERE! THIS IS A METHOD GENERATED FOR WSAD AND THIS IS CALLED ON PROXY CONSTRUCTOR!


public void _initProcesoSeleccionSoapProxy() {

//CAN I USE JNDI TO CREATE SERVICE INTERFACE

if (_useJNDI) {
try{
javax.naming.InitialContext ctx = new javax.naming.InitialContext();

procesoSeleccionSoap = ((org.tempuri.ProcesoSeleccion)ctx.lookup("java:comp/env/service/ProcesoSeleccion")).getProcesoSeleccionSoap();

//org.tempuri.ProcesoSeleccion EXTENDS javax.xml.rpc.Service AND NOT MODIFIES NOTHING!

//procesoSeleccionSoap EXTENDS java.rmi.Remote AND NOT MODIFIES NOTHING!

}
catch (javax.naming.NamingException namingException)
{
NamingException THROWED!! --> > > javax.naming.NameNotFoundException: Name comp/env/service not found in context "java:".
}
catch (javax.xml.rpc.ServiceException serviceException) & #123;SetExceptionOnTrace(serviceExceptio
n);}
}

// IF procesoSeleccionSoap has not been created TRIES TO CREATE MANUALLY! AND ANOTHER ERROR IS THROWED! catched by Throwable!
// Error: "java.lang.NoClassDefFoundError: com/ibm/ws/security/util/AccessController "

if (procesoSeleccionSoap == null) {
try{
org.tempuri.ProcesoSeleccionLocator locator = new org.tempuri.ProcesoSeleccionLocator();
procesoSeleccionSoap = locator.getProcesoSeleccionSoap();
}
catch (javax.xml.rpc.ServiceException serviceException) & #123;SetExceptionOnTrace(serviceExceptio
n);}
catch (Exception ex) {SetExceptionOnTrace(ex);}
catch (Throwable text)
{
Throwable THROWED!! --> > > "java.lang.NoClassDefFoundError: com/ibm/ws/security/util/AccessController "
}

}
try
{
if (procesoSeleccionSoap != null) {
if (_endpoint != null)
{
((javax.xml.rpc.Stub)procesoSeleccionSoap)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
}
else
{
_endpoint = (String)((javax.xml.rpc.Stub)procesoSeleccionSoap)._getProperty("javax.xml.rpc.service.endpoint.address");
}
}
}
catch (Exception ex) {SetExceptionOnTrace(ex);}
catch (Throwable text) {SetExceptionOnTrace(text);}

}

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com