EJBs in TomCat
Hi!
Im not sure wether this is the correct Forum to post my problem, but i simply hope u guys know an answer :)
I searched the whooooooole web, but didnt find any answer...
Im trying to use EJBs in Tomcat. My EJB-Container is WebSphere Application Server, ut my WebApp needs to run under TomCat - crazy conditions in know.
some code-snippets from web.xml:
<ejb-ref id="EjbRef_1">
<ejb-ref-name>ejb/EJBHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>myapp.EJBHome</home>
<remote>myapp.EJB</remote>
</ejb-ref>and form server.xml
<Ejb name="ejb/EJBHome"
type="Session"
home="myapp.EJBHome"
remote="myapp.EJB"/>
<ResourceParams name="ejb/EJBHome">
<parameter>
<name>java.naming.factory.initial</name>
<value>com.ibm.websphere.naming.WsnInitialContextFactory</value>
</parameter>
<parameter>
<name>java.naming.security.principal</name>
<value>myadmin</value>
</parameter>
<parameter>
<name>java.naming.security.credentials</name>
<value>mypassword</value>
</parameter>
<parameter>
<name>java.naming.provider.url</name>
<value>iiop://localhost:2809</value>
</parameter>
</ResourceParams>hope here will be someone that will help me :-))
Hi guys!
I was able to reach JNDI-Namespace and EJBs in WebSphere with a TestProgramm. It was a simple class, that tries to access it.
WebSphere ships some batch-files to start Clients, that want access WebSphere-JNDI. These batches call a com.ibm...WSLauncher class, that calls the "own class" (my TestProgramm) by invokation.
I tried the same with Tomcat and edited the batches accordingly. I found out, that WSLauncher uses his own Classloader. AND TomCat uses his ownt too. Furthermore TomCat ignores some system-properties (like classpath, if set).
The occurring problem is, that the com.ibm....InitialFactory cant be instanciated (cause TomCat Classloader tries to, but only WS-Classloader is able to). (By the way - imho its imossible to reach WS-JNDI via another CtxFactory than the one from WS itself)
Just for people who are interressted :-)
Anyway - each suggestion would be welcome ^^
Similar Messages
-
Why can't I invoke a ejb in Tomcat?
Hi everyone:
I invoke a ejb in Tomcat(the ejb is in the weblogic in the same computer with tomcat).The jsp code is:
/////////////////first method//////////////////////
Context ctx=new InitialContext();
Object obj=ctx.lookup("ejb/Hello");
Hellohome home=(Hellohome)PortableRemoteObject.narrow(obj,Hellohome.class);
Hello hello=home.create();
out.println(hello.getHello());
///////////////second method//////////////////
Hashtable ht=new Hashtable();
Context ctx=null;
ht.put(ctx.PROVIDER_URL, "t3://127.0.0.1:7001" ); // t3://127.0.0.1:7001
ht.put(ctx.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ctx = new InitialContext();
Hellohome home= (Hellohome) javax.rmi.PortableRemoteObject.narrow (ctx.lookup ("HelloEJB"),Hellohome.class);
Hello hello=home.create();
out.println(hello.getHello());
Is there any different?If I want to invoke the EJB which is in the weblogic.The Tomcat says:
Name HelloEJB is not bound in this Context
But I bound it in the weblogic and I add the "
<ejb-ref>
<ejb-ref-name>HelloEJB</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>lyoejb.Hellohome</home>
<remote>lyoejb.Hello</remote>
<ejb-link>Hello.jar#HelloEJB</ejb-link>
</ejb-ref>"
in the ejb-jar.xml. And I copy the j2ee.jar,wlclient.jar,Hello.jar to Tomcat/....web-inf/lib
How to setting the web.xml in the Tomcat?Hi duffymo:
I install weblogic in windowsXP and weblogic run property in it.Any wrong?I install JVM in IE6 so the IE can display Applet.
I can invoke the EJB in Tomcat.Let me say it carefully.
The weblogic's port is 7001 and the Tomcat's port is 8080.I deploy a EJB in weblogic and I can see the JNDI name in weblogic console(The JNDI name is HelloEJB). I test the EJB in Tomcat.The dir is C:\tomcat\webapps\ROOT\ejb\invokeEJB.jsp and I write the code:
///////////////////////////invokeEJB.jsp///////////////////////////////////////
Hashtable ht=new Hashtable();
Context ctx=null;
ht.put(ctx.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(ctx.PROVIDER_URL, "t3://127.0.0.1:7001" );
ctx = new InitialContext(ht);
Hellohome home= (Hellohome)ctx.lookup ("ejb.HelloEJB");
Hello hello=home.create();
out.println(hello.getHello());
/////////////////////////End code////////////////////////////////
I test it using the URL:"http://localhost:8080/ejb/invokeEJB.jsp"
It can display the content of the EJB property.I means that the Tomcat can invoke EJB.I copy the "j2ee.jar , wlclient.jar , HelloEJB.jar(My EJB Home and Remote interface)" to "Tomcat/.../share/lib" directory.
I hope you will reply if you have any advice. :) -
Is it possible to deploy EJBs onto Tomcat server
Hi all,
Please advice me if it is possible to deploy EJBs on the Tomcat Server.
If so how to go about it?
Thanks
RanjanNo , it is not possible.Tomcat does not have a
Ejb container.It only has a web container.
Try using free servers like Sun One application server for
deploying your ejb's.
Get back in case of any issues -
Exception looking up weblogic ejb from tomcat
i have a servlet in tomcat 4.0 doing a remote lookup on an ejb in
weblogic 6.1. the code works from a standalone client, but not in tomcat.
so i assume it is something to do with jaas. do i have to configure jaas
differently? and how?? i do not need to do anything with a standalone
client to work.
the code is
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://192.168.254.3:7001");
p.put(Context.SECURITY_PRINCIPAL, "user");
p.put(Context.SECURITY_CREDENTIALS, "password");
InitialContext ctx = new InitialContext(p);
the exception is
javax.servlet.ServletException: javax.naming.AuthenticationException
[Root exception is java.lang.SecurityException: attempting to add an
object which is not an instance of java.security.Principal to a
Subject's Principal Set]
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
root cause
com.realty.remoteservice.RemoteServiceException:
javax.naming.AuthenticationException [Root exception is
java.lang.SecurityException: attempting to add an object which is not an
instance of java.security.Principal to a Subject's Principal Set]
at com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:43)
at com.realty.remoteservice.EjbService.main(EjbService.java:23)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
nested exception is:
javax.naming.AuthenticationException. Root exception is
java.lang.SecurityException: attempting to add an object which is not an
instance of java.security.Principal to a Subject's Principal Set
at javax.security.auth.Subject$SecureSet.add(Subject.java:1071)
at
weblogic.common.internal.BootServicesStub.writeUserInfoToSubject(BootServicesStub.java:72)
at
weblogic.common.internal.BootServicesStub.authenticate(BootServicesStub.java:80)
at weblogic.security.acl.internal.Security.authenticate(Security.java:108)
at
weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialContextFactoryDelegate.java:461)
at
weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:316)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:288)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:203)
at
weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:124)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
at
com.realty.util.RealtyContextFactory.create(RealtyContextFactory.java:25)
at com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:36)
at com.realty.remoteservice.EjbService.main(EjbService.java:23)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)Did you try placing weblogic.jar in front of the classpath?
Or use WebLogic servlet container instead ;-)
"Simon Evans" <[email protected]> wrote in message
news:[email protected]...
any solution? tomcat also uses jaas so i cant remove them.
Dimitri I. Rakitine wrote:
Happened to me once - as far as I remember it was caused by non-WL jaas
classes in the
classpath.
"Simon Evans" <[email protected]> wrote in message
news:[email protected]...
i have a servlet in tomcat 4.0 doing a remote lookup on an ejb in
weblogic 6.1. the code works from a standalone client, but not in
tomcat.
so i assume it is something to do with jaas. do i have to configure jaas
differently? and how?? i do not need to do anything with a standalone
client to work.
the code is
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, "t3://192.168.254.3:7001");
p.put(Context.SECURITY_PRINCIPAL, "user");
p.put(Context.SECURITY_CREDENTIALS, "password");
InitialContext ctx = new InitialContext(p);
the exception is
javax.servlet.ServletException: javax.naming.AuthenticationException
[Root exception is java.lang.SecurityException: attempting to add an
object which is not an instance of java.security.Principal to a
Subject's Principal Set]
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:457)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:71
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
at java.lang.Thread.run(Thread.java:536)
root cause
com.realty.remoteservice.RemoteServiceException:
javax.naming.AuthenticationException [Root exception is
java.lang.SecurityException: attempting to add an object which is not an
instance of java.security.Principal to a Subject's Principal Set]
at
com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:43)
at com.realty.remoteservice.EjbService.main(EjbService.java:23)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
at java.lang.Thread.run(Thread.java:536)
nested exception is:
javax.naming.AuthenticationException. Root exception is
java.lang.SecurityException: attempting to add an object which is not an
instance of java.security.Principal to a Subject's Principal Set
at javax.security.auth.Subject$SecureSet.add(Subject.java:1071)
at
weblogic.common.internal.BootServicesStub.writeUserInfoToSubject(BootService
sStub.java:72)
at
weblogic.common.internal.BootServicesStub.authenticate(BootServicesStub.java
:80)
at
weblogic.security.acl.internal.Security.authenticate(Security.java:108)
at
weblogic.jndi.WLInitialContextFactoryDelegate.pushUser(WLInitialContextFacto
ryDelegate.java:461)
at
weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFac
toryDelegate.java:316)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
textFactoryDelegate.java:288)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
textFactoryDelegate.java:203)
at
weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
ory.java:124)
atjavax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.(InitialContext.java:195)
at
com.realty.util.RealtyContextFactory.create(RealtyContextFactory.java:25)
at
com.realty.remoteservice.EjbService.addListingAgent(EjbService.java:36)
at com.realty.remoteservice.EjbService.main(EjbService.java:23)
at
org.apache.jsp.test_0002dremote$jsp._jspService(test_0002dremote$jsp.java:61
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:201)
atorg.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
>>
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
at java.lang.Thread.run(Thread.java:536)
Dimitri
Dimitri -
Accessing WebLogic EJBs from Tomcat 3.2
Has anyone out there tried to access EJBs in a WebLogic 5.10 SP6 app
server from a servlet in Tomcat 3.2? I'm operating under Win2K. When I
try to create the initial naming context, the following exception is
thrown:
java.lang.NoClassDefFoundError: COM/rsa/jsafe/JSAFE_InvalidUseException
at weblogic.security.WLMessageDigest.getInstance
(WLMessageDigest.java:52)
at weblogic.security.MD5RandomBitsSource.seed
(MD5RandomBitsSource.java:56)
at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:108)
at weblogic.rjvm.LocalRJVM.getLocalRJVM(LocalRJVM.java:85)
at weblogic.rjvm.RJVMManager.getLocalRJVM(RJVMManager.java:89)
at weblogic.rjvm.RJVMManager.initialize(RJVMManager.java:78)
at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:137)
at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:182)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(
WLInitialContextFactoryDelegate.java, Compiled Code)
at
weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(
WLInitialContextFactoryDelegate.java:148)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(
WLInitialContextFactory.java:123)
at javax.naming.spi.NamingManager.getInitialContext(
NamingManager.java:771)
at javax.naming.InitialContext.getDefaultInitCtx(
InitialContext.java:169)
at javax.naming.InitialContext.<init>(InitialContext.java:146)
From poking around in the WebLogic server directories, in appears that
the RSA-related classes are implemented as native methods in jsafe.dll.
Should I be trying to install this dll in Tomcat somehow? If so, where
should I be looking for information on how to do this?
-- Erik"Erik Horstkotte" <[email protected]> wrote in message news:[email protected]...
Has anyone out there tried to access EJBs in a WebLogic 5.10 SP6 app
server from a servlet in Tomcat 3.2? I'm operating under Win2K. When I
try to create the initial naming context, the following exception is
thrown:[Sigh. I know it's bad form to follow up your own posts, but...]
Ignore the exact problem description above. I wasn't including
\weblogic\classes and \weblogic\lib\weblogicaux.jar in Tomcat's
classpath. Now the same code connects to the app server:
Connected successfully using http to JIMBO/172.16.1.4:7001
But immediately after connecting, I get a new exception:
java.lang.NoSuchMethodError: java.lang.NoSuchMethodException:
getNameInNamespace
at weblogic.jndi.toolkit.BasicWLContext_WLStub.ensureInitialized
(BasicWLContext_WLStub.java:127)
at weblogic.jndi.toolkit.BasicWLContext_WLStub.<init>
(BasicWLContext_WLStub.java:146)
at java.lang.reflect.Constructor.newInstance(Native Method)
at weblogic.common.internal.ClassTableEntry.newInstance
(ClassTableEntry.java:86)
at weblogic.common.internal.WLObjectInputStreamBase.readLeftover
(WLObjectInputStreamBase.java:248)
at weblogic.common.internal.WLObjectInputStreamBase
.readObjectBody (WLObjectInputStreamBase.java:202)
at weblogic.common.internal.WLObjectInputStreamBase.readObject
(WLObjectInputStreamBase.java:949)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL
(WLObjectInputStreamBase.java:308)
at weblogic.jndi.toolkit.WLContextStub.readExternal
(WLContextStub.java:79)
at weblogic.common.internal.WLObjectInputStreamBase
.readPublicSerializable(WLObjectInputStreamBase.java:269)
at weblogic.common.internal.WLObjectInputStreamBase.readLeftover
(WLObjectInputStreamBase.java:254)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectBody
(WLObjectInputStreamBase.java:202)
at weblogic.common.internal.WLObjectInputStreamBase.readObject
(WLObjectInputStreamBase.java:949)
at weblogic.common.internal.WLObjectInputStreamBase.readObjectWL
(WLObjectInputStreamBase.java:308)
at weblogic.rmi.extensions.AbstractInputStream2.readObject
(AbstractInputStream2.java:25)
at weblogic.jndi.internal.RemoteContextFactoryImpl_WLStub
.getContext(RemoteContextFactoryImpl_WLStub.java:99)
at weblogic.jndi.WLInitialContextFactoryDelegate
.newRemoteContext(WLInitialContextFactoryDelegate.java:316)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext
(WLInitialContextFactoryDelegate.java:242)
at weblogic.jndi.WLInitialContextFactoryDelegate
.getInitialContext(WLInitialContextFactoryDelegate.java, Compiled
Code)
at weblogic.jndi.WLInitialContextFactoryDelegate
.getInitialContext(WLInitialContextFactoryDelegate.java:148)
at weblogic.jndi.WLInitialContextFactory.getInitialContext
(WLInitialContextFactory.java:123)
at javax.naming.spi.NamingManager.getInitialContext
(NamingManager.java:771)
at javax.naming.InitialContext.getDefaultInitCtx
(InitialContext.java:169)
at javax.naming.InitialContext.<init>(InitialContext.java:146)
getNameInNamespace isn't a method in any of my EJB's (that I wrote, at
least - it could be generated by weblogic.ejbc), and it's not a method
I'm calling directly. Presumably, something in the remote session bean
creation is calling this method (of what class?)
Am still I missing classpath entries in Tomcat? If so, which ones?
If you've successfully referenced EJBs in a WebLogic Server from a
Tomcat servlet, what setup changes did you have to make to Tomcat and
WLS to make it fly?
-- Erik -
We are using Sun Application Server 8 and seems like I have
problem accessing AS from Tomcat.
The following is the error message from the log
[org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2006-12-22 12:14:40 StandardContext[jsp-examples]ContextListener: contextInitialized()
2006-12-22 12:14:40 StandardContext[jsp-examples]SessionListener: contextInitialized()
2006-12-22 12:14:41 StandardContext[servlets-examples]ContextListener: contextInitialized()
2006-12-22 12:14:41 StandardContext[servlets-examples]SessionListener: contextInitialized()
2006-12-22 12:15:14 StandardWrapperValve[session.Login]: Servlet.service() for servlet session.Login threw exception
java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:68)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:149)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.sun.corba.ee.impl.orb.ParserTable$5.operate(ParserTable.java:650)
at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:22)
at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:52)
at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:55)
at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:397)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:499)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:589)
at org.omg.CORBA.ORB.init(ORB.java:337)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:372)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:236)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:248)
at com.sun.appserv.naming.S1ASCtxFactory.getInitialContext(S1ASCtxFactory.java:208)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at iims.shared.ServerAgent.setServer(ServerAgent.java:134)
at iims.web.session.Login.doPost(Login.java:150)
at iims.web.session.Login.doGet(Login.java:665)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
2006-12-22 12:15:16 StandardWrapperValve[session.Login]: Servlet.service() for servlet session.Login threw exception
java.lang.NoClassDefFoundError
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:149)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.sun.corba.ee.impl.orb.ParserTable$5.operate(ParserTable.java:650)
at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:22)
at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:52)
at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:55)
at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:397)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:499)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:589)
at org.omg.CORBA.ORB.init(ORB.java:337)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:372)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:236)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:248)
at com.sun.appserv.naming.S1ASCtxFactory.getInitialContext(S1ASCtxFactory.java:208)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at iims.shared.ServerAgent.setServer(ServerAgent.java:134)
at iims.web.session.Login.doPost(Login.java:150)
at iims.web.session.Login.doGet(Login.java:665)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
2006-12-22 12:27:55 StandardContext[servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1b2d7df')
2006-12-22 12:27:55 StandardContext[servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@7a9224')
2006-12-22 12:27:55 StandardContext[servlets-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@110b640')
2006-12-22 12:27:55 StandardContext[servlets-examples]SessionListener: contextDestroyed()
2006-12-22 12:27:55 StandardContext[servlets-examples]ContextListener: contextDestroyed()
2006-12-22 12:27:55 StandardContext[jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@13fba1')
2006-12-22 12:27:55 StandardContext[jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1ed27e4')
2006-12-22 12:27:55 StandardContext[jsp-examples]ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@d61aef')
2006-12-22 12:27:55 StandardContext[jsp-examples]SessionListener: contextDestroyed()
2006-12-22 12:27:55 StandardContext[jsp-examples]ContextListener: contextDestroyed()
2006-12-22 12:29:47 StandardContext[balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2006-12-22 12:29:47 StandardContext[jsp-examples]ContextListener: contextInitialized()
2006-12-22 12:29:47 StandardContext[jsp-examples]SessionListener: contextInitialized()
2006-12-22 12:29:48 StandardContext[servlets-examples]ContextListener: contextInitialized()
2006-12-22 12:29:48 StandardContext[servlets-examples]SessionListener: contextInitialized()
2006-12-22 13:09:15 StandardWrapperValve[session.Login]: Servlet.service() for servlet session.Login threw exception
java.lang.NoClassDefFoundError: javax/security/jacc/PolicyContextException
at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:68)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:149)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.sun.corba.ee.impl.orb.ParserTable$5.operate(ParserTable.java:650)
at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:22)
at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:52)
at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:55)
at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:397)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:499)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:589)
at org.omg.CORBA.ORB.init(ORB.java:337)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:372)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:236)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:248)
at com.sun.appserv.naming.S1ASCtxFactory.getInitialContext(S1ASCtxFactory.java:208)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at iims.shared.ServerAgent.setServer(ServerAgent.java:134)
at iims.web.session.Login.doPost(Login.java:150)
at iims.web.session.Login.doGet(Login.java:665)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
2006-12-22 13:09:17 StandardWrapperValve[session.Login]: Servlet.service() for servlet session.Login threw exception
java.lang.NoClassDefFoundError
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocketFactory.java:149)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at com.sun.corba.ee.impl.orb.ParserTable$5.operate(ParserTable.java:650)
at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:22)
at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:52)
at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:55)
at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParserImpl.java:397)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:499)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:589)
at org.omg.CORBA.ORB.init(ORB.java:337)
at com.sun.enterprise.util.ORBManager.createORB(ORBManager.java:372)
at com.sun.enterprise.util.ORBManager.init(ORBManager.java:236)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:248)
at com.sun.appserv.naming.S1ASCtxFactory.getInitialContext(S1ASCtxFactory.java:208)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at iims.shared.ServerAgent.setServer(ServerAgent.java:134)
at iims.web.session.Login.doPost(Login.java:150)
at iims.web.session.Login.doGet(Login.java:665)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:272)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)Connecting to an EJB from a jsp in tomcat is no different from connecting to an EJB from a remote client.
You have to go through the basics such as setting up your Initial context and then doing a lookup.
InitialContext ctx = new InitialContext(props);
MyBeanHome beanhome = (MyBeanHome) ctx.lookup("ejb/mysuperbean"); -
Help Needed: Accessing Weblogic EJB in Tomcat
Hi all, I'm trying to access some EJB residing in weblogic7.0 server. Does anyone have any information/idea on how to do a JNDI connection to Weblogic Server and what are the necessary configuration on the Tomcat Server?
Thank you.
CelteHashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL, "t3://"+appSrvIp+":7001");
ht.put(Context.SECURITY_PRINCIPAL, "user");
ht.put(Context.SECURITY_CREDENTIALS, "passsword");
initCtx = new InitialContext(ht);
You will need weblogic.jar in your Tomcat classpath -
Jar files for EJB using tomcat
hi,
Am using eclipse . I am getting an error the declared package does not match the expected package while compiling the ejb.Can anyone tell me what are the jar files I need to include in classpath for eclipseHi Adam,
I have created a New EJB Project for my proxy development. This is the usual way I develop proxies for any given service interface created in ESR. Now i am not sure how to create a dependency with the BRMS facade. If i find the jars i can add it as an external library when compiling.
Can you explain a bit more about what you ment by "developing the java proxy in a development component", how did you accomplish this when creating a proxy for a service interface?
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/e2/3620cef55842cca4632664212f31b1/content.htm?frameset=%2Fen%2F81%2F097529e0e545e58bb2d7a34e4d0a2a%2Fframeset.htm -
Calling ejb through tomcat.
how to call ejb2.0 weblogic with tomcat.or JBoss
plz tell me how i use initial context object to call remote interface.
i m using
Properties p=new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL,"localhost:1099");
Context ctx=new InitialContext(p);
it will throw exception i.e
RequestTimeOutyou just change like this and try it
Properties p=new Properties();
p.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.provider.url","jnp://localhost:1099");
Context ctx=new InitialContext(p);
Edited by: ARUNRAJA on Aug 2, 2009 10:23 PM -
Hi,
I am ashish,i want to learn how to deploy EJB on Tomcat server so pls help me out for tht
thnx,
Ashish DaveTomcat does not provide support for an EJB container, you need a J2EE app server such as the J2EE SDK or SJSAS PE, which are both free and allowed for production deployment.
Regards
Lance -
Tomcat and EJB will work?
Author: kirankumar_j Feb 6, 2004 9:19 AM
Please let me know whether we can write EJBs in Tomcat and execute in the project?
I am new to EJBs.
KiranHi Kiran,
Tomcat alone is just a Web Server as mentioned in the previous post.
Go for App Servers like Jboss-Tomcat, Weblogic or Websphere.
Seetesh -
Connect to ejb gf 3 remote.
Hello I am trying to connect to a remote ejb from tomcat 6 with the ejb residing on glassfish 3.I am using the guide at [glassfish |https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#nonJavaEEwebcontainerRemoteEJB] for advice.
My servers tomcat 6 and glassfish 3 are running on different ports and are on the same machine running on localhost.I want to get the most current technique to connect to a ejb in glassfish 3.I have tried to implement and use parts of tutorials but have not found one answer sufficient to my use.
I am using netbeans 6.9.I have followed he steps laid out in the glassfish guide.I have read to just include the gf-client.jar file which includes links to needed files.
here STEP 3:
"Note that the Java EE 6 API classes are automatically included by gf-client.jar so there is no need to explicitly add javaee.jar to the classpath. gf-client.jar refers to many other .jars from the GlassFish installation directory so it is best to refer to it from within the installation directory itself rather than copying it(and all the other .jars) to another location."
This is what I am doing.
I have tried using the appserv-rt.jar file to remove the java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory.Though I don`t know the best way in that I got another error.
What library files do I include and where do I include them.I have included my ejb netbeans ejb.jar file so I just need the right libraries in the right places.Please offer you opinion and suggestions.
calling code
Context ic = null;
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
// optional. Defaults to localhost. Only needed if web server is running
// on a different host than the appserver
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
// optional. Defaults to 3700. Only needed if target orb port is not 3700.
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
ic = new InitialContext(props);
try{
ExpoServiceFacadeRemote foo = (ExpoServiceFacadeRemote)ic.lookup(ExpoServiceFacadeRemote.class.getName());
foo.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
out.close();
}here I got an error in
ic = new InitialContext(props);
SEVERE: null
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at Controller.com.processRequest(com.java:62)
at Controller.com.doGet(com.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 19 moreThanks gimbal2, i did what you said it is easier.I am also doing a programmatic login to glassfish 3 file realm I have set up. It works though it does not know my role i defined puzzling?
my user is orders.I previously did a login from a packaged war in my j2ee netbeans application.It worked by defining in sun-web.xml and the web.xml the role.But just defining the role in the sun-ejb-jar.xml doesn`t work for finding the user logged in role.
Where should I define my role for orders?
sun-ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 EJB 3.1//EN" "http://www.sun.com/software/appserver/dtds/sun-ejb-jar_3_1-0.dtd">
<sun-ejb-jar>
<enterprise-beans/>
<security-role-mapping>
<role-name>admin</role-name>
<principal-name>orders</principal-name>
</security-role-mapping>
</sun-ejb-jar>
@Resource
SessionContext sessionContext;
@WebMethod(operationName = "authenticate")
public String authenticate(@WebParam(name = "username") String username,
@WebParam(name = "password") String password) {
String re_result = "";
ProgrammaticLogin programmaticLogin = new ProgrammaticLogin();
try {
if (programmaticLogin.login(username, password, "file", false)) {
if (sessionContext.isCallerInRole("admin")) {
re_result = sessionContext.getCallerPrincipal().getName();
} else {
re_result = "No";
} catch (Exception ex) {
Logger.getLogger(ExpoFacade.class.getName()).log(Level.SEVERE, null, ex);
return re_result;
}you see this line never gets executed
re_result = sessionContext.getCallerPrincipal().getName();Please inspect and offer you advice
cheers
Edited by: Nital Faxing on Nov 4, 2010 8:24 PM -
Tomcat to Glassfish not working
Hello I am trying to connect to a remote ejb from tomcat 6 with the ejb residing on glassfish 3.I am using the guide at [glassfish |https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#nonJavaEEwebcontainerRemoteEJB] for advice.
My servers tomcat 6 and glassfish 3 are running on different ports and are on the same machine running on localhost.I want to get the most current technique to connect to a ejb in glassfish 3.I have tried to implement and use parts of tutorials but have not found one answer sufficient to my use.
I am using netbeans 6.9.I have followed he steps laid out in the glassfish guide.I have read to just include the gf-client.jar file which includes links to needed files.
here STEP 3:
"Note that the Java EE 6 API classes are automatically included by gf-client.jar so there is no need to explicitly add javaee.jar to the classpath. gf-client.jar refers to many other .jars from the GlassFish installation directory so it is best to refer to it from within the installation directory itself rather than copying it(and all the other .jars) to another location."
This is what I am doing.
I have tried using the appserv-rt.jar file to remove the java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory.Though I don`t know the best way in that I got another error.
What library files do I include and where do I include them.I have included my ejb netbeans ejb.jar file so I just need the right libraries in the right places.Please offer you opinion and suggestions.
calling code
Context ic = null;
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");
props.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
// optional. Defaults to localhost. Only needed if web server is running
// on a different host than the appserver
props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
// optional. Defaults to 3700. Only needed if target orb port is not 3700.
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
ic = new InitialContext(props);
try{
ExpoServiceFacadeRemote foo = (ExpoServiceFacadeRemote)ic.lookup(ExpoServiceFacadeRemote.class.getName());
foo.toString();
} catch (Exception e) {
e.printStackTrace();
} finally {
out.close();
}here I got an error in
ic = new InitialContext(props);
SEVERE: null
javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at Controller.com.processRequest(com.java:62)
at Controller.com.doGet(com.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
... 19 morethanksjava.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactoryJava cannot make it any more clear to you: this class does not exist in the classpath of your application, so it cannot do its work. If you don't know how to deal with classnotfound errors, I suggest you put a little research into that topic as you'll be seeing it a lot when you continue to use Java.
You need a certain jar or multiple jars from the glassfish server that contain all the JNDI provider classes and make those available to your client application. I'm not very familiar with Glassfish, but a quick google search turned up the name 'gf-client.jar' which seems very logical. -
How to call Sun server from Tomcat
Hi
I have EJB running on SUN J2EE server on different machine. I want to access EJB from Tomcat running on my machine through JSP page.
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
p.put(Context.PROVIDER_URL, "iiop://remote_machine:3700#ejb/ConnEJBBean");
Context ctx = new InitialContext(p);
Object objRef = ctx.lookup("ejb/ConnEJBBean");
%>
objRef type is: <%=objRef.getClass().getName()%>
<%
// Do something with object reference...
ConnEJBRemoteHome conEjbRemoteHome = (ConnEJBRemoteHome)PortableRemoteObject.narrow(objRef, ConnEJBRemoteHome.class);
ConnEJBRemote myConEjb = conEjbRemoteHome.create();
%>
This call rerurn an object of com.sun.corba.se.internal.iiop.CDRInputStream_1_0$1
althought I am expecting of conEjbRemoteHome Stub. Thus it throwas error on line:
ConnEJBRemoteHome conEjbRemoteHome = (ConnEJBRemoteHome)PortableRemoteObject.narrow(objRef, ConnEJBRemoteHome.class);
Which throuws an exception:
java.lang.ClassCastException at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:293) at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:134)
ANy help would be great...
Thanks in advance
BhuwanCouple of suggestions. First double-check that you actually have the RMI-IIOP stubs. Which version of SUN Appserver are you using. With versions 8.x or later, there are no RMI-IIOP stubs generated by default. You'd need to explicitly request that they be generated during deployment of the ejb app ( e.g. by setting the --generatermistubs option when running asadmin deploy).
Also double-check that the stubs are indeed visible within the classpath of your web application. The most common reason for the ClassCastException during PortableRemoteObject.narrow is that the stubs were not found.
--ken -
How can I add classpath in tomcat 4.0.3
I am sorry to ask a newbie question but I am really dying to know the answer.
I have tomcat4.0.3 installed and working.
I have j2ee1.3.1 install and working.
I have jboss3.0.0RC installed and working.
now I want to use a EJB in tomcat application,
the source file compile correctly.
but I type http://192.168.100.24/tomcat/servlet/FirstServlet
a ServletException throwed,tomcat complain javax.ejb.EJBHome class
cannot be founded.
I think it is a problem about classpath.but the environment variable
classpath has included j2ee.jar and when I use j2ee to develop an
web application I have never met such case.later I found a article
says tomcat4.0.3 don't use system classpath.
then I found a file named setclasspath.bat in bin directory,
and I change the line 'set CLASSPATH=%CLASSPATH%' to
'set CLASSPATH=%CLASSPATH%;%J2EE_HOME%\lib\j2ee.jar'
but the tomcat cannot startup.
how should I do.
BTW,how to get the information about tomcat fail to startupThrow your j2ee.jar into the WEB-INF\lib directory of your web app module. The servlet should pick it up there.
Maybe you are looking for
-
Can't get sound from many websites.
I can't get sound on my PowerMac from MANY websites (such as Hallmark.com, YouTube, some blogs, etc.). Yet I'm able to get sound on those same sites on my iBook. The PowerMac has no sound problems on other websites or in iTune function, sound effects
-
Dear SAP, we have a 1:n mapping scenario. The source is an INVOIC Idoc that will be splitted into several messages. The INVOIC IDoc has a sice of 5MB and more than 35.000 data sets. Because of the huge number of data sets / positions, there are two n
-
After upgrading to Yosemite, my thumbnail previews no longer show in InDesign CS4. Any ideas?
-
Pricing for different material
Dear sd gurus+ MY doubt is how can i do configure ,if i have material a,b,c,d+ if customer purchase a material it is one price,if b along with a price is different price for a same like others+ can u give idea thanks a lot
-
Hi, I synced my Curve to my Outlook 2003 calendar two days ago, and it worked great. Then I added a few items to the calendar on my blackberry and tried to sync so those new entries would appear on my outlook calendar. I stupidly just clicked through