Dynamically undeploying MDBs
Hi,
I am using Weblogic 6.1 SP4 - Integrating with MQ5.2 using IBM MQ Classes.
I have an MDB which points to a MQ Queue. MDB takes the message and delegates
to specific Java Classes which parse the XML (body of the message) into Java Objects
and save them into database.
I have implemented Container Managed transactional MDBs. Before processing the
message I am checking to see if the database connection is available. If the
database connection is not available, I am rolling back the message into the Queue.
The problem is that this is getting into a loop, till the database connection
is available. (MDB picks up the message and checks up for database connectivity
and rolls back into the queue).
The solution that I have thought of doing is to check upto 5 times (just a count
I have decided), after which I will undeploy the MDBs dynamically. Then I will
start a new Thread (Thread class) which will check if the database connection
is available and once the connection is available, I will redeploy the MDB to
process the message again.
I have following questions here:
(1) How to dynamically undeploy & re-deploy MDB
(2) How can I check Redelivered Count. I know that I can use Message.getJMSRedelivered
(), which will return me a boolean stating the message is redelivered. If I
can't check for Redelivered count, then if getJMSRedelivered() is "true", then
I will undeploy the MDB.
(3) Will there be any issues/problems in the solution discussed above.
Thanks in advance for any help.
Regards,
Venkatesan.
As I wrote below, I think there is a way, but I don't
know how. For programmatically undeploying the MDB,
I suggest posting your needs to the "ejb" newsgroup, which has
more experience in this area. (I mentioned this already
in another part of this email thread.)
Tom
Sastry wrote:
> Hi Tom,
>
> Is there any way to use weblogic 7.0 JMX API's to suspend a MDB so that it won't
> process any messages from the queue until the next destination like oracle database
> connection is up and running.
>
> Thanks
> Sastry
>
> Tom Barnes <[email protected]> wrote:
>
>>9.0 - I don't know the official release date, but I
>>imagine its in the latter half of 2004. For now,
>>there is undeploying the MDBs, or shutting down JMS.
>>
>>Tom
>>
>>Mikhail Stolpner wrote:
>>
>>
>>>Yes. Exactly.
>>>What next release do you mean? Is it 8.1SP2 or 9.0?
>>>
>>>Thank you very much,
>>>Mikhail
>>>
>>>"Tom Barnes" <[email protected]> wrote in message
>>>news:[email protected]...
>>>
>>>
>>>>Clarification. You can pause "produces", but not "consumes",
>>>>using the console or programmatically via JMX.
>>>>I assumed you meant to pause "consumes".
>>>>
>>>>Tom Barnes wrote:
>>>>
>>>>
>>>>
>>>>>Hi Mikhail,
>>>>>
>>>>>There is no direct way. In 7.0 and later you can
>>>>>programmatically shutdown
>>>>>the entire JMS server, while leaving the WL server up,
>>>>>by setting the JMS server mbean's "target"
>>>>>field to null.
>>>>>
>>>>>Note that you can have multiple JMS server's per WL
>>>>>server.
>>>>>
>>>>>Tom
>>>>>
>>>>>P.S. A rich featured pause capability is planned
>>>>>for the next release. This includes the ability
>>>>>to pause an MDB, as well as an entire destination
>>>>>in various ways.
>>>>>
>>>>>Mikhail Stolpner wrote:
>>>>>
>>>>>
>>>>>
>>>>>>Hi Tom,
>>>>>>
>>>>>>Do you know if there is a way to programmatically pause Weblogic
>>
>>Queue?
>>
>>>>>>Thanks,
>>>>>>Mikhail
>>>>>>
>>>>>>"Tom Barnes" <[email protected]> wrote in message
>>>>>>news:[email protected]...
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>A "redelivered count" requires a vendor extension - JMS does
>>>>>>>not provide one. Check the MQ doc to see if there is one.
>>>>>>>
>>>>>>>Another option is programmatically pause MQ - I'm not sure
>>>>>>>if there is a way to do this. Again - check the MQ doc.
>>>>>>>
>>>>>>>Another option is to simply block the MDB in a try/sleep()
>>>>>>>retry loop until the database connection comes back up.
>>>>>>>
>>>>>>>As for programmatically undeploying the MDB, I suggest
>>>>>>>posting your needs to the "EJB" newsgroup, which has
>>>>>>>more experience in this area.
>>>>>>>
>>>>>>>Tom
>>>>>>>
>>>>>>>Venkatesan wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>Hi,
>>>>>>>>I am using Weblogic 6.1 SP4 - Integrating with MQ5.2 using IBM
>>
>>MQ
>>
>>>>>>
>>>>>>Classes.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I have an MDB which points to a MQ Queue. MDB takes the message
>>
>>and
>>
>>>>>>
>>>>>>delegates
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>to specific Java Classes which parse the XML (body of the message)
>>>
>>>into
>>>
>>>
>>>>>>Java Objects
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>and save them into database.
>>>>>>>>I have implemented Container Managed transactional MDBs. Before
>>>>>>
>>>>>>
>>>>>>processing the
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>message I am checking to see if the database connection is available.
>>>>>>
>>>>>>
>>>>>>If the
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>database connection is not available, I am rolling back the message
>>>>>>>>into
>>>>>>
>>>>>>
>>>>>>the Queue.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>The problem is that this is getting into a loop, till the database
>>>>>>
>>>>>>
>>>>>>connection
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>is available. (MDB picks up the message and checks up for database
>>>>>>
>>>>>>
>>>>>>connectivity
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>and rolls back into the queue).
>>>>>>>>The solution that I have thought of doing is to check upto 5 times
>>>>>>>>(just
>>>>>>
>>>>>>
>>>>>>a count
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I have decided), after which I will undeploy the MDBs dynamically.
>>>>>>>>Then
>>>>>>
>>>>>>
>>>>>>I will
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>start a new Thread (Thread class) which will check if the database
>>>>>>
>>>>>>
>>>>>>connection
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>is available and once the connection is available, I will redeploy
>>>
>>>the
>>>
>>>
>>>>>>MDB to
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>process the message again.
>>>>>>>>
>>>>>>>>I have following questions here:
>>>>>>>>
>>>>>>>> (1) How to dynamically undeploy & re-deploy MDB
>>>>>>>> (2) How can I check Redelivered Count. I know that I can use
>>>>>>
>>>>>>
>>>>>>Message.getJMSRedelivered
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>(), which will return me a boolean stating the message is
>>>
>>>redelivered.
>>>
>>>
>>>>>>If I
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>can't check for Redelivered count, then if getJMSRedelivered()
>>
>>is
>>
>>>>>>
>>>>>>"true", then
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>I will undeploy the MDB.
>>>>>>>> (3) Will there be any issues/problems in the solution discussed
>>>>>>
>>>>>>
>>>>>>above.
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>Thanks in advance for any help.
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>Venkatesan.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>
>
Similar Messages
-
Dynamically Undeploying EJBs / MDBs
Hi,
Is there a way to programmatically undeploy EJBs or MDBs. I am working with WLS6.1.
I have a Message Driven Bean which should take messages from the Queue and parse
the XML body of the message and save it into the database.
In the MDB, onMessage(), I am checking if the Database is available, if it is
not available, I am rolling back the message. But the problem is the message
is consumed again. So I want to undeploy the MDB after some retries.
Can I programmatically undeploy a Message Driven Bean or EJB.
Thanks in advance
VenkatesanHi,
Is there a way to programmatically undeploy EJBs or MDBs. I am working with WLS6.1.
I have a Message Driven Bean which should take messages from the Queue and parse
the XML body of the message and save it into the database.
In the MDB, onMessage(), I am checking if the Database is available, if it is
not available, I am rolling back the message. But the problem is the message
is consumed again. So I want to undeploy the MDB after some retries.
Can I programmatically undeploy a Message Driven Bean or EJB.
Thanks in advance
Venkatesan -
Undeploying MDB component on heavily loaded server.
Hello,
Our team is currently performing some load testing on an order fulfilment system we have developed on WLS 7.0 and have encountered a problem trying to undeploy a message driven bean attached to JMS queue. The component will not undeploy until it has processed everything in the queue (could be hours later). This is a problem for us, as part of our exception handling code uses MBean classes to undeploy components when a problem is encountered to prevent further processing, and to preserve any subsequent messages on the queue. I wish to know if there is some way of configuring WLS to give priority to undeployment requests, or is there another way round this problem.
Thanks in advance!
Michael.I had the same problem and the only way to undeploy was to kill the JVM. The beans
would not undeploy and i think i got a reply here in the newsgroups that the beans
wont undeploy until all their jms sessions are closed which essentially means
all of htem are done proecssing.
Michael Cousins <[email protected]> wrote:
Hello,
Our team is currently performing some load testing on an order fulfilment
system we have developed on WLS 7.0 and have encountered a problem trying
to undeploy a message driven bean attached to JMS queue. The component
will not undeploy until it has processed everything in the queue (could
be hours later). This is a problem for us, as part of our exception
handling code uses MBean classes to undeploy components when a problem
is encountered to prevent further processing, and to preserve any subsequent
messages on the queue. I wish to know if there is some way of configuring
WLS to give priority to undeployment requests, or is there another way
round this problem.
Thanks in advance!
Michael. -
Reg. Provider Url set in weblogic-ejb-jar.xml
have created an MDB which listens to an IBM MQ. I currently
specify the path of the binding file by setting the provider_url in the weblogic-ejb-jar.xml
An example is as follows::
<destination-jndi-name>Sample.Q</destination-jndi-name>
<initial-context-factory>com.sun.jndi.fscontext.RefFSContextFactory</initial-context-factory>
<provider-url>file:/apps/test/</provider-url>
<connection-factory-jndi-name>Sample.QCF</connection-factory-jndi-name>
is there any way to set this parameter dynamically from MDB itselfAFAIK you can't dynamically reconfigure MDBs; whats in the XML is what you get.
One alternative is to use Spring and Message Driven POJOs which allows you to use Spring to configure the provider & activation spec, which allows you to dynamically at runtime configure properties however you wish or even hot deploy MDPs within a running application.
http://jencks.org/Message+Driven+POJOs
Depending on how complex your runtime-configuration is you could create your own Spring Factory Beans to do wacky stuff (query a database or whatever to figure out the provider URLs etc) or use a Spring post processor to inject values from some other source (JNDI, LDAP etc).
James
http://logicblaze.com/ -
How to make dynamic provider-url for MDB.
Hi,
My application has an MDB that need to bind to a remote queue. The .bindigs file is created and put in a specified location. Is there any way I can specify a dynamic value for this location in the <provider-url> tag in my weblogic-ejb.xml file. This is because, in our UNIX test and prod servers, the location of the .bindings file different from what I have on my local box. I have tried like this, but it did not work.
<provider-url>file:/%DOMAIN_DIR%/config/<provider-url>
We always have a 'config' directory under the domain and if the domain name changes in different environments, i don't have to make any changes to my descriptor file.
Thanks,
RajeevI met a similar problem when I used the foreign JMS server. I configured the foreign server via console. I tried to subscribe a remote topic which was maintained by another WebLogic JMS server. When I built my MDB, I got the following exception. The remote JMS server name could not be resolved. Any suggection is appreciated.
<Sep 19, 2005 6:11:56 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven E
JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Th
e Error was:
[EJB:010196]'weblogic.jms.common.JMSException: Error creating session' Linked ex
ception = 'weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
r riicServer'
weblogic.jms.common.JMSException: Error creating session
at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
8)
at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1038)
at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.jav
a:643)
at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.ja
va:179)
at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
at weblogic.jms.client.JMSSession.createSubscriber(JMSSession.java:1422)
at weblogic.ejb20.internal.JMSConnectionPoller.setUpTopicSessions(JMSCon
nectionPoller.java:1582)
at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSCo
nnectionPoller.java:2009)
at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectio
nPoller.java:1180)
at weblogic.ejb20.internal.JMSConnectionPoller.startJMSConnectionPolling
(JMSConnectionPoller.java:846)
at weblogic.ejb20.deployer.MessageDrivenBeanPoolInfoImpl.start(MessageDr
ivenBeanPoolInfoImpl.java:234)
at weblogic.ejb20.deployer.EJBDeployer.deployMessageDrivenBeans(EJBDeplo
yer.java:1660)
at weblogic.ejb20.deployer.EJBDeployer.start(EJBDeployer.java:1488)
at weblogic.ejb20.deployer.EJBModule.start(EJBModule.java:689)
at weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2127)
at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2168)
at weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2503)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2421)
at weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2138)
at weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
laveDeployer.java:2237)
at weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
oyer.java:2132)
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
laveDeployer.java:2384)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
veDeployer.java:866)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
oyer.java:594)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
loyer.java:508)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
dler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
r riicServer
at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
Manager.java:330)
at weblogic.jms.dispatcher.DispatcherManager.dispatcherFindOrCreate(Disp
atcherManager.java:380)
at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
6)
... 29 more
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.S
:riicServer' Resolved weblogic.jms; remaining name 'S:riicServer'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
NamingNode.java:897)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
a:230)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.j
ava:154)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
8)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
6)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
6)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
ava:256)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
Manager.java:314)
... 31 more
>
<Sep 19, 2005 6:12:06 PM EDT> <Warning> <EJB> <BEA-010096> <The Message-Driven E
JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Co
nnection failed after 2 attempts. The MDB will attempt to reconnect every 10 sec
onds. This log message will repeat every 600 seconds until the condition clears.
>
<Sep 19, 2005 6:12:06 PM EDT> <Warning> <EJB> <BEA-010061> <The Message-Driven E
JB: SIGNIT is unable to connect to the JMS destination: jms/DCGSCatalogTopic. Th
e Error was:
[EJB:010196]'weblogic.jms.common.JMSException: Error creating session' Linked ex
ception = 'weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
r riicServer'
weblogic.jms.common.JMSException: Error creating session
at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
8)
at weblogic.jms.frontend.FESession.consumerCreate(FESession.java:1038)
at weblogic.jms.frontend.FESession.invoke(FESession.java:2552)
at weblogic.jms.dispatcher.Request.wrappedFiniteStateMachine(Request.jav
a:643)
at weblogic.jms.dispatcher.DispatcherImpl.dispatchSync(DispatcherImpl.ja
va:179)
at weblogic.jms.client.JMSSession.consumerCreate(JMSSession.java:1860)
at weblogic.jms.client.JMSSession.createConsumer(JMSSession.java:1691)
at weblogic.jms.client.JMSSession.createSubscriber(JMSSession.java:1422)
at weblogic.ejb20.internal.JMSConnectionPoller.setUpTopicSessions(JMSCon
nectionPoller.java:1582)
at weblogic.ejb20.internal.JMSConnectionPoller.createJMSConnection(JMSCo
nnectionPoller.java:2009)
at weblogic.ejb20.internal.JMSConnectionPoller.connectToJMS(JMSConnectio
nPoller.java:1180)
at weblogic.ejb20.internal.JMSConnectionPoller.trigger(JMSConnectionPoll
er.java:978)
at weblogic.time.common.internal.ScheduledTrigger.run(ScheduledTrigger.j
ava:243)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(Schedul
edTrigger.java:229)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigg
er.java:223)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:5
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: weblogic.jms.dispatcher.DispatcherException: could not find JMS Serve
r riicServer
at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
Manager.java:330)
at weblogic.jms.dispatcher.DispatcherManager.dispatcherFindOrCreate(Disp
atcherManager.java:380)
at weblogic.jms.frontend.FESession.setUpBackEndSession(FESession.java:79
6)
... 19 more
Caused by: javax.naming.NameNotFoundException: Unable to resolve 'weblogic.jms.S
:riicServer' Resolved weblogic.jms; remaining name 'S:riicServer'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(Basic
NamingNode.java:897)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.jav
a:230)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.j
ava:154)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:18
8)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
6)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:19
6)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.j
ava:256)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:359)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at weblogic.jms.dispatcher.DispatcherManager.dispatcherCreate(Dispatcher
Manager.java:314)
... 21 more
> -
MDB on MQSeries queue undeployment
I just started testing MDBs listening on MQSeries queues. WLS 6.1 and MQ 5.1. I followed
the instructions in the BEA foreign JMS providers white paper, deployed the MDBs,
queued messages and things seemed to work. But shutting down the server revealed
that the undeployment of each MDB was slow. Slower than SSBs or MDBs listening on
BEA queues. Would appreciate any suggestions about what it could be. Thanks.I just started testing MDBs listening on MQSeries queues. WLS 6.1 and MQ 5.1. I followed
the instructions in the BEA foreign JMS providers white paper, deployed the MDBs,
queued messages and things seemed to work. But shutting down the server revealed
that the undeployment of each MDB was slow. Slower than SSBs or MDBs listening on
BEA queues. Would appreciate any suggestions about what it could be. Thanks. -
Is it possible to dynamically change a MDB selector or does the MDB have
to deployed each time the selector changes? Redeploying is not an option
as we want a client to be able to state the criteria of the selector,
say for example, give me messages for stock BEA when its price exceeds
$10.
The same use then want to change this to $11. This is too dynaminc for a
redeployment per selector change.
Must I resort to non-MDB listeners for this?Is it possible to dynamically change a MDB selector or does the MDB have
to deployed each time the selector changes? Redeploying is not an option
as we want a client to be able to state the criteria of the selector,
say for example, give me messages for stock BEA when its price exceeds
$10.
The same use then want to change this to $11. This is too dynaminc for a
redeployment per selector change.
Must I resort to non-MDB listeners for this? -
Hello,
I want to achieve the following using JMS,
Receiving messages from producers with specific criteria, ex. give me only messages that have date less than now.
if I used MDB then I have the choice of setting the selctor only one time, is there a way to set it from time to time.
If not then how do I achieve that using a combination of session beans and MDBs.
Becasue I want to do some processing on the messages received of that criteria then resend them to other receivers.Generally you cannot do this. The selector syntax does not allow comparisons against System.currentTimeMills(), and consumers don't allow changes to the selector. Within the specification, the best one can do is recreate the consumer over and over again. This is of course made even worse in that selectors for MDBs are buried inside a deployment descriptor. Nasty stuff.
WebLogic JMS allows you to specify a delivery time on a message. However it is considered an extension. Other vendors may have a similar feature, but there is no common API for it. -
MDBs in 9.1 continue to consume JMS queues even after being deleted
<b>We have an MDB application that reads a batch message off of a JMS queue, archives it in a database, parses the batch message into individual messages and writes them onto other JMS queues to be consumed by another application. Everything was running fine in Weblogic 8.1.5. However, due to problems with XA drivers and the MSDTC(predictable SQL server crashes), we decided to upgrade to Weblogic 9.1 to take advantage of the LLR option.</b>
<b>First, we had an issue where our MDBs were causing the following exception:</b>
<i>####<May 26, 2006 7:42:12 PM EDT> <Error> <JMX> <ist-clft2> <wltest1> <ExecuteThread: '1' for queue: 'default'> <<WLS Kernel>> <> <> <1148686932991> <BEA-149500> <An exception occurred while registering the MBean null.
java.lang.IllegalArgumentException: Registered more than one instance with the same objectName : com.bea:ServerRuntime=wltest1,MessageDrivenEJBRuntime=RhapsodyMDB_DMBModule!JMSServer4@DMB_BEAN_QUEUE,Name=RhapsodyMDB_DMBModule!JMSServer4@DMB_BEAN_QUEUE,ApplicationRuntime=DataBrokerEAR1_2,Type=EJBPoolRuntime,EJBComponentRuntime=DataBrokerEJB new:[email protected] existing weblogic.ejb.container.monitoring.EJBPoolRuntimeMBeanImpl@7db003
at weblogic.management.jmx.ObjectNameManagerBase.registerObject(ObjectNameManagerBase.java:146)
at weblogic.management.mbeanservers.internal.WLSObjectNameManager.lookupObjectName(WLSObjectNameManager.java:133)
at weblogic.management.jmx.modelmbean.WLSModelMBeanFactory.registerWLSModelMBean(WLSModelMBeanFactory.java:86)
at weblogic.management.mbeanservers.internal.RuntimeMBeanAgent$1.registered(RuntimeMBeanAgent.java:104)
at weblogic.management.provider.internal.RegistrationManagerImpl.invokeRegistrationHandlers(RegistrationManagerImpl.java:205)
at weblogic.management.provider.internal.RegistrationManagerImpl.register(RegistrationManagerImpl.java:85)
at weblogic.management.runtime.RuntimeMBeanDelegate.register(RuntimeMBeanDelegate.java:320)
at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:257)
at weblogic.management.runtime.RuntimeMBeanDelegate.<init>(RuntimeMBeanDelegate.java:222)
at weblogic.ejb.container.monitoring.EJBPoolRuntimeMBeanImpl.<init>(EJBPoolRuntimeMBeanImpl.java:32)
at weblogic.ejb.container.monitoring.MessageDrivenEJBRuntimeMBeanImpl.<init>(MessageDrivenEJBRuntimeMBeanImpl.java:49)
at weblogic.ejb.container.manager.MessageDrivenManager.initialize(MessageDrivenManager.java:503)
at weblogic.ejb.container.manager.MessageDrivenManager.setup(MessageDrivenManager.java:120)
at weblogic.ejb.container.manager.MessageDrivenManager.setup(MessageDrivenManager.java:146)
at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createMDManager(MessageDrivenBeanInfoImpl.java:1481)
at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.createDDMDManagers(MessageDrivenBeanInfoImpl.java:1378)
at weblogic.ejb.container.deployer.MessageDrivenBeanInfoImpl.onDDMembershipChange(MessageDrivenBeanInfoImpl.java:1285)
at weblogic.jms.common.CDS$DD2Listener.listChange(CDS.java:454)
at weblogic.jms.common.CDSServer$DDHandlerChangeListener.statusChangeNotification(CDSServer.java:167)
at weblogic.jms.dd.DDHandler.callListener(DDHandler.java:318)
at weblogic.jms.dd.DDHandler.callListeners(DDHandler.java:344)
at weblogic.jms.dd.DDHandler.run(DDHandler.java:282)
at weblogic.jms.common.SerialScheduler.run(SerialScheduler.java:37)
at weblogic.work.ExecuteRequestAdapter.execute(ExecuteRequestAdapter.java:21)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
>
####<May 26, 2006 7:42:13 PM EDT> <Info> <EJB> <ist-clft2> <wltest1> <ExecuteThread: '1' for queue: 'default'> <<WLS Kernel>> <> <> <1148686933069> <BEA-010060> <The Message-Driven EJB: RhapsodyMDB has connected/reconnected to the JMS destination: weblogic.jms.DMB_BEAN_QUEUE.></i>
<b>
Generally this happend after there were cluster communication issues. Multi-cast messages were lost and our MDB reconnects to the JMS queues as indicated by the below log:</b>
<i>####<May 30, 2006 5:19:06 PM EDT> <Info> <EJB> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '54' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <> <1149023946040> <BEA-010060> <The Message-Driven EJB: DataBrokerMDB has connected/reconnected to the JMS destination: weblogic.jms.PHINMS_DMB_QUEUE.>
####<May 30, 2006 5:19:10 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023950228> <BEA-000112> <Removing RAPBEA3S jvmid:720875810499147484S:cmts-rap-bea3:[7005,-1,-1,-1,-1,-1,-1]:DMBstg:RAPBEA3S from cluster view due to timeout.>
####<May 30, 2006 5:19:11 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023951009> <BEA-000115> <Lost 2 multicast message(s).>
####<May 30, 2006 5:19:11 PM EDT> <Info> <Cluster> <AMTC-RAP-STG3> <RAPBEA1S> <[ACTIVE] ExecuteThread: '22' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1149023951040> <BEA-000111> <Adding RAPBEA3S with ID 720875810499147484S:cmts-rap-bea3:[7005,-1,-1,-1,-1,-1,-1]:DMBstg:RAPBEA3S to cluster: DMBstg_cluster view.></i>
<b>
This would cause the queues to eventually have hundreds of consumers and cause the server to fail.
Basically, it seems as though the MDBs that are supposed to stop continue and attempt to process, while new threads connect to the JMS queues.
I tried undeploying our application and deleted it from the configuration. However there were consumers still on the respective queues and when I sent messages, I got an error indicating a "Class Not Found exception" due to the fact that the EJB was undeployed and deleted from the configuration, however the MDB component was not and continued to listen for messages. In 8.1.5, as soon as the application was undeployed, there were zero consumers on the JMS queues.
I have read the posts about a soon to be released fix that would have the MDBs connect only to the queues locally and not go out the the cluster. Would this fix my issue?
Is there something in the deployment descriptor to configure that will cause it to disconnect and now spawn so many consumers to the JMS queues?
Why is it that the number of MDB consumers on the JMS queues stayed static in 8.1.5, but they are erratic in 9.1 even after I set our 9.1 server to use the 8.1.5 execute queue policy. Help would be much appreciated.</b>I recommend contacting customer support. There's a known problem with MDBs listening to distributed destinations that are local to the same cluster as the MDB, you're problem may be related (the clue is that the stack trace contains jms.dd.DDHandler.callListeners()). The problem is that the MDB connects to all physical queues in a distributed destination rather than just the local queue.
Tom -
Cache Synchronization with JMS and a Message Driven Bean (MDB)
If I understand correctly, Toplink ueses the following configuration info to find the target to publish its session messages to a JMS server (having its URL as below) which provides the JNDI service that Toplink needs to look up the topic:
<cache-synchronization-manager>
<clustering-service> oracle.toplink.remote.jms.mdb.JMSPublishingOnlyClusteringService
</clustering-service>
<should-remove-connection-on-error>false</should-remove-connection-on-error>
<!-- both of the following tags are user specified and must correspond to -->
<!-- the settings that the user has made, manually, to the JMS Service -->
<jms-topic-connection-factory-name> jms/TopLinkTopicConectionFactory
</jms-topic-connection-factory-name>
<jms-topic-name>jms/TopLinkCacheSynchTopic</jms-topic-name>
<!-- both of the following tags will be required if OracleAS TopLink -->
<!-- is not running in the same JVM as the JNDI service that is hosting the JMS Topic -->
<naming-service-url>ormi://localhost:23791</naming-service-url>
<naming-service-initial-context-factory> com.evermind.server.rmi.RMIInitialContextFactory </naming-service-initial-context-factory></cache-synchronization-manager>
The MDB also uses the same JNDI service provided by the JMS server to listen to the topic which is named in the ejb-jar.xml file:
<enterprise-beans>
<message-driven>
<display-name>TopLink clustering MDB</display-name>
<ejb-name>TopLinkClusteringMDB</ejb-name>
<ejb-class>com.mycompany.mdb.ClusteringMDB</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination> <destination-type>javax.jms.Topic</destination-type>
</message-driven-destination>
<env-entry>
<description>TopLink session name</description>
<env-entry-name>tl_session_name_for_mdb</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>Employee_Session</env-entry-value>
</env-entry>
<resource-ref> <description>description</description>
<res-ref-name>jms/TopLinkTopicConectionFactory</res-ref-name>
<res-type>javax.jms.TopicConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref>
<resource-env-ref-name> jms/TopLinkCacheSynchTopic</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Topic</resource-env-ref-type> </resource-env-ref>
</message-driven></enterprise-beans>
To do this, the EJB container that hosts the above MDB needs to be configured to know where the JMS server is by using the above URL same as in the Toplink sessions.xml file.
I am not clear that who provides the JNDI service for the Toplink session name lookup used by the MDB:
// Obtain the Session name configured in the environment variable
String sessionName = (String) myEnv.lookup(TOPLINK_SESSION_NAME);
session = SessionManager.getManager().getSession(sessionName);
so that the MDB can find the currently running Toplink session and communicate with it.
Can anybody help answer my above question and correct my understandings?
Many thanks!Although TopLink is running in the application serverâs VM, the only notable integration points with the server are for JTA and user-defined data sources. All of the work performed to get a session via SessionManager occurs solely within TopLink. When the call is made to retrieve a session, you arenât getting the âactiveâ session identified by âEmployee_Sessionâ that is registered with the application server, rather a new session is created using the definition that exists for âEmployee_Sessionâ in sessions.xml.
When the call âsession = SessionManager.getManager().getSession(âEmployee_Sessionâ)â is made, the SessionManager simply looks for sessions.xml at the root level of its deployed jars or classpath, then looks for the âEmployee_Sessionâ tag within sessions.xml. If a session exists in the file with that name then a TopLink session object is created and returned.
Note that setting an environment entry as mentioned above simply allows for the session name to be declared dynamically. The call to âmyEnv.lookup(âtl_session_name_for_mdbâ)â simply asks the beanâs environment for the <env-entry-value> that matches the <env-entry-name>. That string is then used in SessionManager (no different than a hard coded value would be) to identify the session in sessions.xml that is to be loaded.
I hope this makes sense. -
Dynamic queue publication in JBI
In Jcaps513 jcd you could dynamically publish to a queue with the sendTo() method, perhaps based upon incoming message type. How would you do something similar in JBI/BPEL coding?
RupertMikael
Its is possible in the BPEL code by assigning a value to the JMS BC/Outbound/Destination property in the properties section of the outbound partner link in an assign activity.How is that dynamic, in that you can set the value on-the-fly at runtime?
Michael
Can/t do that. There is no support for the JMS BC to use a message part to set destination.Consider using JCA MDB with the JMS JCA Adapter instead.
Ok, thanks.
Rupert -
Durable Subscription with MDB in Weblogic 7.0
Hi,
I am using WLS 7.0 as the JMS Provider and as the EJB Container(no
clustering). My question is do I need MDB with durable subscription. I
cannot think of a instance when the container will be down but JMS
provider is still running if I am using WLS as both container and JMS
provider.
One instance i can think of is if the MDB is not deployed (upon a new
release of our application, for some strange reason) but rest of the
application is deployed then the producers will produce messages for
the off-line subscriber.
If I assume that the above is not likely to happen, can you think of
any compelling reason for me to use MDB with durable subcription .
Thanks for your input.
ssahu
1) The MDB should only specify "durable" if it is receiving from a
topic. Durable does not apply to queues.
2) If messages are non-persistent, then you likely don't need durable.
As these messages don't survive the shutdown...
3) Making it durable helps with race-conditions during shutdown or
startup where messages are sent but the MDB isn't up. It also helps
with the condition where shutdown occurs before the MDB finishes
processing all of its messages. (So Durable ensures that the
MDB does not miss a message. It may even help in the non-persistent
case if is possible that the MDB is temporarily undeployed (by you)
while the server is up.
[email protected] wrote:
> Hi,
> I am using WLS 7.0 as the JMS Provider and as the EJB Container(no
> clustering). My question is do I need MDB with durable subscription. I
> cannot think of a instance when the container will be down but JMS
> provider is still running if I am using WLS as both container and JMS
> provider.
> One instance i can think of is if the MDB is not deployed (upon a new
> release of our application, for some strange reason) but rest of the
> application is deployed then the producers will produce messages for
> the off-line subscriber.
>
> If I assume that the above is not likely to happen, can you think of
> any compelling reason for me to use MDB with durable subcription .
>
> Thanks for your input.
>
> ssahu
-
How to set path of MS-Access databse file dynamically in crystal report
i have windows application and crystal reports and access database.when i connect crystal report to database through followingpath like
\\machinename\FolederName\AccessDBFile.mdb..here machine name is my machine name(i.e:PCNAMe).but when i will deploy this application on cliet machine then how i can set the path to crystal report with his machine name dynamically..or is
there any other provision to do this so that i can set it dynamically.
one more thing i want to tell you is that i wwant to share database on multiple machines so how can i do that.Hello,
Crystal reports is for a long time not anymore supported by Microsoft.
Moreover for sure not in this forum for api's components and classes for the user interface Windows Forms
Try direct the SAP community for Crystal reports for .Net
http://scn.sap.com/community/crystal-reports
Success
Cor -
DYNAMIC ALV(rich PROG)
1.how i can add lgort to the parameters and the prog will select by lgort.
2.how i change the title to sap dictonary
report zrich_0001.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>.
data: alv_fldcat type slis_t_fieldcat_alv,
it_fldcat type lvc_t_fcat,
wa_it_fldcat type lvc_s_fcat.
data: imard type table of mard with header line.
selection-screen begin of block b1 with frame title text-001.
parameters: p_matnr type mard-matnr.
parameters: p_werks type mard-werks.
selection-screen end of block b1.
start-of-selection.
select * into table imard from mard
where matnr = p_matnr
and werks = p_werks.
build the dynamic internal table
perform build_dyn_itab.
perform build_report.
call the alv grid.
perform call_alv.
Build_dyn_itab
form build_dyn_itab.
data: new_table type ref to data,
new_line type ref to data,
tot_lines type i.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'MATNR'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = 'Material Number'.
wa_it_fldcat-intlen = 18.
append wa_it_fldcat to it_fldcat .
clear wa_it_fldcat.
wa_it_fldcat-fieldname = 'WERKS'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = 'Plant'.
wa_it_fldcat-intlen = 4.
append wa_it_fldcat to it_fldcat .
loop at imard.
clear wa_it_fldcat.
concatenate 'LGORT' imard-lgort into
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 4.
append wa_it_fldcat to it_fldcat .
clear wa_it_fldcat.
concatenate 'LABST' imard-lgort into
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
append wa_it_fldcat to it_fldcat .
endloop.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
endform.
Form build_report
form build_report.
data: fieldname(20) type c.
data: fieldvalue(5) type c.
data: index(3) type c.
field-symbols: <fs1>.
assign component 'MATNR' of structure <dyn_wa> to <fs1>.
<fs1> = p_matnr.
assign component 'WERKS' of structure <dyn_wa> to <fs1>.
<fs1> = p_werks.
loop at imard.
index = sy-index.
Set the LGORT
concatenate 'LGORT' imard-lgort into
fieldname.
condense fieldname no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = imard-lgort.
Set the LABST
concatenate 'LABST' imard-lgort into
fieldname.
condense fieldname no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = imard-labst.
endloop.
Append to the dynamic internal table
append <dyn_wa> to <dyn_table>.
endform.
CALL_ALV
form call_alv.
data: wa_cat like line of alv_fldcat.
loop at it_fldcat into wa_it_fldcat.
wa_cat-fieldname = wa_it_fldcat-fieldname.
wa_cat-seltext_s = wa_it_fldcat-seltext.
wa_cat-outputlen = wa_it_fldcat-outputlen.
append wa_cat to alv_fldcat.
endloop.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = alv_fldcat
tables
t_outtab = <dyn_table>.
endform.here is the full code
if you dont understand me
REPORT zytest1.
TYPE-POOLS: slis.
TABLES: mard, t023t, marc,makt, mara, t001l,mdbs, vbup,vbfa,mvke,
vbep, vbap, vbak.
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
<dyn_wa>.
DATA: alv_fldcat TYPE slis_t_fieldcat_alv,
it_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat.
*data: imard type table of mard with header line.
DATA: BEGIN OF imard OCCURS 0,
werks LIKE marc-werks,
matkl LIKE t023t-matkl,
matnr LIKE ekpo-matnr,
lgort LIKE mard-lgort,
labst LIKE mard-labst,
diskz LIKE mard-diskz,
insme LIKE mard-insme,
wgbez LIKE t023t-wgbez,
meins LIKE mara-meins,
speme LIKE mard-speme,
retme LIKE mard-retme,
umlme LIKE mard-umlme,
werks LIKE mard-werks,
maktx LIKE makt-maktx,
eislo LIKE marc-eislo,
END OF imard.
SELECT-OPTIONS: matnr FOR mara-matnr MATCHCODE OBJECT mat1,
werks FOR mard-werks, " MATCHCODE OBJECT t001w,
lgort FOR mard-lgort, " MATCHCODE OBJECT tl001,
mtart FOR mara-mtart, "MATCHCODE OBJECT mara,
matkl FOR mara-matkl." MATCHCODE OBJECT mara.
START-OF-SELECTION.
SELECT mardeinme mardinsme mardlabst mardmatnr mard~retme
mardspeme mardumlme mardwerks maramatnr mara~meins
maktmaktx maktmatnr marceislo marcmatnr mard~lgort
mard~werks
INTO (mard-einme , mard-insme , mard-labst , mard-matnr , mard-retme
, mard-speme , mard-umlme , mard-werks , mara-matnr , mara-meins
, makt-maktx , makt-matnr , marc-eislo , marc-matnr , mard-lgort
, mard-werks
FROM ( mard
INNER JOIN mara
ON maramatnr = mardmatnr
INNER JOIN makt
ON maktmatnr = maramatnr
INNER JOIN marc
ON marcmatnr = maktmatnr )
WHERE mara~matnr IN matnr
AND mard~werks IN werks
AND mard~lgort IN lgort
AND mara~mtart IN mtart
AND mara~matkl IN matkl
AND makt~spras = 'B'.
IF sy-subrc = 0.
MOVE mard-einme TO imard-insme.
MOVE mard-insme TO imard-insme.
MOVE mard-labst TO imard-labst.
SHIFT mard-matnr LEFT DELETING LEADING '0'.
MOVE mard-matnr TO imard-matnr.
MOVE mard-retme TO imard-retme.
MOVE mard-speme TO imard-speme.
MOVE mard-umlme TO imard-umlme.
MOVE mard-werks TO imard-werks.
MOVE mara-matnr TO imard-matnr.
MOVE mara-meins TO imard-meins.
MOVE makt-maktx TO imard-maktx.
MOVE makt-matnr TO imard-matnr.
MOVE marc-eislo TO imard-eislo.
MOVE marc-matnr TO imard-matnr.
MOVE mard-lgort TO imard-lgort.
APPEND imard.
ENDIF.
ENDSELECT.
select * into table imard from mard
where matnr = p_matnr
and werks = p_werks.
build the dynamic internal table
PERFORM build_dyn_itab.
PERFORM build_report.
call the alv grid.
PERFORM call_alv.
Build_dyn_itab
FORM build_dyn_itab.
DATA: new_table TYPE REF TO data,
new_line TYPE REF TO data,
tot_lines TYPE i.
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = 'MATNR'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = 'Material Number'.
wa_it_fldcat-intlen = 25.
APPEND wa_it_fldcat TO it_fldcat .
CLEAR wa_it_fldcat.
wa_it_fldcat-fieldname = 'WERKS'.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = 'Plant'.
wa_it_fldcat-intlen = 4.
APPEND wa_it_fldcat TO it_fldcat .
LOOP AT imard.
CLEAR wa_it_fldcat.
concatenate 'LGORT' imard-lgort into
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 4.
append wa_it_fldcat to it_fldcat .
CLEAR wa_it_fldcat.
CONCATENATE 'LABST' imard-lgort INTO
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
APPEND wa_it_fldcat TO it_fldcat .
CLEAR wa_it_fldcat.
CONCATENATE 'INSME' imard-lgort INTO
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
APPEND wa_it_fldcat TO it_fldcat .
CLEAR wa_it_fldcat.
CONCATENATE 'RETME' imard-lgort INTO
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
APPEND wa_it_fldcat TO it_fldcat .
CLEAR wa_it_fldcat.
CONCATENATE 'UMLME' imard-lgort INTO
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
APPEND wa_it_fldcat TO it_fldcat .
CLEAR wa_it_fldcat.
CONCATENATE 'SPEME' imard-lgort INTO
wa_it_fldcat-fieldname.
wa_it_fldcat-datatype = 'QUAN'.
wa_it_fldcat-seltext = wa_it_fldcat-fieldname.
wa_it_fldcat-intlen = 15.
APPEND wa_it_fldcat TO it_fldcat .
ENDLOOP.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fldcat
IMPORTING
ep_table = new_table.
ASSIGN new_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA new_line LIKE LINE OF <dyn_table>.
ASSIGN new_line->* TO <dyn_wa>.
ENDFORM.
Form build_report
FORM build_report.
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(5) TYPE c.
DATA: index(3) TYPE c.
FIELD-SYMBOLS: <fs1>.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <dyn_wa> TO <fs1>.
call function 'CONVERSION_EXIT_MATN1_OUTPUT'
exporting
input = matnr
importing
output = matnr.
SHIFT matnr-low LEFT DELETING LEADING '0'.
<fs1> = matnr-low.
ASSIGN COMPONENT 'WERKS' OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = werks.
LOOP AT imard.
index = sy-index.
Set the LGORT
concatenate 'LGORT' imard-lgort into
fieldname.
condense fieldname no-gaps.
assign component fieldname of structure <dyn_wa> to <fs1>.
<fs1> = imard-lgort.
Set the LABST
CONCATENATE 'LABST' imard-lgort INTO
fieldname.
CONDENSE fieldname NO-GAPS.
ASSIGN COMPONENT fieldname OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = imard-labst.
INSME
CONCATENATE 'INSME' imard-lgort INTO
fieldname.
CONDENSE fieldname NO-GAPS.
ASSIGN COMPONENT fieldname OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = imard-insme .
*******RETEME
CONCATENATE 'RETME' imard-lgort INTO
fieldname.
CONDENSE fieldname NO-GAPS.
ASSIGN COMPONENT fieldname OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = imard-retme.
******UMLME
CONCATENATE 'UMLME' imard-lgort INTO
fieldname.
CONDENSE fieldname NO-GAPS.
ASSIGN COMPONENT fieldname OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = imard-umlme.
****SPEME
CONCATENATE 'SPEME' imard-lgort INTO
fieldname.
CONDENSE fieldname NO-GAPS.
ASSIGN COMPONENT fieldname OF STRUCTURE <dyn_wa> TO <fs1>.
<fs1> = imard-speme.
ENDLOOP.
Append to the dynamic internal table
APPEND <dyn_wa> TO <dyn_table>.
ENDFORM.
CALL_ALV
FORM call_alv.
DATA: wa_cat LIKE LINE OF alv_fldcat.
LOOP AT it_fldcat INTO wa_it_fldcat.
wa_cat-fieldname = wa_it_fldcat-fieldname.
wa_cat-seltext_s = wa_it_fldcat-seltext.
wa_cat-outputlen = wa_it_fldcat-outputlen.
APPEND wa_cat TO alv_fldcat.
ENDLOOP.
Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = alv_fldcat
TABLES
t_outtab = <dyn_table>.
ENDFORM. -
Dynamic table linking to text file
Access 2013.accdb
A large quantity of text files will be arriving to the user. They will all have the same fixed width format, but their file names will vary, and their stored location.
The data needs to be appended into Table1
I am thinking this approach: Link to a model text file Model.txt, and as part of that normal table linking I can set up the fixed width definitions for the fields. I have already done this ok. So I have this linked table 'Model1' in the navigation
pane
When a new text file comes the user will archive it in a folder: New1.txt
I can then get the path as a string: "C:blah blah \New1.txt" lets call this NewString
So what I am thinking is in order to Append in the new data; to first dynamically change the link table path to Model1 into the NewString and refresh the connect.
The AppendQuery is looking for Model1 so that table name must not change, and the fixed widths that were part of the Model1 initial linking must not change.
Does this sound viable - and what is the code for Model1 table relinking? Table Def connect properties is not something I've delved into and much of the research I've found is seriously old mdb vintage
I do not think the import spec feature of 2013 allows a dynamic change in file location / name - though if I am wrong on this point please let me know. And I think in terms of a TransferText import I would lose the fixed widths definition and
it would come in only as a single field file. So these are the reasons I am thinking of manipulating the table path connection.
Definitely would welcome advice on this one. TIAgetting a path to a file is pretty straight forward code out there for Windows Explorer file selection:
'file select
Dim strFile As String
With Application.FileDialog(1)
If .Show Then
strFile = .SelectedItems(1)
Else
MsgBox "No file selected", vbInformation
Exit Sub
End If
End With
'end file select
so strFile would be what I termed NewString in my original post; I have found code to change links to Access tables and even excel files - but haven't found what works to a text file....the code that I've experimented with does not like the .connect
refresh......
Maybe you are looking for
-
Relatório de Vendas por filial
Bom dia, Estou a procura de algum recurso da SAP B1 que me permita gerar um relatório de vendas por filial. Alguém sabe onde encontro? Já fiz uma análise do recuros Análise de Vendas porém ele não traz as informações de filial e como temos vendas fei
-
Analysing and Updating a table
Hi, Can anyone help me on follwing query.. Can analyse of a table and updation on to same table can happen paralley? thank in advance.
-
Hello Experts, We are facing a problem in approval of a bid using WS79000002. We have assigned the manager as approver in OOCU. The 'First Approval' step is being logically deleted. This is causing the error in 'Subwrokflow: Update Bid after Approval
-
PROBLEM PATCHING SOLARIS 10 FOR DST
OK - I messed up installing the DST patch, but now I cannot reinstall. I used "pkgadd" to install the patch 122032-04. It went fine into the global zone, but "partially failed" going into my other 4 zones. NOW - using "date" gives the correct time zo
-
Hi, Normally we implement SSL in case of B2B communication. If I am not wrong in this case we need to key storage services. One in XI and the other in the target business system. Please correct me if I am wrong. thanks kumar