Loss of Weblogic EJB functionality from 2EA2 to 2 Release
I get the following error when running with control bound to Weblogic EJB. Same problem in new or existing projects. JSC and computer have been restarted. The EJB worked fine in 2EA2.
Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
Exception Details: org.apache.jasper.JasperException
com.sun.data.provider.DataProviderException: java.lang.reflect.InvocationTargetException
Possible Source of Error:
Class Name: org.apache.jasper.servlet.JspServletWrapper
File Name: JspServletWrapper.java
Method Name: service
Line Number: 384
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace:
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:251)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(AccessController.java:-2)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:482)
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:417)
org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:80)
org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:95)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313)
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:311)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(AccessController.java:-2)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Exception Details: javax.faces.FacesException
org.apache.jasper.JasperException: com.sun.data.provider.DataProviderException: java.lang.reflect.InvocationTargetException
Possible Source of Error:
Class Name: com.sun.faces.context.ExternalContextImpl
File Name: ExternalContextImpl.java
Method Name: dispatch
Line Number: 327
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace:
com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:327)
com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:311)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(AccessController.java:-2)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Exception Details: com.sun.rave.web.ui.appbase.ApplicationException
org.apache.jasper.JasperException: com.sun.data.provider.DataProviderException: java.lang.reflect.InvocationTargetException
Possible Source of Error:
Class Name: com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl
File Name: ViewHandlerImpl.java
Method Name: destroy
Line Number: 601
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace:
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java:601)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:316)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(AccessController.java:-2)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:257)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:194)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:210)
org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:161)
java.security.AccessController.doPrivileged(AccessController.java:-2)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:225)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:173)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:132)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:551)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:933)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:185)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:653)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:534)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:403)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:55)
Did you deploy the web app to the bundled Sun appserver? Can you look at the server.log from the appserver (<creator-install-dir>/SunAppServer8/logs/server.log) and see what exceptioin you have? My guess is that it failed when invoking your EJBs?
-dongmei
Similar Messages
-
Error in Calling Weblogic EJB's from JRun servlet engine
I am using servlets in Jrun engines to callEJB's running on a WebLogic Server. I have included "c:\weblogic\classes" in Jrun classpath. But i am getting the following error. Does any body have any idea what this may be??javax.servlet.ServletException: com/sun/java/util/collections/ArrayListjava.lang.NoClassDefFoundError: com/sun/java/util/collections/ArrayListat weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:193)at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)at javax.naming.InitialContext.init(InitialContext.java:222)at javax.naming.InitialContext.(InitialContext.java:198)
First off, wrong forum section.
Check if your JNDI name is correctly placed for the bean you're calling -- check j2ee-engine.xml for that. Check the EJB container if the ear file you deployed is there and updated.
Try placing "localejbs/JNDI name" on your lookup parameter.
Regards,
Jan -
Calling foreign EJB server from Weblogic
Hi,
I'm trying to invoke an EJB hosted in an old PowerTier EJB Container from an 8.1 SP5 hosted EJB, and I'm running in to problems. (PowerTier is based on the JBroker ORB)
So far the only way I can get it to work is by replacing Weblogic's ORB implementation with the JBroker one:
-Djavax.rmi.CORBA.StubClass=com.sssw.jbroker.rmi.StubDelegate
-Djavax.rmi.CORBA.UtilClass=com.sssw.jbroker.rmi.UtilDelegate
-Djavax.rmi.CORBA.PortableRemoteObjectClass=com.sssw.jbroker.rmi.PortableRemoteObjectDelegate
But I'd like to avoid doing this if possible.
So I'd like to get this to work using the WL RMI-IIOP implementation to integrate with the PowerTier/JBroker server.
After looking at : http://forums.bea.com/bea/message.jspa?messageID=202437541&tstart=0
I tried the following:
Properties config = new Properties();
config.setProperty(
Context.PROVIDER_URL, "<b>iiop</b>://xxx.xxx.xxxxx.xxx:389/cn=Instance1,ou=Development,cn=Xxxx%20Xxxxxxx%20Xxxxx,ou=Components,cn=Xxxxxx%20Xxxx,ou=Applications,o=xxxxxxxx,c=uk");
InitialContext context = new InitialContext(config);
URL changed to protect the innocent - but format maintained.
When the server executes this I get the following exception:
javax.naming.InvalidNameException: url does not contain a port
at weblogic.corba.j2ee.naming.NameParser.parseURL(NameParser.java:419)
at weblogic.corba.j2ee.naming.ORBHelper.parseURL(ORBHelper.java:533)
at weblogic.corba.j2ee.naming.ORBHelper.getORBReference(ORBHelper.java:440)
at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:97)
at weblogic.corba.j2ee.naming.InitialContextFactoryImpl.getInitialContext(InitialContextFactoryImpl.java:42)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:135)
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.<init>(InitialContext.java:195)
Any idea what is causing this exception? If I replace the '%20' with a normal spaces it makes no difference.
Am I going about this the right way?
Thanks!Getting a bit closer now.
The Object retreived from LDAP was a javax.naming.Reference - which contains the IOR for the Home interface.
// Get IOR from LDAP
InitialContext context;
Hashtable config = new Hashtable();
config.put(Context.PROVIDER_URL,"ldap://<host>:389/");
config.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
context = new InitialContext(config);
Reference reference = (Reference)context.lookup("<path to home>");
// Get IOR from reference
String ior = "" + reference.get(0).getContent();
// Get WLS ORB
ORB orb = (ORB)new InitialContext().lookup("java:comp/ORB");
Object object = orb.string_to_object(ior);
FooHome home = (FooHome)PortableRemoteObject.narrow(object, FooHome.class);
Foo foo = home.create();
// Everything works fine up to here.
foo.invokeMethod(); // <-- This fails with the following exception :
java.rmi.RemoteException: ; nested exception is:
org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
at weblogic.iiop.OutboundRequestImpl.sendReceive(OutboundRequestImpl.java:197)
at weblogic.iiop.IIOPRemoteRef.invokeInternal(IIOPRemoteRef.java:205)
at weblogic.iiop.IIOPRemoteRef.invoke(IIOPRemoteRef.java:153)
at ztkt.pl.Foo_IIOP_WLStub.invokeMethod(Unknown Source)
at com.xyz.ezs.wl.ejb.PLProxyBean.invoke(PLProxyBean.java:56)
at com.xyz.ezs.wl.ejb.PLProxy_o3b3ao_EOImpl.invoke(PLProxy_o3b3ao_EOImpl.java:45)
at com.xyz.ezs.wl.ejb.PLProxy_o3b3ao_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:492)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:435)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:430)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: org.omg.CORBA.BAD_OPERATION: vmcid: 0x0 minor code: 0 completed: No
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:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at weblogic.iiop.ReplyMessage.getThrowable(ReplyMessage.java:337)
at weblogic.iiop.InboundResponseImpl.getThrowable(InboundResponseImpl.java:62)
at weblogic.iiop.OutboundRequestImpl.sendReceive(OutboundRequestImpl.java:179)
... 15 more
(Method, class and package names changed.)
Has anyone seen this before? Any idea what might be causing it? -
Calling EJB deployed on Weblogic 10.3 from WebSphere Application Server 6
Hi,
We are trying to call an EJB(2.1) deployed in Weblogic 10.3 from WebSphere Application Server 6.
The problem is that the jars containing Weblogic's initial context factory are compiled with JDK5. (Client jar was built as per [http://download.oracle.com/docs/cd/E15051_01/wls/docs103/client/jarbuilder.html] .)
WebSphere is still running on JDK1.4.
Therefore when trying to get the InitialContext to lookup up the bean we get major/minor version errors because of the compiler level mismatch.
Has anyone faced a scenario like this and come up with a solution?
Are there 1.4 jars for Weblogic 10.3 out there?
Any help?
ThanksHi Dan,
Yes I am using EJB 3. I saw this thread earlier also but :
1. In my case I am not calling the EJB 3.0 methods directly. I am using a java client (Cataloged as a Java Class Library) which does the lookup and calls the EJB methods. (I am not cataloging and calling the EJB 3.0 methods directly).
2. It is working perfectly fine when the EJB is deployed in Weblogic 10.0 or 10.2.
I am very much new to this so please bear with my small and silly questions! Thanks a lot for you help !
Cheers !
Rajat -
How can one invoke a WebLogic EJB from a BPEL Server hosted on OC4J?
How can one invoke a WebLogic EJB from a BPEL Server hosted on OC4J?
Reason I ask is I keep getting this error:
javax.naming.NoInitialContextException: Cannot instantiate cla
ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
oundException: weblogic.jndi.WLInitialContextFactory]
Note: I am using <bpelx:exec> as a way to execute some java program.
Essentially my java client (essentially an EJB client hosted on Oc4J) needs access to wlclient.jar since it needs access to weblogic.jndi.WLInitialContextFactory. I have a EJB client running on BPEL server hosted on Oc4J that needs to access some EJBs hosted on weblogic.
Where do I place this wlclient.jar so that BPEL PM can start peacefully and at runtime discover the InitialContextFactory classes?
Placing it in the j2ee/home/applib doesn't solve the problem. The server fails to start up if I do this
I tried placing it in BPEL-INF\lib directory ...
I still get the same exception...see below for exception dump
I verified the BPEL suitcase, and it in fact does contain the jar file wlclient.jar
integration\orabpel\domains\default\deploy contains the bpel_BPELProcess2_1.0.jar file and snapshot of that is as follows:
<PRE>
│ bpel.xml
│ BPELProcess2.bpel
│ BPELProcess2.jpr
│ BPELProcess2.wsdl
│ bpel_BPELProcess2_1.0.jar
│ build.xml
│ buildxml.copy
│ graphics.xml
│
├───BPEL-INF
│ └───lib
│ myEJB.jar
│ wlclient.jar
│
├───META-INF
│ MANIFEST.MF
│
└───output
bpel_BPELProcess2_1.0.jar
</PRE>
I tried using the BPEL-INF\jar directory...Is this something the obant automatically detects? or do I have to modify the build.xml? I created this directory and let Jdev deploy to local BPEL server->default domain handle it
#####################3
I even tried copying the wlclient.jar to
integration\orabpel\system\classes but this doesn't help since the BPEL PM fails to start if I explode this jar into this directory.
In short,where do I place the wlclient.jar so that this exception can be contained.
I edited the build.xml to point to the jar, that too didn't work, unless I made some mistake in the file
<bpelc classpath="${basedir}/BPEL-INF/classes;${home}/system/classes;${home}/lib/j2ee_1.3.01.jar;${basedir}/BPEL-INF/jar/wlclient.jar" input="${basedir}/bpel.xml" rev="${rev}" deploy="${deploy}" />
</target>
</project>
DETAILS on ERROR
I get the following error
Process "BPELProcess2" (revision "1.0") successfully compiled.
<2005-12-14 09:17:55,770> <INFO> <default.collaxa.cube.engine.deployment> Proces
s "BPELProcess2" (revision "1.0") successfully loaded.
05/12/14 09:18:36 weblogic.jndi.WLInitialContextFactory
javax.naming.NoInitialContextException: Cannot instantiate cla
ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
oundException: weblogic.jndi.WLInitialContextFactory]
05/12/14 09:18:36 at javax.naming.spi.NamingManager.getInitialContext(Nami
ngManager.java:652)
05/12/14 09:18:36 at javax.naming.InitialContext.getDefaultInitCtx(Initial
Context.java:243)
05/12/14 09:18:36 at javax.naming.InitialContext.init(InitialContext.java:
219)
05/12/14 09:18:36 at javax.naming.InitialContext.<init>(InitialContext.jav
a:195)
05/12/14 09:18:36 at com.ejb.test.MapFinder.getDefaultMapName(Map
Finder.java:37)
##################3
with the bpelx all I have is two lines of code that creates a java object and calls a method on it.
The method does this:
private String initialContextFactory = "weblogic.jndi.WLInitialContextFactory";
private String providerUrl = "t3://localhost:7001";
private String urlPkgPrefixes = "";
private String mapEjbJndiName = "ejb/mycompany/Redlands";
public String getDefaultMapName() {
try {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, getInitialContextFactory());
env.put(Context.PROVIDER_URL, getProviderUrl());
if (getUrlPkgPrefixes() != null && !getUrlPkgPrefixes().equals(""))
env.put(Context.URL_PKG_PREFIXES, getUrlPkgPrefixes());
System.out.println(" " + getInitialContextFactory());
System.out.println(" " + getProviderUrl());
System.out.println(" " + getUrlPkgPrefixes());
System.out.println(" " + getEjbName());
// Get a naming context
context = new InitialContext(env);
Object ms = context.lookup(getEjbName());
MyEJBHome home = (MyEJBHome ) PortableRemoteObject.narrow(ms, MyEJBHome.class);
myEjb = home.create();
return myEjb.getDefaultName();
} catch (RemoteException re){
System.out.println(re.getCause().getMessage());
catch (Exception ex) {
ex.printStackTrace();
return null; //if unable to resolve the context factory etc...
}I did exactly as you suggested. I edited the application.xml and added this
<library path="C:\ArcGIS\test\bea\wlclient.jar"/>
I didn't add weblogic because the needed classes were all in wlclient.jar
I also edited the BASE_OB_CLASSPATH to include this jar.
Here is the result when I just start BPEL PM Server. Somehow BPEL PM doesn't like to have wlclient.jar in its classpath during startup.
Failed to create "worker" bean; exception reported is: "javax.naming.NameNotFoun
dException: remaining name: env
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:49)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:57)
at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:62)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.collaxa.cube.engine.ejb.impl.WorkerBean.ejbCreate(WorkerBean.java
:49)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.evermind.server.ejb.MessageDrivenHome.getInstance(MessageDrivenHo
me.java:1235)
at com.evermind.server.ejb.MessageDrivenHome$2.run(MessageDrivenHome.jav
a:1150)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(Relea
sableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
<2005-12-29 13:39:05,281> <ERROR> <collaxa> <ServerManager::loadAllDomains>
ORABPEL START-UP ERROR!!!!!!!!
OraBPEL run-time system failed to start due to exception:
Could not initialize jms connection pool.
Could not initialize connection pool for connection factory "java:comp/env/jms/
ollaxa/BPELInvokerQueueFactory"; the reason is remaining name: env/jms/collaxa/
PELInvokerQueueFactory.
Note: So what I did was to removed the entry from application.xml and tried with just obsetenv.bat having the wlclient.jar added to it. This too failed!!
Here is a snapshot of the error I got.
Process "BPELProcess2" (revision "1.0") successfully compiled.
<2005-12-29 13:53:11,207> <INFO> <default.collaxa.cube.engine.deployment> Proces
s "BPELProcess2" (revision "1.0") successfully loaded.
05/12/29 13:53:32 Cannot instantiate class: weblogic.jndi.WLInitialContextFactor
y
05/12/29 13:53:32 javax.naming.NoInitialContextException: Cannot instantiate cla
ss: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotF
oundException: weblogic.jndi.WLInitialContextFactory]
05/12/29 13:53:32 at javax.naming.spi.NamingManager.getInitialContext(Nami
ngManager.java:652)
05/12/29 13:53:32 at javax.naming.InitialContext.getDefaultInitCtx(Initial
Context.java:243)
05/12/29 13:53:32 at javax.naming.InitialContext.init(InitialContext.java:
219)
05/12/29 13:53:32 at javax.naming.InitialContext.<init>(InitialContext.jav
a:195)
05/12/29 13:53:32 at com.esri.adf.ejb.test.MapFinder.getDefaultMapName(Map
Finder.java:57)
05/12/29 13:53:32 at bpel.p0.ExecLetBxExe1.execute(ExecLetBxExe1.java:62)
05/12/29 13:53:32 at com.collaxa.cube.engine.ext.wmp.BPELXExecWMP.__execut
eStatements(BPELXExecWMP.java:49)
05/12/29 13:53:32 at com.collaxa.cube.engine.ext.wmp.BPELActivityWMP.perfo
rm(BPELActivityWMP.java:185)
05/12/29 13:53:32 at com.collaxa.cube.engine.CubeEngine.performActivity(Cu
beEngine.java:3398)
05/12/29 13:53:32 at com.collaxa.cube.engine.CubeEngine.handleWorkItem(Cub
eEngine.java:1905)
05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.message.instance.Per
formMessageHandler.handleLocal(PerformMessageHandler.java:75)
05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.DispatchHelper.handl
eLocalMessage(DispatchHelper.java:100)
05/12/29 13:53:32 at com.collaxa.cube.engine.dispatch.DispatchHelper.sendM -
Using ejb service from a servlet in Weblogic 6.0sp1
anybody had sucess using ejb service from a servlet in Weblogic
6.0sp1 ?
It worked in Weblogic 6.0. But in 6.0sp1, the servlet startup always
return me "ClassCastException"
when narrowing a lookup of an ejbHome to the specific class.
Using this same ejb service from a standalone Java client wotked
fine in both versions.
Any body has aby clue ?
Help greatly appreciated
hyliu
The ejbc'ed jar needs to be in the CLASSPATH of the servlet server.
Gene
"Haiyang Liu" <[email protected]> wrote in message news:3ab2670c$[email protected]..
>
> anybody had sucess using ejb service from a servlet in Weblogic
> 6.0sp1 ?
>
> It worked in Weblogic 6.0. But in 6.0sp1, the servlet startup always
> return me "ClassCastException"
> when narrowing a lookup of an ejbHome to the specific class.
> Using this same ejb service from a standalone Java client wotked
> fine in both versions.
>
> Any body has aby clue ?
>
> Help greatly appreciated
>
> hyliu
>
-
Jul 2, 2013 1:24:14 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.ClassNotFoundException: ejb3.onlyejb.Int6_cls
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
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:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ejb3.onlywed.Action_cls.execute(Action_cls.java:62)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
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:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Jul 2, 2013 1:24:21 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'
Jul 2, 2013 1:24:21 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: init: Global resources are available
Jul 2, 2013 1:24:21 PM org.apache.catalina.core.ApplicationContext log
INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'
accno=77
na=nj
bal=88.0
enter in to if loop
jndi properties nuderprocess
jndi properties nuderprocess22
loading p file={java.naming.provider.url=t3://localhost:7001, java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory}
loading p file over=javax.naming.InitialContext@725967
jndi file is loaded
entry in try block
Jul 2, 2013 1:24:42 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet action threw exception
java.lang.ClassNotFoundException: ejb3.onlyejb.Int6_cls
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.getClassBytes(RemoteBizIntfClassLoader.java:151)
at weblogic.ejb.container.deployer.RemoteBizIntfClassLoader.loadClass(RemoteBizIntfClassLoader.java:96)
at weblogic.ejb.container.internal.RemoteBusinessIntfGenerator.generateRemoteInterface(RemoteBusinessIntfGenerator.java:54)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:205)
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:597)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1846)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:197)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:564)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:193)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:240)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
at weblogic.jndi.internal.ServerNamingNode_1030_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:392)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at ejb3.onlywed.Action_cls.execute(Action_cls.java:62)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
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:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
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:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)Stop multiposting. Mod: locking
-
Help: I'm sure it is a Bug in JNI calling WebLogic EJB
Help me! I'm using jni to call weblogic EJB from a Com+ component,here is the code:
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#pragma unmanaged
#include <windows.h>
#include <jni.h>
#include <process.h>
#include <stdio.h>
#define USER_CLASSPATH "C:\\myClasses;C:\\j2sdk1.4.0\\lib\\tools.jar;Z:\\wlserver6.1\\lib\\weblogic.jar;"
/* where Prog.class is */
JavaVM *jvm;
* Function GetJNIEnv(void) returns the java environment pointer
* in case we are executing on a thread other than the one the
* jvm was created on.
JNIEnv* GetJNIEnv(void){
JNIEnv *env = NULL;
jint nRet = jvm->GetEnv((void **)&env, JNI_VERSION_1_2);
if(nRet == JNI_EDETACHED){
jvm->AttachCurrentThread((void **)&env, NULL);
return env;
* Function DoJNDI(void *arg) uses the Java Invocation API to
* execute the following Java code:
* Hashtable prop = new Hashtable();
* prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"
* prop.put( Context.PROVIDER_URL, "t3://192.168.40.137:7001" );
* ctxInitial = new InitialDirContext( prop );
void DoJNDI(void *arg){
jclass clsHash, clsInitDirCx;
jmethodID mHashInit, mHashPut, mInitDirCxInit;
jobject objHash, objInitDirCx;
JNIEnv *env = GetJNIEnv(); // Get the environment if on a different thread
clsHash = env->FindClass("java/util/Hashtable");
mHashInit = env->GetMethodID(clsHash, "<init>", "()V");
objHash = env->NewObject(clsHash, mHashInit);
mHashPut = env->GetMethodID(clsHash, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
jstring jstrICxFactoryPut = env->NewStringUTF("java.naming.factory.initial");
jstring jstrICxFactoryVal = env->NewStringUTF("weblogic.jndi.WLInitialContextFactory");
env->CallObjectMethod(objHash, mHashPut, jstrICxFactoryPut,jstrICxFactoryVal);
jstring jstrProviderUrlPut = env->NewStringUTF("java.naming.provider.url");
jstring jstrProviderUrlVal = env->NewStringUTF("t3://192.168.40.137:7001");
env->CallObjectMethod(objHash, mHashPut, jstrProviderUrlPut,jstrProviderUrlVal);
clsInitDirCx = env->FindClass("javax/naming/InitialContext");
mInitDirCxInit = env->GetMethodID(clsInitDirCx, "<init>", "(Ljava/util/Hashtable;)V");
objInitDirCx = env->NewObject(clsInitDirCx, mInitDirCxInit, objHash);
if(objInitDirCx == NULL){
printf("%s test FAILED:\n\n", (char*)arg);
else{
printf("%s test PASSED\n\n", (char*)arg);
jvm->DetachCurrentThread();
* Function main(void) creates a JVM, and calls DoJNDI twice:
* Once as a regular function call, and once as a spun off thread.
void main() {
JavaVMInitArgs vm_args;
JavaVMOption options[5];
options[0].optionString = "-client";
options[1].optionString =
"-cp " USER_CLASSPATH;
options[2].optionString =
"-Djava.class.path=" USER_CLASSPATH;
//options[3].optionString =
// "-Xbootclasspath:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;z:\\wlserver6.1\\lib\\weblogic.jar;";
options[3].optionString =
"-Xbootclasspath/a:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
options[4].optionString =
"-Xbootclasspath/p:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_TRUE;
JNIEnv *env;
jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
// *** Make the magic calls! (Both lines should do the same thing) ***
DoJNDI((void*)"Function call");
_beginthread(DoJNDI,0,(void *)"Thread call");
/* wait for thread(s) to finish */
Sleep(5000);
jvm->DestroyJavaVM();
But it always send me a Exception like below:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
when I search this problem in java.sun.com,an article announce that it is a bug that
JNDI not support multi-threads call,and it is fixed is JDK1.4 beta. The link is:
http://developer.java.sun.com/developer/bugParade/bugs/4307751.html
It seems that weblogic's JNDI is not support multi-thread call. what can i do?Try adding the following code before instantiating your initial context:
Thread.currentThread().setContextClassLoader( ClassLoader.getSystemClassLoader()
This fixed the problem for me.
-Brian
"Edward Lu" <[email protected]> wrote:
>
Help me! I'm using jni to call weblogic EJB from a Com+ component,here is
the code:
// This is the main project file for VC++ application project
// generated using an Application Wizard.
#include "stdafx.h"
#pragma unmanaged
#include <windows.h>
#include <jni.h>
#include <process.h>
#include <stdio.h>
#define USER_CLASSPATH "C:\\myClasses;C:\\j2sdk1.4.0\\lib\\tools.jar;Z:\\wlserver6.1\\lib\\weblogic.jar;"
/* where Prog.class is */
JavaVM *jvm;
* Function GetJNIEnv(void) returns the java environment pointer
* in case we are executing on a thread other than the one the
* jvm was created on.
JNIEnv* GetJNIEnv(void){
JNIEnv *env = NULL;
jint nRet = jvm->GetEnv((void **)&env, JNI_VERSION_1_2);
if(nRet == JNI_EDETACHED){
jvm->AttachCurrentThread((void **)&env, NULL);
return env;
* Function DoJNDI(void *arg) uses the Java Invocation API to
* execute the following Java code:
* Hashtable prop = new Hashtable();
* prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"
* prop.put( Context.PROVIDER_URL, "t3://192.168.40.137:7001" );
* ctxInitial = new InitialDirContext( prop );
void DoJNDI(void *arg){
jclass clsHash, clsInitDirCx;
jmethodID mHashInit, mHashPut, mInitDirCxInit;
jobject objHash, objInitDirCx;
JNIEnv *env = GetJNIEnv(); // Get the environment if on a different thread
clsHash = env->FindClass("java/util/Hashtable");
mHashInit = env->GetMethodID(clsHash, "<init>", "()V");
objHash = env->NewObject(clsHash, mHashInit);
mHashPut = env->GetMethodID(clsHash, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
jstring jstrICxFactoryPut = env->NewStringUTF("java.naming.factory.initial");
jstring jstrICxFactoryVal = env->NewStringUTF("weblogic.jndi.WLInitialContextFactory");
env->CallObjectMethod(objHash, mHashPut, jstrICxFactoryPut,jstrICxFactoryVal);
jstring jstrProviderUrlPut = env->NewStringUTF("java.naming.provider.url");
jstring jstrProviderUrlVal = env->NewStringUTF("t3://192.168.40.137:7001");
env->CallObjectMethod(objHash, mHashPut, jstrProviderUrlPut,jstrProviderUrlVal);
clsInitDirCx = env->FindClass("javax/naming/InitialContext");
mInitDirCxInit = env->GetMethodID(clsInitDirCx, "<init>", "(Ljava/util/Hashtable;)V");
objInitDirCx = env->NewObject(clsInitDirCx, mInitDirCxInit, objHash);
if(objInitDirCx == NULL){
printf("%s test FAILED:\n\n", (char*)arg);
else{
printf("%s test PASSED\n\n", (char*)arg);
jvm->DetachCurrentThread();
* Function main(void) creates a JVM, and calls DoJNDI twice:
* Once as a regular function call, and once as a spun off thread.
void main() {
JavaVMInitArgs vm_args;
JavaVMOption options[5];
options[0].optionString = "-client";
options[1].optionString =
"-cp " USER_CLASSPATH;
options[2].optionString =
"-Djava.class.path=" USER_CLASSPATH;
//options[3].optionString =
// "-Xbootclasspath:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;z:\\wlserver6.1\\lib\\weblogic.jar;";
options[3].optionString =
"-Xbootclasspath/a:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
options[4].optionString =
"-Xbootclasspath/p:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 5;
vm_args.ignoreUnrecognized = JNI_TRUE;
JNIEnv *env;
jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
// *** Make the magic calls! (Both lines should do the same thing) ***
DoJNDI((void*)"Function call");
_beginthread(DoJNDI,0,(void *)"Thread call");
/* wait for thread(s) to finish */
Sleep(5000);
jvm->DestroyJavaVM();
But it always send me a Exception like below:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:207)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
when I search this problem in java.sun.com,an article announce that it is
a bug that
JNDI not support multi-threads call,and it is fixed is JDK1.4 beta. The
link is:
http://developer.java.sun.com/developer/bugParade/bugs/4307751.html
It seems that weblogic's JNDI is not support multi-thread call. what can
i do? -
How to call the EJB methods from servlet/jsp
Hello ,
i have write one ejb signOn having the method validateUser(username,password).i can able to call this function from client.java class.i want to know whether i can call this function from servlet.if yes then where to write that servlet and web.xml file.
At present i m using weblogic server 8.1and i create directory call c:\ejb\demo and put the ejb files(home ,remote,ejb class ,client.java) then i have created .jar file and put in application file.
Now i want to create a servlet for that i have to create a new directory and put the servlet,web.xml,weblogin-web.xml file and then create one .war file and put in application directory or do some thing extra.Please help me.
Thanks In Advance
[email protected]I think this might not be the most appropriate forum for your question. You might try a forum about ejb, or weblogic, or jndi.
-
Failed to use EJB's from startup class
Hi,
we use a startup class to set up some base services of our application.
The startup class must call some remote methods in a EJB. Unfortunately
a CLassCastException is thrown when we try to create the EJB by calling
the create method on its home interface:
Fr Nov 17 10:47:50 GMT+01:00 2000:<I> <WebLogicServer> Invoking
T3StartupDef ibs
startup ch.ebs.ibs.IBSStartup with {}
java.lang.ClassCastException: weblogic.t3.srvr.StartupThread
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java:34)
at
weblogic.rmi.extensions.BasicRequestDispatcher.dispatch(BasicRequestD
ispatcher.java:82)
at
weblogic.rmi.internal.ServerRequest.sendOneWay(ServerRequest.java:73)
at
weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:77
at
ch.ebs.ibs.ejb.SessionControllerEJBHomeImpl_WLStub.create(SessionCont
rollerEJBHomeImpl_WLStub.java:151)
at ch.ebs.ibs.IBSStartup.startup(IBSStartup.java:69)
at
weblogic.t3.srvr.StartupThread.runStartup(StartupThread.java:182)
at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java:146)
at
weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java
:62)
The same code works fine if we run it as client code (not in the startup
sequence).
Any idea?
Thanks PascalRegarding your problem and the remark you posted to my question in "Calling
EJBs from a thread in a startup class": It is possible to call methods of an
EJB from a startup class. I use this functionality to route messages from
JMS to my EJBs. From what you say, I assume that you are calling the EJB
from your startup method, which might be a problem, since WL is not
initialized at this point and does not accept any connections (this
obviously includes internal connections). You should wait for this phase to
finish and then use some other mechanism (e.g. a JMS message) to trigger
your startup class to invoke any home or remote methods on the EJB.
Looking at your stack trace, I am reminded of a very similar exception I
encountered when I was experimenting with WL a short while ago. I had put my
EJB jar file on WL's JAVA_CLASSPATH, just to see how the different
classloaders work. Of course I don't know if this has any relevance to your
configuration.
Andy
PS: The only exception to what I wrote in the first paragraph seems to be if
you start a new thread from the startup class. I still haven't managed to
call my EJB from this thread.
Pascal Rudin wrote:
Hi,
we use a startup class to set up some base services of our application.
The startup class must call some remote methods in a EJB. Unfortunately
a CLassCastException is thrown when we try to create the EJB by calling
the create method on its home interface:
Fr Nov 17 10:47:50 GMT+01:00 2000:<I> <WebLogicServer> Invoking
T3StartupDef ibs
startup ch.ebs.ibs.IBSStartup with {}
java.lang.ClassCastException: weblogic.t3.srvr.StartupThread
at
weblogic.rmi.extensions.BasicRequestHandler.handleRequest(BasicReques
tHandler.java:34)
at
weblogic.rmi.extensions.BasicRequestDispatcher.dispatch(BasicRequestD
ispatcher.java:82)
at
weblogic.rmi.internal.ServerRequest.sendOneWay(ServerRequest.java:73)
at
weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:77
at
ch.ebs.ibs.ejb.SessionControllerEJBHomeImpl_WLStub.create(SessionCont
rollerEJBHomeImpl_WLStub.java:151)
at ch.ebs.ibs.IBSStartup.startup(IBSStartup.java:69)
at
weblogic.t3.srvr.StartupThread.runStartup(StartupThread.java:182)
at weblogic.t3.srvr.StartupThread.doWork(StartupThread.java:146)
at
weblogic.t3.srvr.PropertyExecuteThread.run(PropertyExecuteThread.java
:62)
The same code works fine if we run it as client code (not in the startup
sequence).
Any idea?
Thanks Pascal -
How will be the weblogic-ejb-jar and ejb-jar xml for EJB Local Interface?
Hi,
I have one ear application which is using Stateless Session Beans. I don't have any Bean to Bean communication . At present, the client is invoking remote methods thro Home/Remote interfaces. My doubt is , shall I implement EJBLocal home/ local interface to obtain this same functionality cos, in this app, both client and EJb bean have been deployed in same JVM. Can Local interfaces only be applicable to Bean - Bean relation ship?If LocalHome/Local interfaces can be implemented in my scenario, then may I know how will be the ejb-jar.xml and weblogic-ejb-jar.xml?
thanks and regards,
Venkat.Local interfaces are for communication between ejbs and their clients when both are in the same JVM. The clients can be normal clients, jsps, servlets, and other ejbs. If the client is not in the same JVM you cannot use local interfaces even though your client is another ejb.
Advantage of using local interface is it reduces the network overhead.
For more information you can download Mastering Enterprise Java Beans Third Edition by Ed Roman. You can go through 45
You can download pdf version from.
http://www.theserverside.com/books/wiley/masteringEJB/index.tss.
Let me know the URL of the ejb doc that you referred.
Thanks.. -
BPM start event(start condition) doesn't support ejb function call?
Hi all,
An id is included in the ws call to trigger the bpm flow,
I have developed a ejb function, which is doing a simple check whether the process for the specific id is called before or not.
I have a simple table in bpm java server which records the id used before.
the ejb is called in the start condition, my desired behavior is: if the ejb returns true, no process should be triggered.
but the thing is, my flow is not getting triggered once I put the ejb call in the start condition.(ejb is called, as i can see new id record inserted into my db table)
I cannot even debug the process.
I can debug the process if that ejb call is removed from the start condition.
my server is 7.31 sp8
Best regards,
JunThanks for confirming Jun Wu.... always comforting to see even the experts can stuff it up from time to time... and very glad you were able to fix it!
-
NoSuchMethodError when invoking EJB Component From BPM Process
Hi,
I created BPM process which contains global creation activity and user interactive activity and catalogued ejb component. In user interactive activity i wrote the Process Business Language to invoke Remote EJB deployed in weblogic server. When i tried to execute user interactive activity, i got the following exception.
Caused by: java.lang.NoSuchMethodError: weblogic.kernel.KernelStatus.isThinIIOPClient()Z
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.readObject(RemoteBusinessIntfProxy.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at java.io.ObjectStreamClass.invokeReadObject(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:62)
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:201)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at weblogic.jndi.internal.ServerNamingNode_921_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:374)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:362)
at javax.naming.InitialContext.lookup(Unknown Source)
at fuego.jndi.FaultTolerantContext.lookup(FaultTolerantContext.java:515)
at fuego.connector.impl.BaseRemoteConnector.getReferencedObject(BaseRemoteConnector.java:116)
at fuego.connector.impl.BaseRemoteConnector.getReferencedObject(BaseRemoteConnector.java:107)
at fuego.ejb.EJBConnector.getEJBHome(EJBConnector.java:62)
at fuego.ejb.EJBConnector.getEJBHome(EJBConnector.java:52)
at fuego.ejb.EJBConnector.getResource(EJBConnector.java:101)
at fuego.ejb.EJBConnector.getResource(EJBConnector.java:91)
at fuego.ejb.EJBConnector.getResource(EJBConnector.java:79)
at fuego.connector.ConnectorTransaction.getResource(ConnectorTransaction.java:276)
at fuego.connector.EJBHelper.getEJBHome(EJBHelper.java:36)
at fuego.connector.EJBHelper.getEJBHome(EJBHelper.java:30)
at fuego.ejb.EJBHome.locate(EJBHome.java:119)
at OrderManagement.SampleOrderProcess.Default_1_0.Instance.CIL_submitOrder(Instance.xcdl:1)
at OrderManagement.SampleOrderProcess.Default_1_0.Instance.CIL_submitOrder(Instance.xcdl)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:512)
what i noticed here is in Oracle BPM Studio there is weblogic jar file which contains Kernel status file. The KernelStatus file do not have "isThinIIOPClient method". But in wlclient jar file there is Kernel status class which contains "isThinIIOPClient" method.
How can I override the weblogic.jar and wlclient.jar for Oracle BPM?
Please help me to resolve this problem.
Thanks and Regards
Mahesh BabuI resolved the above issue by generating ejb2.1 session bean and ejb2.1 client. But When i tried to invoke ejb2.1 session bean from process using Process Business Language, it throws the following exception.
Task failed.
Caused by: Task '0' in activity '/SampleOrderProcess#Default-1.0/Interactive[SubmitOrder]' for instance '/SampleOrderProcess#Default-1.0/1/0' could not be successfully executed. The task failed while executing method 'submitOrder'.
Caused by: The method 'CIL_submitOrder' from class 'OrderManagement.SampleOrderProcess.Default_1_0.Instance' could not be successfully executed.
Caused by: java.lang.IncompatibleClassChangeError
Caused by: fuego.lang.ComponentExecutionException: The method 'CIL_submitOrder' from class 'OrderManagement.SampleOrderProcess.Default_1_0.Instance' could not be successfully executed.
at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:519)
at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:273)
at fuego.fengine.FEEngineExecutionContext.invokeMethodAsCil(FEEngineExecutionContext.java:219)
at fuego.server.execution.EngineExecutionContext.runCil(EngineExecutionContext.java:1280)
at fuego.server.execution.TaskExecution.invoke(TaskExecution.java:401)
at fuego.server.execution.InteractiveNormalCilExecution.invoke(InteractiveNormalCilExecution.java:425)
at fuego.server.execution.TaskExecution.executeCIL(TaskExecution.java:513)
at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:697)
at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:657)
at fuego.server.execution.TaskExecution.executeTask(TaskExecution.java:154)
at fuego.server.execution.microactivity.InteractiveMicroActivity.executeNormalCil(InteractiveMicroActivity.java:501)
at fuego.server.execution.microactivity.InteractiveMicroActivity.executeItem(InteractiveMicroActivity.java:454)
at fuego.server.execution.microactivity.InteractiveMicroActivity.execute(InteractiveMicroActivity.java:104)
at fuego.server.AbstractProcessBean$48.execute(AbstractProcessBean.java:3184)
at fuego.server.execution.DefaultEngineExecution$AtomicExecutionTA.runTransaction(DefaultEngineExecution.java:304)
at fuego.transaction.TransactionAction.startBaseTransaction(TransactionAction.java:470)
at fuego.transaction.TransactionAction.startTransaction(TransactionAction.java:551)
at fuego.transaction.TransactionAction.start(TransactionAction.java:212)
at fuego.server.execution.DefaultEngineExecution.executeImmediate(DefaultEngineExecution.java:123)
at fuego.server.execution.EngineExecution.executeImmediate(EngineExecution.java:66)
at fuego.server.AbstractProcessBean.runTask(AbstractProcessBean.java:3188)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at fuego.lang.JavaClass.invokeMethod(JavaClass.java:1410)
at fuego.lang.JavaObject.invoke(JavaObject.java:227)
at fuego.component.Message.process(Message.java:585)
at fuego.component.ExecutionThread.processMessage(ExecutionThread.java:780)
at fuego.component.ExecutionThread.processBatch(ExecutionThread.java:755)
at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:142)
at fuego.component.ExecutionThread.doProcessBatch(ExecutionThread.java:134)
at fuego.fengine.FEngineProcessBean.processBatch(FEngineProcessBean.java:244)
at fuego.component.ExecutionThread.work(ExecutionThread.java:839)
at fuego.component.ExecutionThread.run(ExecutionThread.java:408)
Caused by: java.lang.IncompatibleClassChangeError
at OrderManagement.SampleOrderProcess.Default_1_0.Instance.CIL_submitOrder(Instance.xcdl:5)
at OrderManagement.SampleOrderProcess.Default_1_0.Instance.CIL_submitOrder(Instance.xcdl)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at fuego.component.ExecutionThreadContext.invokeMethod(ExecutionThreadContext.java:512)
... 34 more
Please help me to resolve this issue.
Thanks and Regards
Mahesh Babu -
Can't I use the comment in weblogic-ejb-jar.xml?
Hi, I am migrating to WebLogic Server 6.1 from 5.1.
And for the weblogic-ejb-jar.xml,
the following error occurs:
ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 14: An invalid XML character
(Unicode: 0xb8) was found in the comment.
ERROR: ejbc found errors
The errorneous line is the following comment. (it's fine in 5.1)
<!-- if false, ... -->
Must I remove this comment?
Thanks in advance.I used Korean language in comment.
But the charset of XML was iso-8859-1.
Sorry.
"mariah" <[email protected]> wrote:
>
Hi, I am migrating to WebLogic Server 6.1 from 5.1.
And for the weblogic-ejb-jar.xml,
the following error occurs:
ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 14: An invalid
XML character
(Unicode: 0xb8) was found in the comment.
ERROR: ejbc found errors
The errorneous line is the following comment. (it's fine in 5.1)
<!-- if false, ... -->
Must I remove this comment?
Thanks in advance. -
How to call oracle function from ejb3
i'm trying to call an oracle query-function from ejb3.
The oracle function:
create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
m_sql VARCHAR2(250);
BEGIN
m_sql:='select count(thrId) from thread where secId='|| secid||'
and thrAvai='|| avai;
open cur for m_sql;
return cur;
END;
I'v tried several ways to call it,but all failed:
1. the calling code:
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");
query.setParameter(1, secId);
query.setParameter(2, avai);
return query.getSingleResult();
but i got the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
ORA-06550: row 1, col 7:
PL/SQL: Statement ignored
2. the calling code:
@SqlResultSetMapping(name = "getSecThreadCount_Mapping")
@NamedNativeQuery(name = "getSecThreadCount",
query = "{?=call getSecThreadCount(:secId,:avai)}",
resultSetMapping = "getSecThreadCount_Mapping",
hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
@QueryHint(name = "org.hibernate.readOnly", value = "true")})
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNamedQuery("getSecThreadCount");
query.setParameter("secId", secId);
query.setParameter("avai", avai);
return query.getSingleResult();
but i run into the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
Could anyone tell me how to call the function from EJB3?
Thanks.Here's a working model:
package.procedure: (created in example schema scott)
CREATE OR REPLACE package body data_pkg as
type c_refcursor is ref cursor;
-- function that return all emps of a certain dept
function getEmployees ( p_deptId in number
return c_refcursor
is
l_refcursor c_refcursor;
begin
open l_refcursor
for
select e.empno as emp_id
, e.ename as emp_name
, e.job as emp_job
, e.hiredate as emp_hiredate
from emp e
where e.DEPTNO = p_deptId;
return l_refcursor;
end getEmployees;
end data_pkg;
/entity class:
package net.app.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table (name="emp")
@SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
@NamedNativeQuery( name = "getEmpsByDeptId"
, query = "{ ? = call data_pkg.getEmployees(?)}"
, resultClass = Employee.class
, hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
, @QueryHint(name = "org.hibernate.readOnly", value = "true")
public class Employee implements Serializable
@Id
@Column(name="emp_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
private int id;
@Column(name="emp_name")
private String name;
@Column(name="emp_job")
private String job;
@Column(name="emp_hiredate")
private Date hiredate;
// constructor
public Employee (){}
// getters and setters
public int getId()
return id;
etc...session bean:
package net.app.entity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
@Stateless
public class ScottAdminImpl implements ScottAdmin
@PersistenceContext
private EntityManager entityManager;
@SuppressWarnings("unchecked")
public List<Employee> getEmployeesByDeptId(int deptId)
ArrayList<Employee> empList;
try
Query query = entityManager.createNamedQuery("getEmpsByDeptId");
query.setParameter(1, deptId);
empList = (ArrayList<Employee>) query.getResultList();
return empList;
catch (Exception e)
e.printStackTrace(System.out);
return null;
}client:
package net.app.client;
import java.util.List;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
public class ScottClient
public static void main(String[] args)
try
// create local interface
InitialContext ctx = new InitialContext();
ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
// select employees by deptno
int deptno = 20;
List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
// output
System.out.println("Listing employees:");
for (Employee emp : empList)
System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
catch (NamingException e)
e.printStackTrace(System.out);
}Basically you just ignore the refcursor outbound parameter.
This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
Edited by: _Locutus on Apr 2, 2009 2:37 PM
Maybe you are looking for
-
PLEASE HELP! Itunes library gone but music still on iPod
I recently have started organising my 'my music' files and deleting folders with more than 3 copies of songs, I have a lot of music 2500 songs and opened up itunes and all music I have imported (not bought) has gone, my music is still on my ipod thou
-
Why does iTunes ask for me to login when I start the Application?
I used to never have to enter my password right off the bat when I opened the iTunes program. Did an update start requiring this or did I mess with the settings. I tried clicking on on my account and resetting the warnings, but that didn't help. I al
-
Win 8.1 and J4680c All-in-One: Can't reinstall the printer/drivers
I have followed all of the instructions to re-set up my wireless network, uninstall the printer/drivers, and reinstall the printer/drivers (including renaming all of the .dat files as .old), but once it gets to the install wizard, at the Checking Sys
-
I get an error when I try to index the 11th excel worksheet
I tried to access the 11th worksheet in an Excel Workbook. I try to access it by using invoke method. When I do, I use an index of 11. My error code is -2147352 which is "Invalid Index."
-
Is their any way to post excise value as 100% Non Deductible. i.e : Excise amount will go into stock. Regards Rashid