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?
Thanks
Hi 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
Similar Messages
-
Calling rmi running in Weblogic 6.x from Jboss 4.0.5GA
Hi all,
Recently i have a project that needs me to call a remote ejb which is running in Weblogic 6.x. It is using Weblogic's proprietary protocol known as "t3". If i include weblogic.jar (i believe this version of weblogic doesn't deliver its client lib wlclient.jar) in my war file's WEB-INF/lib, i get this error:
2007-06-30 17:32:33,462 ERROR (GqsClient.java:93) - TestProject: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
I've tried to put it in server/default/lib but that throws another exception.
My test code:
Properties jndiProperties = new Properties();
jndiProperties.setProperty( Context.INITIAL_CONTEXT_FACTORY,
MY_INITIAL_CONTEXT_FACTORY );
jndiProperties.setProperty( Context.PROVIDER_URL, MY_PROVIDER_URL );
Context initialContext;
initialContext = new InitialContext( jndiProperties );
Object homeInt = initialContext.lookup( MY_EJB );
objectHome = ( SomeObjectHome ) PortableRemoteObject
.narrow( homeInt, SomeObjectHome.class );
objectRemote = objectHome.create();
Have i done anything wrong in the codes?
Where should i put my weblogic.jar?
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.test.service.TestRmiClient]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: methods with same signature getEJBMetaData() but incompatible return types: [interface javax.ejb.EJBMetaData, interface javax.ejb.EJBMetaData]
java.lang.IllegalArgumentException: methods with same signature getEJBMetaData() but incompatible return types: [interface javax.ejb.EJBMetaData, interface javax.ejb.EJBMetaData]
at sun.misc.ProxyGenerator.checkReturnTypes(ProxyGenerator.java:669)
at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:420)
at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:306)
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:501)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at weblogic.rmi.internal.ProxyStub.newInstance(ProxyStub.java:69)
at weblogic.rmi.internal.OIDManager.resolveObject(OIDManager.java:242)
at weblogic.common.internal.ChunkedObjectInputStream.resolveObject(ChunkedObjectInputStream.java:81)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputStream.resolveObject(ChunkedObjectInputStream.java:328)
at java.io.ObjectInputStream.checkResolve(ObjectInputStream.java:1352)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:139)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:152)
at weblogic.rmi.internal.ObjectIO.readObject(ObjectIO.java:56)
at weblogic.rmi.internal.BasicRemoteRef.unmarshalReturn(BasicRemoteRef.java:233)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:264)
at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:230)
at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:35)
at $Proxy15.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:342)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.dhl.apis.litetrace.service.GqsClient.init(GqsClient.java:84)
at com.dhl.apis.litetrace.service.GqsClient.<init>(GqsClient.java:57)
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 org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:52)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:490)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:366)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:144)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:321)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)
at com.dhl.apis.common.spring.context.CustomContextLoaderListener.contextInitialized(CustomContextLoaderListener.java:30)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
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.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
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.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:1
12:05:02,781 INFO [STDOUT] 55)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy10.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy11.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy7.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
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.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Thread.java:595)Message was edited by:
jinchurikiput weblogic.jar in tomcats classpath
Gary Bartlett wrote:
Question -
Can anyone point me at documentation that will help me
understand what jar files are required to allow access EJB's that are deployed in
Weblogic 6.1 from a Servlet that is running under Tomcat.
I am currently getting the following exception:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)
Thanks,
Gary Bartlett -
Calling a bean in weblogic 4.5 from a servlet which is in Iplanet webserver4.1
while Calling a bean in weblogic 4.5 from a servlet which is in Iplanet webserver4.1 sometimes the servlet is not able to call the bean. There is no error logged in webserver. This is happening very rarely and when it happens I have to shut and restart IplanetWS.
Can anyone tell me some solution or reason
Regards
NitinWe did receive a 4.5.1 / 5.1 interoperability patch - but it wasn't quite 'seamless'.
We never tried to use it.
SOAP? Isn't that around 50 times slower than RMI?
Mike
"Gary Mui" <[email protected]> wrote:
We ran into this issue last fall and got some feedback from weblogic
support. They originally said that it could be done (as well as different
versions talking to one another via JMS) but it turned out that they
were
incorrect and ended up saying that it is not possible. Before 6.0 went
GA,
BEA said that there would be a interoperability patch to do this, but
I've
never seen nor heard of anything regarding it. As a workaround, we
implemented 4.5.1 / 6.0 communication via SOAP.
Mike Reiche wrote in message <3b1bcaec$[email protected]>...
I have the same question - and more. Last year we were told that wecould
not use
RMI (and ejbs) between 4.5.1 and 5.1. Which seems kinda weird becauseI've
heard
of people using WL ejbs from Tomcat. This issue has caused us to avoidusing
WL ejbs in any future development which has any chance of ever beingused
by any
app server (WL included) that is not under the direct control of thedata
center.
I've been trying to convince the Architecture team here that we canuse WL
EJBs
and we can call them from other app servers - but can't seem to getany
supporting
statement from BEA (maybe I haven't tried hard enough).
Anyway, a response from BEA would be appreciated.
- Mike
"Madhu K" <[email protected]> wrote:
Is it possible to call a (stateless session) bean deployed in weblogic
6.0
from a bean in weblogic 5.1? I have two versions of weblogic running
on two
different hosts and I have to call a bean that is running in 6.0 from
5.1.
Are there any limitations?
Appreciate any feedback/suggestions.
Thanks,
Madhu -
Can we call a bean in Weblogic 6.0 from Weblogic 5.1
Is it possible to call a (stateless session) bean deployed in weblogic 6.0
from a bean in weblogic 5.1? I have two versions of weblogic running on two
different hosts and I have to call a bean that is running in 6.0 from 5.1.
Are there any limitations?
Appreciate any feedback/suggestions.
Thanks,
MadhuCross posted to 'misc' - please follow up on that newsgroup.
http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=xover&group=weblogic.developer.interest.misc&utag=
Mike
"Madhu K" <[email protected]> wrote:
Is it possible to call a (stateless session) bean deployed in weblogic
6.0
from a bean in weblogic 5.1? I have two versions of weblogic running
on two
different hosts and I have to call a bean that is running in 6.0 from
5.1.
Are there any limitations?
Appreciate any feedback/suggestions.
Thanks,
Madhu -
How deploy the EJB in security on the Sun Java System Application Server 9?
I hava deploied a simple Hello EJB Object on PE 9(Sun Java System Application Server Platform Edition 9). I can use this EJB object without user name an password On any client. See the following code section:
public static void main(String[] args) {
try{
Properties props = System.getProperties();
props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.enterprise.naming.SerialInitContextFactory");
props.put(Context.PROVIDER_URL,"iiop://localhost:3700");
Context ctx = new InitialContext(props);
Hello h = (Hello) ctx.lookup("ejb/test/Hello");
System.out.println(h.sayHello());
}catch(Exception e){
e.printStackTrace();
Please tell me how deploy the EJB in security on the Sun Java System Application Server 9? So that, The client must set the user name and password when lookup the ejb object. Like the following:
props.put(Context.SECURITY_PRINCIPAL,"admin")
props.put(Context.SECURITY_CREDENTIALS,"1234");Guys,
I too have the same issue. If anyone has an answer, please let me know.
Is this GlassFish problem? or Prgram issue?
Find below the source code
package TransactionSecurity.bean;
import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Remote;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
@Stateless
@Remote(TSCalculator.class)
@DeclareRoles({"student", "teacher"})
public class TSCalculatorBean implements TSCalculator {
private @Resource SessionContext ctx;
@PermitAll
// @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public int add(int x, int y) {
System.out.println("CalculatorBean.add Caller Principal:" + ctx.getCallerPrincipal().getName());
return x + y;
@RolesAllowed( { "student" })
public int subtract(int x, int y) {
System.out.println("CalculatorBean.subtract Caller Principal:" + ctx.getCallerPrincipal().getName());
System.out.println("CalculatorBean.subtract isCallerInRole:" + ctx.isCallerInRole("student"));
return x - y;
@RolesAllowed( { "teacher" })
public int divide(int x, int y) {
System.out.println("CalculatorBean.divide Caller Principal:" + ctx.getCallerPrincipal().getName());
System.out.println("CalculatorBean.divide isCallerInRole:" + ctx.isCallerInRole("teacher"));
return x / y;
package TransactionSecurity.bean;
import javax.ejb.Remote;
@Remote
public interface TSCalculator {
public int add(int x, int y);
public int subtract(int x, int y);
public int divide(int x, int y);
package TransactionSecurity.client;
import java.util.Properties;
import javax.ejb.EJBAccessException;
import javax.naming.Context;
import javax.naming.InitialContext;
import TransactionSecurity.bean.TSCalculator;
public class TSCalculatorClient {
public static void main(String[] args) throws Exception {
// Establish the proxy with an incorrect security identity
Properties env = new Properties();
env.setProperty(Context.SECURITY_PRINCIPAL, "kabir");
env.setProperty(Context.SECURITY_CREDENTIALS, "validpassword");
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
env.setProperty(Context.PROVIDER_URL,"iiop://127.0.0.1:3700");
env.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
env.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
env.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
env.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
env.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ctx = new InitialContext(env);
TSCalculator calculator = null;
try {
calculator = (TSCalculator) ctx.lookup(TSCalculator.class.getName());
} catch (Exception e) {
System.out.println ("Error in Lookup");
e.printStackTrace();
System.exit(1);
System.out.println("Kabir is a student.");
System.out.println("Kabir types in the wrong password");
try {
System.out.println("1 + 1 = " + calculator.add(1, 1));
} catch (EJBAccessException ex) {
System.out.println("Saw expected SecurityException: "
+ ex.getMessage());
System.out.println("Kabir types in correct password.");
System.out.println("Kabir does unchecked addition.");
// Re-establish the proxy with the correct security identity
env.setProperty(Context.SECURITY_CREDENTIALS, "validpassword");
ctx = new InitialContext(env);
calculator = (TSCalculator) ctx.lookup(TSCalculator.class.getName());
System.out.println("1 + 1 = " + calculator.add(1, 1));
System.out.println("Kabir is not a teacher so he cannot do division");
try {
calculator.divide(16, 4);
} catch (javax.ejb.EJBAccessException ex) {
System.out.println(ex.getMessage());
System.out.println("Students are allowed to do subtraction");
System.out.println("1 - 1 = " + calculator.subtract(1, 1));
}The user kabir is created in the server and this user belongs to the group student.
Also, I have enabled the "Default Principal To Role Mapping"
BTW, I'm able to run other EJB3 examples [that does'nt involve any
security features] without any problems.
Below is the ERROR
Error in Lookupjavax.naming.NamingException: ejb ref resolution error for remote business interfaceTransactionSecurity.bean.TSCalculator [Root exception is java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
----------END server-side stack trace---------- vmcid: 0x0 minor code: 0 completed: No]
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:425)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:74)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:403)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at TransactionSecurity.client.TSCalculatorClient.main(TSCalculatorClient.java:35)
Caused by: java.rmi.AccessException: CORBA NO_PERMISSION 0 No; nested exception is:
org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
----------END server-side stack trace---------- vmcid: 0x0 minor code: 0 completed: No
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:277)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:205)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at com.sun.ejb.codegen._GenericEJBHome_Generated_DynamicStub.create(com/sun/ejb/codegen/_GenericEJBHome_Generated_DynamicStub.java)
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 com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:372)
... 5 more
Caused by: org.omg.CORBA.NO_PERMISSION: ----------BEGIN server-side stack trace----------
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: No
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.handle_null_service_context(SecServerRequestInterceptor.java:407)
at com.sun.enterprise.iiop.security.SecServerRequestInterceptor.receive_request(SecServerRequestInterceptor.java:429)
at com.sun.corba.ee.impl.interceptors.InterceptorInvoker.invokeServerInterceptorIntermediatePoint(InterceptorInvoker.java:627)
at com.sun.corba.ee.impl.interceptors.PIHandlerImpl.invokeServerPIIntermediatePoint(PIHandlerImpl.java:530)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.getServantWithPI(CorbaServerRequestDispatcherImpl.java:406)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:224)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
----------END server-side stack trace---------- 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:494)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.getSystemException(MessageBase.java:913)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:131)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(CorbaMessageMediatorImpl.java:685)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(CorbaClientRequestDispatcherImpl.java:472)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:363)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
... 13 moreAny help is appreciated.
Regards!
Nithi.
Edited by: EJB3 on Aug 17, 2008 8:17 PM -
Error in EJB running on WebSphere Application Server v6
Hi,
I am getting the following exception when a transaction ends in
Stateless Session EJB:
[8/4/05 13:04:00:396 CDT] 0000004d LocalTranCoor W WLTC0033W: Resource
imssDS rolled back in cleanup of LocalTransactionContainment.
[8/4/05 13:04:00:406 CDT] 0000004d LocalTranCoor W WLTC0032W: One or more
local transaction resources were rolled back during the cleanup of a
LocalTransactionContainment.
[8/4/05 13:04:00:456 CDT] 0000004d SystemOut O Error en el servlet:
CORBA TRANSACTION_ROLLEDBACK 0x0 No; nested exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK:
javax.transaction.TransactionRolledbackException: ; nested exception is:
com.ibm.websphere.csi.CSITransactionRolledbackException: vmcid: 0x0
minor code: 0 completed: No
[8/4/05 13:04:00:456 CDT] 0000004d SystemOut O terminaTransaccion().
Rollback
[8/4/05 13:04:00:456 CDT] 0000004d SystemOut O
javax.servlet.ServletException: CORBA TRANSACTION_ROLLEDBACK 0x0 No; nested
exception is:
org.omg.CORBA.TRANSACTION_ROLLEDBACK:
javax.transaction.TransactionRolledbackException: ; nested exception is:
com.ibm.websphere.csi.CSITransactionRolledbackException: vmcid: 0x0
minor code: 0 completed: No
at HClinicaPPServlet.service(HClinicaPPServlet.java:597)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1
212)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.
java:629)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at
com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(Ht
tpInboundLink.java:421)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(Ht
tpInboundLink.java:367)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.j
ava:276)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscrimin
aters(NewConnectionInitialReadCallback.java:201)
at
com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewCon
nectionInitialReadCallback.java:103)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManage
r.java:548)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java
(Compiled Code))
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java
:934)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.jav
a:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)The EJB is being invoked from a servlet. The servlet calls three methods
from the EJB, the first one initializes a database connection, the second
one executes a query against a SQL Server database and the third method
closes the connection. The exception occurs while calling the third method.
The EJB was working fine in WebSphere Application Server 4.0, but we are
helping this customer migrate to WebSphere Application Server 6, but this
error arised.
The EJB is defined as follows in the ejb-jar.xml deployment descriptor:
<session id="HistClinicaPP">
<ejb-name>HistClinicaPPEJB</ejb-name>
<home>HistoriaClinica.HistClinicaPPHome</home>
<remote>HistoriaClinica.HistClinicaPP</remote>
<ejb-class>HistoriaClinica.HistClinicaPPBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<resource-ref id="ResourceRef_1123110667486">
<description>
</description>
<res-ref-name>imssDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>The ibm-ejb-jar-ext.xmi files contains the following:
<ejbExtensions xmi:type="ejbext:SessionExtension"
xmi:id="SessionExtension_1123174793374">
<enterpriseBean xmi:type="ejb:Session"
href="META-INF/ejb-jar.xml#HistClinicaPP"/>
<beanCache xmi:id="BeanCache_1123175678367" activateAt="ONCE"/>
<internationalization xmi:id="BeanInternationalization_1123175807173"
invocationLocale="CALLER"/>
<localTransaction xmi:id="LocalTransaction_1123174793374"
boundary="BeanMethod" resolver="Application" unresolvedAction="Rollback"/>
</ejbExtensions>I tried copying the configuration from WAS 4.0, the only piece of the 4.0.x
descriptor missing in the ext file is <structure>, since I couldn't find a
matching property in Rational Application Developer 6.0 for WAS 6.0. This is
what the ibm-ejb-jar-ext.xmi in WAS 4.0 contains for this bean:
<ejbExtensions xmi:type="ejbext:SessionExtension"
xmi:id="SessionExtension_17" timeout="600">
<enterpriseBean xmi:type="ejb:Session"
href="META-INF/ejb-jar.xml#Session_9"/>
<structure xmi:id="BeanStructure_17" inheritenceRoot="false"/>
<beanCache xmi:id="BeanCache_17" activateAt="ONCE"/>
<internationalization xmi:id="BeanInternationalization_17"
invocationLocale="CALLER"/>
<localTran xmi:id="LocalTran_17" boundary="BEAN_METHOD"
unresolvedAction="ROLLBACK"/>
</ejbExtensions>I am not an expert in EJBs, so I don't know how to correct this problem, any
help would be appreciated.
Thanks in advance,
Jorge GomezHi,
According to WAS 6 , every opened connection has to be commited (or rolledback) explicitly (didnt try autocommit) before closing. Even if all you have done with that connection is a SELECT Query.
This has apparently solved the same problem I was getting. implement it and see whether it helps you. -
Running Oracle Reports from JSF Application in Websphere Application Server
Hi everybody;
in our company we are developing jsf applications and we want to use our existing Oracle reports. Reports are deployed in Oracle Application Server 10G. Is there a way to call those reports from our jsf applications deployed in websphere application server.Calling reports is just constructing and submitting a URL. So constuct the url in your jsf app or create static hyperlinks in your jsf app to go to the needed url. The url should look something like:
http ://hostname:7777/reports/rwservlet?report=myrep.jsp&userid=scott/tiger@dev10g&desformat=html&destype=cache -
How to run two applications from same application server
hi,
i am working on oracle application server 10g , is it possible to run 2 applications from one application server by using different url ? but same report server name .
if i can do so plz tell me how ?
regardshi,
offcourse,you can do this you.you can deploy n no of applications on a single application server.
and even you can run all the reports on a single report server
to the below location.
$ORACLE_HOME/forms/server
create a new enviroment file(for eg fd.env) using the default.env as follows and make the following FORM_PATH and REPORTS_PATH changes in the fd.env
FORMS_PATH=/oraApp/Ora_bi/forms:/oraApp/backup_29_11_2010_0.12/fd/pll:/oraApp/backup_29_11_2010_0.12/fd/forms
REPORTS_PATH=/oraApp/backup_29_11_2010_0.12/fd/reports
similarily create another env file (eg appr.env) and make the above changes in it.
Now make the following changes in formsweb.cfg
for example:
[xyz]
envFile=appr.env(env file name)
form=xyz.fmx(your start form)
lookandfeel=oracle
separateFrame=false
userid=appraisal/[email protected]
splashscreen=NO
logo=NO
background=NO
color=automatic
render=yes
archive=frmall.jar
archive_jini=frmall_jinit.jar,frmwebutil.jar,jacob.jar,ofasIcons.jar,icons.jar,OfasPrint.jar,newicons.jar(these jar file are the images files of your applications..needs to be stored in $ORACLE_HOME/forms/java.
imagebase=codebase
term=frmpcweb.res
baseHTML=webutilbase.htm
baseHTMLjinitiator=webutiljini.htm
baseHTMLjpi=webutiljpi.htm
WebUtilArchive=frmwebutil.jar,jacob.jar
[fd]
envFile=fd.env
form=fd.fmx
lookandfeel=oracle
separateFrame=true
userid=fdmmfsl/fdmmfsl@mmfdlive
splashscreen=NO
logo=NO
background=NO
color=automatic
render=yes
archive=frmall.jar
archive_jini=frmall_jinit.jar,frmwebutil.jar,jacob.jar,icons.jar
imagebase=codebase
term=frmpcweb.res
baseHTML=webutilbase.htm
baseHTMLjinitiator=webutiljini.htm
This depends on your application which your deploying
now for about accessing the seperate application then
use as follows
1st application
http://ip address:7778/forms/frmservlet?config=xyz
2nd application
http://ip address:7778/forms/frmservlet?config=fd
you can even deploy 2 war files on one application server...and you can even make these 2 war files to access the same report server
If you require any other help then do let me know
Regards
Fabian D'souza -
File from the Application server
Hi gurus,
I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
Thanks
Rajeev GuptaHi
Declare the selection screen with file as parameter so that the user enter the application server file..
the use the OPEND DATASET as mentioned in below code and process
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report ZUPLOADTAB * &----
*& Example of Uploading tab delimited file *
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 like pa0002-VORNA,
name2 like pa0002-name2,
age type i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
name1(10) type c,
name2(15) type c,
age(5) type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
DO.
CLEAR: wa_string, wa_uploadtxt.
READ DATASET ld_file INTO wa_string.
IF sy-subrc NE 0.
EXIT.
ELSE.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
APPEND wa_upload TO it_record.
ENDIF.
ENDDO.
CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
loop at it_record into wa_record.
write:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
endloop.
Regards
Anji -
Upload tab-delimited file from the application server to an internal table
Hello SAPients.
I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
Thank you in advance for your help.Try:
REPORT ztest MESSAGE-ID 00.
PARAMETER: p_file LIKE rlgrap-filename OBLIGATORY.
DATA: BEGIN OF data_tab OCCURS 0,
data(4096),
END OF data_tab.
DATA: BEGIN OF vendor_file_x OCCURS 0.
* LFA1 Data
DATA: mandt LIKE bgr00-mandt,
lifnr LIKE blf00-lifnr,
anred LIKE blfa1-anred,
bahns LIKE blfa1-bahns,
bbbnr LIKE blfa1-bbbnr,
bbsnr LIKE blfa1-bbsnr,
begru LIKE blfa1-begru,
brsch LIKE blfa1-brsch,
bubkz LIKE blfa1-bubkz,
datlt LIKE blfa1-datlt,
dtams LIKE blfa1-dtams,
dtaws LIKE blfa1-dtaws,
erdat LIKE lfa1-erdat,
ernam LIKE lfa1-ernam,
esrnr LIKE blfa1-esrnr,
konzs LIKE blfa1-konzs,
ktokk LIKE lfa1-ktokk,
kunnr LIKE blfa1-kunnr,
land1 LIKE blfa1-land1,
lnrza LIKE blfa1-lnrza,
loevm LIKE blfa1-loevm,
name1 LIKE blfa1-name1,
name2 LIKE blfa1-name2,
name3 LIKE blfa1-name3,
name4 LIKE blfa1-name4,
ort01 LIKE blfa1-ort01,
ort02 LIKE blfa1-ort02,
pfach LIKE blfa1-pfach,
pstl2 LIKE blfa1-pstl2,
pstlz LIKE blfa1-pstlz,
regio LIKE blfa1-regio,
sortl LIKE blfa1-sortl,
sperr LIKE blfa1-sperr,
sperm LIKE blfa1-sperm,
spras LIKE blfa1-spras,
stcd1 LIKE blfa1-stcd1,
stcd2 LIKE blfa1-stcd2,
stkza LIKE blfa1-stkza,
stkzu LIKE blfa1-stkzu,
stras LIKE blfa1-stras,
telbx LIKE blfa1-telbx,
telf1 LIKE blfa1-telf1,
telf2 LIKE blfa1-telf2,
telfx LIKE blfa1-telfx,
teltx LIKE blfa1-teltx,
telx1 LIKE blfa1-telx1,
xcpdk LIKE lfa1-xcpdk,
xzemp LIKE blfa1-xzemp,
vbund LIKE blfa1-vbund,
fiskn LIKE blfa1-fiskn,
stceg LIKE blfa1-stceg,
stkzn LIKE blfa1-stkzn,
sperq LIKE blfa1-sperq,
adrnr LIKE lfa1-adrnr,
mcod1 LIKE lfa1-mcod1,
mcod2 LIKE lfa1-mcod2,
mcod3 LIKE lfa1-mcod3,
gbort LIKE blfa1-gbort,
gbdat LIKE blfa1-gbdat,
sexkz LIKE blfa1-sexkz,
kraus LIKE blfa1-kraus,
revdb LIKE blfa1-revdb,
qssys LIKE blfa1-qssys,
ktock LIKE blfa1-ktock,
pfort LIKE blfa1-pfort,
werks LIKE blfa1-werks,
ltsna LIKE blfa1-ltsna,
werkr LIKE blfa1-werkr,
plkal LIKE lfa1-plkal,
duefl LIKE lfa1-duefl,
txjcd LIKE blfa1-txjcd,
sperz LIKE lfa1-sperz,
scacd LIKE blfa1-scacd,
sfrgr LIKE blfa1-sfrgr,
lzone LIKE blfa1-lzone,
xlfza LIKE lfa1-xlfza,
dlgrp LIKE blfa1-dlgrp,
fityp LIKE blfa1-fityp,
stcdt LIKE blfa1-stcdt,
regss LIKE blfa1-regss,
actss LIKE blfa1-actss,
stcd3 LIKE blfa1-stcd3,
stcd4 LIKE blfa1-stcd4,
ipisp LIKE blfa1-ipisp,
taxbs LIKE blfa1-taxbs,
profs LIKE blfa1-profs,
stgdl LIKE blfa1-stgdl,
emnfr LIKE blfa1-emnfr,
lfurl LIKE blfa1-lfurl,
j_1kfrepre LIKE blfa1-j_1kfrepre,
j_1kftbus LIKE blfa1-j_1kftbus,
j_1kftind LIKE blfa1-j_1kftind,
confs LIKE lfa1-confs,
updat LIKE lfa1-updat,
uptim LIKE lfa1-uptim,
nodel LIKE blfa1-nodel.
DATA: END OF vendor_file_x.
FIELD-SYMBOLS: <field>,
<field_1>.
DATA: delim TYPE x VALUE '09'.
DATA: fld_chk(4096),
last_char,
quote_1 TYPE i,
quote_2 TYPE i,
fld_lth TYPE i,
columns TYPE i,
field_end TYPE i,
outp_rec TYPE i,
extras(3) TYPE c VALUE '.,"',
mixed_no(14) TYPE c VALUE '1234567890-.,"'.
OPEN DATASET p_file FOR INPUT.
DO.
READ DATASET p_file INTO data_tab-data.
IF sy-subrc = 0.
APPEND data_tab.
ELSE.
EXIT.
ENDIF.
ENDDO.
* count columns in output structure
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
columns = sy-index.
ENDDO.
* Assign elements of input file to internal table
CLEAR vendor_file_x.
IF columns > 0.
LOOP AT data_tab.
DO columns TIMES.
ASSIGN space TO <field>.
ASSIGN space TO <field_1>.
ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
SEARCH data_tab-data FOR delim.
IF sy-fdpos > 0.
field_end = sy-fdpos + 1.
ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
* Check that numeric fields don't contain any embedded " or ,
IF <field_1> CO mixed_no AND
<field_1> CA extras.
TRANSLATE <field_1> USING '" , '.
CONDENSE <field_1> NO-GAPS.
ENDIF.
* If first and last characters are '"', remove both.
fld_chk = <field_1>.
IF NOT fld_chk IS INITIAL.
fld_lth = strlen( fld_chk ) - 1.
MOVE fld_chk+fld_lth(1) TO last_char.
IF fld_chk(1) = '"' AND
last_char = '"'.
MOVE space TO fld_chk+fld_lth(1).
SHIFT fld_chk.
MOVE fld_chk TO <field_1>.
ENDIF. " for if fld_chk(1)=" & last_char="
ENDIF. " for if not fld_chk is initial
* Replace "" with "
DO.
IF fld_chk CS '""'.
quote_1 = sy-fdpos.
quote_2 = sy-fdpos + 1.
MOVE fld_chk+quote_2 TO fld_chk+quote_1.
ELSE.
MOVE fld_chk TO <field_1>.
EXIT.
ENDIF.
ENDDO.
<field> = <field_1>.
ELSE.
field_end = 1.
ENDIF.
SHIFT data_tab-data LEFT BY field_end PLACES.
ENDDO.
APPEND vendor_file_x.
CLEAR vendor_file_x.
ENDLOOP.
ENDIF.
CLEAR data_tab.
REFRESH data_tab.
FREE data_tab.
Rob -
Manual Deployment of Hyperion SS on Websphere Application server 6.1
Hi
I am trying to delopy Hyperion Shared Service R11.1 (interop.war) on
Websphere Application server 6.1 .
I am following the steps given in Deploying EPM System into WebSphere Application Server (epm_manual_deployment.pdf) page 100
After deploying according to the steps i am getting following error
Welcome to Hyperion® Shared Services Console
SEVERE ERROR: The Hyperion Shared Services database is not configured correctly. Please contact your system administrator.
After proper configuration, please restart Hyperion Shared Services and access this URL to continue.
Deregister the mbean because of uncaught init() exception thrown by servlet webdav: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com.hyperion.eie.common.EIELog (initialization failure)
at org.apache.slide.webdav.WebdavServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at org.apache.slide.webdav.WebdavServlet.init(Unknown Source)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:185)
Can anyone please help me deploy the HSS on WAS?
Thanks
ShraddhaHey Guys,
OS: Windows 2003
App Server: Websphere 6.1
Hyperion version: 9.3.1
DB: SQL Server 2008
When i initially started out trying to deploy the hyperion system 9.3.1 using SQL server 2008 with Websphere 6.1 as my app server it gave me problems but i found a workaround and i have the shared services screen coming up however it says...
SEVERE ERROR: The Hyperion Shared Services database is not configured correctly. Please contact your system administrator.
And an idea someone gave on a thread was to mess with the HubProductBean.jar file and remove the classes of the javax/crypto - however that did not work. If anyone has any suggestions to get passed this issue it would be great. Thank you!
ZS -
Deploy Forms 9i applications on Websphere Application Server Ver 6.1.1
Can we Deploy applications developed using Forms 9i in Websphere Application Server Ver 6.1.1?
Thanks in advance.Hi,
Well you just need to create a directory in paste your forms there, and then make an entry in the formsweb.cfg file and forms.conf files. Likewise there are entries for the images and report.
http://download.oracle.com/docs/cd/B28638_01//doc/frs/forms/B14032_03/basics002.htm
regards -
How to deploy on different OC4J than "home" on Application Server
Hi
I've a JSP/Struts Application which runs well in JDeveloper and runs well if deployed to the "home" instance of Oracle Application Server 10g Release 3. However, we want to deploy this Application to a separated OC4J (keeping different Applications separated). So I'm trying to create a second OC4J instance in Application Server in order to deploy my application. This seems to be quite complicated !
Can anyone point me to some information on how to create a new OC4J Instance in Oracle AS 10g with all necessary BC4J- and ADF-Libraries in order to deploy an application?
Thankspls use the em website to create the new oc4j stance,you can access em by http://yourashost:1810
then ,you may deploy the project to a ear file and deploy it on new oc4j stance in em website.
maybe i do not make me understood,::) -
BPF Launch from second application server
I have the following setup.
SAP BPC 7.0 SP9 Patch 1
SQL Server 2005 Enterprise Edition SP2
Two application servers and one database server.
We have a loadbalancer F5.
When I launch the BPF and the loadbalancer takes me to the second application server. Then the message comes up that the templates does not exist. When I go to eTools and try to open the Company folder, first it says that the folder thas not exist and after about 30 seconds the templates start appearing.
I have followed the instructions on how to do the Loadbalancer, and I can see that the balancer is working, but templates take long to appear from the second application server.
It seems like there is a delay in the templates showing.. Do you have any idease why this happens? Or what settings I can have a look at?
Regards
HenrySo first of all I will check the tables:
tblserverinfo and tblappsetinfo.
Into tblserverinfo you must have just records with suffix 1 and for application server and web server you must have virtual Ip of your NLB.
Iinto tblapsetinfo all the records refering servers must you just name with suffix 1. (sql server1, olap server 1...)
The second check I will do it regarding where do you have the file server.
Because you have two application servers then you must have a share drive where you have the file server because the templates must be access from both servers.
So for the file server you will not be able to use local drive because this can be a problem when you try to open the templates.
That's means you have to check if you can access the path specified for file server (you can find it into tblserverinfo) from both application server. It can be that actually from second application server you have access problems.
The third thing to be check is the affinity(persistency) of you NLB F5.
In your case because the afinity must be single (persistency on) because once which you connect to one application server you would like to have all request going to same application server.
All the tests must be done with antivirus and firewall disable into both application servers.
Regards
Sorin radulescu -
How to call EJB deployed on websphere from JSP running on Tomcat?
I am trying to establish communication between two app servers. I have a sample EJB deployed on Websphere and wish to call its business methods from a JSP page which is running on Apache Tomcat server. (ie) Tomcat is client to websphere. Is it possible to do? If so, what are the client Jar files of websphere that I should make available to JSP page on Tomcat? Do I need to set any Jars in Tomcat environment variables? Lood forward for your immediate help. Thanks in advance
Please see the thread
http://forum.java.sun.com/thread.jspa?threadID=514536.
Hope that helps..
Maybe you are looking for
-
Flash player not working in Internet Explorer 10 Windows 8
Flash player is working on Google Chrome, but whenever I use IE to access a site that uses flash, IE tells me I do not have flash and asks me if I want to install it. If I choose yes, then IE will try to download flash player, and when it finishes do
-
Is there software available where all I have to do is hit print and any of the 4x6 printers will print? Once I get this issue settled, I'll get a second larger format. I have to get this rectified because of time and ease. As mentioned, I have a seco
-
HT203433 prior music library transfer from ipad to new computer help
i bought a new computer because my old one crashed and i lost all my info how do i transfer all of the previous music i had on my ipad to itunes match.
-
Professional Programs shouldn't work like this
Aperture is marketed as a professional program, yet I find that: 1) I can't organize individual image files the way I would like (yes, it could do it with a seperate database or sidecar files the way Adobe Bridge does). I can't even specify a locatio
-
XML in Directory Server 5.1
What XML support and/or web services support comes with Directory Server 5.1. The documentation does not seem to address this.