EoMPLS Problem

Would like to seek your help to resolve one EoMPLS problem.
My EoMPLS topology is-
CE1[3640]---(FE)---PE1[7206VXR,NPE300]---(FE)---P1[3640]---(E1)---P2[7206VXR,NPE-G1]---PE2[7206VXR,NPE-G1]---(FE)---CE2[3640]
I had configure Ethernet over MPLS on subinterface between PE1 & PE2. P1 and P2 connected via E1 (Encap PPP). On LDP path, MTU is 1530. MPLS L2 VC is up, I can ping CE - CE upto ping size 1480 byte, but not able to transfer any file. In FTP session between CE-CE, can receive only file size upto 1024 byte. I had also try MTU 1560 on the LSP, but result is same.
If I use FastEthernet between P1 and P2, everything works fine with MTU 1530.
How to resolve the issue of the above topology?
Rgds.
Mesbah

Hi Mesbah,
First lets agree that your core needs to accommodate the extra bytes added for labels allover the LSP, secondly are you filtering ICMP any where within your path. By default PMTUD is operational on Windows platforms, this means that all outbound TCP traffic will have the DF bit set, but if you are not filtering ICMP any where along your path thus PMTUD should work with no problem. One thing to note, the difference between Vista and XP regarding this issue is that Vista has a feature called PMTUBHDetect (Black Hole Router Detect) enabled by default (it can be manually enabled on XP, and more over SP3 enables it by default).
http://support.microsoft.com/kb/925280
http://support.microsoft.com/kb/314053/en-us
http://download.microsoft.com/download/6/8/7/687484ed-8174-496d-8db9-f02b40c12982/Overview%20of%20Windows%20XP%20Service%20Pack%203.pdf
BR,
Mohammed Mahmoud.

Similar Messages

  • EoMPLS problem with 6500 and IOS SXF6 + SXE5

    My EoMPLS stopped working after one ge-wan interface gone down and up.
    Before the down it was working fine.
    The connection is between two 6500 switches, trough GE-WAN (OSM+4GEWAN) ports.
    One swith have IOS 12.2(18)SXF6 and the other is using 12.2(18)SXE5
    Any incompatibilities between the IOS ?
    or maybe another problem or BUG ?

    Did this help ? What I meen is: have you had another up/down after you have changed the OSM and did the EoMPLS worked fine after this up/down ?

  • EoMPLS QoS

    Hello Everybody,
    I am trying to deploy QoS for EoMPLS ERS service and would like to offer four Class of Service on a single ERS VC.
    I am trying following config on Cisco 7606 Router with SUP720 3BXL and PFC3BXL.
    My customer facing port is Gig Ethernet
    class-map match-any BestEffort-EoMPLS
    match cos 0 7
    class-map match-any Business-EoMPLS
    match cos 1 2
    class-map match-any Multimedia-EoMPLS
    match cos 3 4
    class-map match-any Realtime-EoMPLS
    match cos 5
    policy-map EoMPLS
    class Realtime-EoMPLS
    police cir 128000 bc 8000 be 8000 conform-action set-mpls-exp-transmit 5 exceed-action drop
    class Multimedia-EoMPLS
    police cir 128000 bc 8000 be 8000 conform-action set-mpls-exp-transmit 4 exceed-action drop
    class Business-EoMPLS
    police cir 128000 bc 8000 be 8000 conform-action set-mpls-exp-transmit 2 exceed-action drop
    class BestEffort-EoMPLS
    police cir 128000 bc 8000 be 8000 conform-action set-mpls-exp-transmit 0 exceed-action drop
    interface Vlan300
    no ip address
    load-interval 30
    xconnect 192.168.196.6 300 encapsulation mpls
    service-policy input EoMPLS
    end
    Problem Statment:
    On the 7606 PE ( PE1 ) , I am not able to see any traffic being matched in any of the class , not even in default class (considering that CoS setting from the CE can have problems) . Also on the PE 1 the “show policy-map interface vlan 300” command doesn’t displays that mpls exp bit imposition configuration value though it has been configured on the CLI.
    #sh policy-map interface vlan 300
    Vlan300
    Service-policy input: EoMPLS
    class-map: Realtime-EoMPLS (match-any)
    Match: cos 5
    police :
    128000 bps 8000 limit 8000 extended limit
    class-map: Multimedia-EoMPLS (match-any)
    Match: cos 3 4
    police :
    128000 bps 8000 limit 8000 extended limit
    class-map: Business-EoMPLS (match-any)
    Match: cos 1 2
    police :
    128000 bps 8000 limit 8000 extended limit
    class-map: BestEffort-EoMPLS (match-any)
    Match: cos 0 7
    police :
    128000 bps 8000 limit 8000 extended limit
    Class-map: class-default (match-any)
    0 packets, 0 bytes
    30 second offered rate 0 bps, drop rate 0 bps
    Match: any
    If any body has deployed such scenarios kindly help me out ..
    Also i would like to know if there are any limitations in offering such services
    Thanks and Regards
    Raj Panchal

    im afraid the answer here isnt that pleasent. Per VLan queueing in the fashion that you are trying to do is not supported. To do this you need to take a LAN port and loop it to a GE-WAN port (OSM blade). Then you do this kind of queueing on a sub interface on the WAN port. You have just ran into the same issue that i had a year back on the 7600's. Be aware that LAN ports can only offer basic queueing functionality and no more. To do anything fancy at all on the 7600 you always need to loop a lan port to a lan port (or just terminate your traffic onto a WAN port). Hope this helps this im sure it doesnt.

  • Service module placement and the L2 adjacency problem

    I'd be very interested to hear others opinions on this. You have a datacenter environment with L2 boundaries at end of row aggregators, then L3 back to the core and edge. You have 6500 service module switches hanging off the core housing ACE and FWSM modules. You want to offer firewalling and load-balancing services to servers around the datacenter.
    What is the current best practice ways of resolving the L2 adjacency requirement that the firewalling and load-balancing services impose? L2TPv3? EoMPLS? Any relevant advice, deployment examples, whitepapers etc would be much appreciated!
    Thanks for any replies,
    George

    George
    You could i suppose look to use L2TPv3 if your switches support it or EoMPLS but to my mind this is actually using a band aid to fix a problem that shouldn't be there.
    We too struggled in our data centres with this setup but remember you only need L2 adjacency if you are running the FWSM in transparent mode or the ACE in bridged mode.
    If you are then the cleanest solutions are either
    1) redesign core connections to L2
    2) deploy 6500 switches in the distribution layer. I say distribution layer because it's not clear from your description what your topology actually is but i'm assuming L2 access to distro and then L3 distro to core and the core switches are the 6500 switches.
    Personally i always use the routed L3 approach where possible for fast failover and no STP and in the campus environment it works really well.
    However L3 from the access-layer to the distro in the data centre is very limiting and you often come across problems such as the one you are facing.
    Now again it does depend on your topology but assuming the issue is your core is L3 connected and you need L2 adjacency with your distro to offer servers i would look to deploy 6500 switches in the distro layer with the service modules in them.
    If i have misunderstood please come back with more details.
    Jon

  • EoMPLS with Catalyst 3750 Metro Switches

    Hi,
    I am trying to setup an EoMPLS tunnel (VLAN mode) between two 3750 Metro switches. But I am not getting the Status down from the both PEs.Also the 'show mpls l2transport binding' shows no output interface and no label stack is attached. Can anybody in the forum help me out? Is it any IOS related problem.
    The IOS version is:c3750me-i5k91-mz.122-25.SEG1.bin
    Thank you,
    Dabraj Sarkar
    Grameenphone Ltd,
    Dhaka, Bangladesh

    Hi,
    can you provide the related config? Without this it is hard to tell anything.
    Regards, Martin

  • Transparent layer 2 tunneling through EoMPLS on Nexus 7K

    Hello,
    Does anyone know if the N7K supports transparent layer 2 tunneling of control traffic (CDP, STP and VTP) over EoMPLS? I'm unable to find exact info about this in Cisco's documentation.
    Here's the problem I'm having:
    I have an EoMPLS virtual connect configured between a ME3600X switch and a Nexus 7K switch to extend layer 2 domain across two different sites. The virtual connect is up and running and passing traffic successfully between the CEs. However, I'm having problem with tunneling CDP traffic from the N7K end to the ME3600X end. CDP tunneling in the other way is working fine. i.e. CE1 connected to the N7K is able to see the other CE (CE2) in its CDP table; however, CE2 connected to the ME3600X is unable to see CE1 in its CDP table, which I believe is caused by the N7K not tunneling the CDP traffic through the EoMPLS VC properly.
    Below is the config:
    ! CE1 is connected to N7K port e3/28.
    ! CE2 is connected to ME3600X port g0/24.
    ! N7K:
    feature mpls l2vpn
    l2vpn
    interface loopback100
      ip address 10.255.255.200/32
      ip router ospf 185 area 0.0.0.0
    port-profile type pseudowire MPLS
      encapsulation mpls
      state enabled
    l2vpn xconnect context TestToME
      member Ethernet3/28 service-instance 1
      member pseudowire185
    interface pseudowire185
      inherit port-profile MPLS
      neighbor 10.255.255.150 102
      encapsulation mpls
      vc type ethernet
      mtu 9216
    interface Ethernet3/28
      no cdp enable
      no shutdown
      service instance 1 ethernet
        encapsulation default
        no shutdown
    ! ME3600X
    interface Loopback100
     ip address 10.255.255.150 255.255.255.255
    interface GigabitEthernet0/24
     switchport trunk allowed vlan none
     switchport mode trunk
     service instance 1 ethernet
      encapsulation default
      l2protocol forward cdp
      bridge-domain 102
    interface Vlan102
     mtu 9216
     no ip address
     xconnect 10.255.255.200 102 encapsulation mpls

    Folks,
    I have this issue resolved.
    There were reported bugs in earlier version of code for the ME3600X which dropped MSTP and RSTP BPDU's.
    Also there are 2 different use cases for using the L2protocol command:
    1, When creating a service instance between 2 devices that supports the L2protocol command use L2protocol tunnel (ME3600 to ME3600)
    2, When creating a service instance between a deice that supports the L2protcol command and another device that does not support the L2protocol command use L2protocol forward (ME3600 - 2911 or ME3600 to non Cisco device)
    I upgraded the s/w on the ME3600 to 15.3-2
    Here is the working configuration between the ME3600 and the 2911
    PE1 (ME 3600X)
    int g0/1
    port-type nni
    switchport trunk allowed vlan none
    switchport mode tunk
    service instance 2 ethernet
    encapsulation dot1q 2
    rewrite ingress tag pop 1 symmetric
    l2protocol forward stp
    xconnect 10.11.1.4 encapsulation mpls
    PE 2 (2911)
    int g0/2.2
    xconnect 10.11.1.16 encapsulation mpls
    CE 1 and CE 2
    int g0/1
    switchport mode trunk
    Thanks for your help.
    Colm

  • Virtually L3-terminate a EoMPLS Tunnel on a ASR1000

    Hi all,
    I am trying to terminate a EoMPLS Tunnel with a virtual L3 interface on a ASR1000 without any physical port interaction.
    We need to send the Traffic from Subinterfaces of some PE's (7600 and ASR9k) to an ASR1000 which sould use ISG functionallity to authorize and bw-limit the subscribers.
    On the current setup we terminate the xconnects on a 7600 PE as well, and we send the traffic dot1q tagged to the ISG which is the L3 endpoint for the customers.
    To make the switchover from a failed device easier, we now want to terminate everything on the ASR1000. Im my understanding, this shoud be possible with an l2 vfi, with an configured bridge-domain with BDI Interface and an EoMPLS neighbor.
    The config I tired on the ASR1000 looks like:
    l2 vfi vfi50 manual
    vpn id 50
    bridge-domain 50
    neighbor <PE IP> 103685 encapsulation mpls
    interface BDI50
    vrf forwarding ISG_TABLE
    ip address <Service IP> <netmask>
    ip helper-address <DHCP>
    load-interval 30
    The communication from the Customer Network to the DHCP works, and I can even ping the BDI Interface IP, but I can not get further to the internet. Pinging a public address from the BDI50 Interface however works fine.
    When I do a debug ip packet on that range, I can only see broadcasted packets (which get forwarded to the helper address).
    However, MAC Adresses and ARP tables and gateway on the client looks good:
    ar90.bie005.bb#sh bridge-domain 50
    Bridge-domain 50 (2 ports in all)
    State: UP                    Mac learning: Enabled
    Aging-Timer: 180 second(s)
        BDI50  (up)
        vfi vfi50 neighbor <PE IP> 103685
       MAC address    Policy    Tag     Age Pseudoport
       C84C.75E1.CEBF to_bdi  static      0 BDI50
       88AE.1DAA.502A forward dynamic   179 vfi50.1020017              #88AE.1DAA.502A = Lab Laptop
    ar90.bie005.bb#sh xconnect all
    XC ST  Segment 1                         S1 Segment 2                         S2
    ------+---------------------------------+--+---------------------------------+--
    UP pri  vfi vfi50                        UP mpls <PE IP>:103685        UP
    UP pri   bd 50                           UP  vfi vfi50                        UP
    ar90.bie005.bb#sh ip arp vrf ISG_TABLE
    Protocol  Address          Age (min)  Hardware Addr   Type   Interface
    Internet  <SERVICE Address>            -   c84c.75e1.cebf  ARPA   BDI50
    Internet  <Lab Laptop IP>            0   88ae.1daa.502a  ARPA   BDI50
    Am I missing something? Is there a limitation I am hitting? In the most documents I found there was always a Service Instance on an Interface involved, which is certainly missing here.
    Thaks for any help!

    Hi,
    yes actually it should be fixed ;-)
    It was a bug on the ASR (
    CSCub44215), it had somehow problems with that routed vpls scenareo with routes learned from mp-bgp.
    I could verify the fix of the problem with an engineering release, however, I did not have time to check the functionallity on Software Version 3.7.1.S / 15.2(4)S1 where the fix of the bug was implemented officially. But I'm very confident that it will work with that version as well.
    Regards

  • EoMPLS MTU issue

    Hello,
    I need help with EoMPLS issue. I know EoMPLS uses something like 1530 bytes MTU (due to the 1500bytes frame and all the encapsulations involved) and does not allow for fragmentation.
    I have the following scenario:
    CE-MetroRing-NPE-P-P-NPE-MetroRing-CE
    NPE-7600-Sup7203BXL
    P-GSR12006
    When I send a ping of 1486bytes from the CE Router everything works ok, BUT When I increase the MTU to 1487bytes it stops working. So I have a 14-byte problem in the network.
    The whole network has configured the "mpls mtu 9216" command on all the GE interfaces, BUT all the physical MTU are configured to support 1500Bytes, so here is my question:
    Do I have to increase the Physical MTU on the GE interfaces to get this scenario working?
    Also, in case I have to increase the MTU, does it mean that the network service is to be interrupted? (maybe OSPF flap becasue to MTU change or may be interface flap).
    Thanks!

    But I have the MPLS MTU configured for 9216 bytes on all GE Interfaces "mpls mtu 9216"
    I just saw while doing some troubleshooting the following:
    CE1-MetroRing-NPE1-P-P-NPE2-MetroRing-CE2
    Send a 1500bytes ping form CE1
    issue a "show mpls l2t vc 101 detail" on NPE1 and see that the send packets increase the same number of pings I sent.
    issue a "show interface ge-wan9/1" on NPE2 and see the same number of packets arrive as GIANTS and never get to their destination. The interface ge-wan 9/1 has the MPLS MTU increased to 9216, but the physical MTU fixed at 1500bytes.
    I think that may be the interface as it dont see any MPLS frames (they dont have any labels) it treated as normal IP packets and drop them due to the size.
    What could be causing this behavior?
    Thanks!

  • EoMPLS : QinQ, Vlan-based

    Hi I'm on a EoMPLS project. I succed to connect Customer site accross EoMPLS tunnel.
    This is my architecture :
       LAN1 -- CE1 --- PE1 (7200)---- MPLS backbone --- PE2 (7200) -- CE2 -- LAN2
    Now I know how to transport vlan between CE but my problem is to understand the difference.
    In my mind, "Vlan-based" use one VLAN operator (So 1 pseudowire) to transmit all frame tagged or not to CE2. And, "QinQ" allow to do the difference between different Customer VLANs and forward accross MPLS backbone frame on different VLAN operator.
    2 questions :
    1. Have I correctly understand ??
    2. If I'm right, Why we need QinQ ?? What QinQ bring it more than VLAN-BASED ??
    3. My goal is to create on Site 1 any vlans and with VTP transport them to Site 2. What kind of these two technology based on VLAN use ??
    Thanks for answer !

    Ok thanks for answer.
    I understand the principle but PE in my case is a 7200 emulated router. I work with dynagen/dynamips server and only 7200 can be emulated no 7600 !!
    I have looked these following links :
    http://www.cisco.com/en/US/docs/switches/lan/catalyst3550/software/release/12.1_9_ea1/configuration/guide/swtunnel.html#wp1010370
    http://www.cisco.com/en/US/docs/ios/ios_xe/mpls/configuration/guide/mp_qnq_tunneling_atom_xe.html#wp1001506
    In the first link we can see the dot1q tunnel mode with some layer 2 protocol transport CDP, STP, and VTP.
    Ideally this is my first goal --> transport VTP on site 2 by EoMPLS  but it was only on switch multilayer (like 7600) or with specially cards, I don't know. But what I know it's with my 7200 I  don't have command switchport to activate switchport mode dot1q-tunnel and l2protocol-tunnel vtp for example.
    Is it true ??
    Secondly, in the second link I read I should to be able to transport vlan frame of site 1 to site 2 but simply carry and not propagate different vlan that I created !!!
    Again, Have I correctly understand ??
    Thanks for help

  • MST BPDU via EoMPLS Pseudowire Connections

    Hi All,
    I've been trying to change the STP  mode of my MPLS aggrigation switches to MST due to many reasons but without success. (Currently all switches are working on PVST+.)
    Below given my sample network topology, configurations on both switches and pseudowire configurations and error message.
    ME3750(SW1) --- 7609 (EoMPLS pseudowire - VLAN 2500) 12406 -- ME3750(SW2)
    Configurations
    ==========
    ME3750(SW1)
    =============
    spanning-tree mode mst
    spanning-tree extend system-id
    spanning-tree mst configuration
    name MPLS
    revision 10
    instance 10 vlan 2-99
    instance 20 vlan 100-1999
    instance 30 vlan 2000-4094
    spanning-tree mst 0,10,20,30 priority 24576
    vlan 3,100,850,2500,3030
    7609-PE
    =======
    interface GigabitEthernet0/1.2500
    description *** MST_TEST ***
    encapsulation dot1Q 2500
    xconnect 10.2.0.5 2500 encapsulation mpls
    end
    ME3750(SW2)
    ===========
    spanning-tree mode mst
    spanning-tree extend system-id
    spanning-tree mst configuration
    name MPLS
    revision 10
    instance 10 vlan 2-99
    instance 20 vlan 100-1999
    instance 30 vlan 2000-4094
    12406-PE
    =======
    interface GigabitEthernet2/1/0.2500
    description *** MST_TEST ***
    encapsulation dot1Q 2500
    xconnect 10.1.0.8 2500 encapsulation mpls
    end
    There is a VLAN bsed EoMPLS configuration on VLAN 2500 on MPLS edges.
    When the MST configuration done; the uplink trunk port of the ME3750(SW1) blocked with following erroe.
    *Mar  1 02:45:11.920: %SPANTREE-2-PVSTSIM_FAIL: Blocking designated port Gi0/1: Inconsitent superior PVST BPDU received on VLAN 2500, claiming root 24576:001a.a2b5.7d00
    While I googled, i found one post saying to change the priority of the MST regions to higher, hence forcing  one switch to become ROOT. Accordingly I changed the priority of ME3750(SW1) but still problem remains.
    Can anyone of you experts help me out to get this sorted?
    Note: I've not enabled native VLAN on both switches towards MPLE PEs and also hasn't enable any L2 protocols via speudowire connection.
    Thank you all,
    Chaminda

    Hi Laurant,
    Thanks for your reply.
    Actually  my requirement is to have local MST reigions per MPLS PE. That is why I  psecificaly block native VLAN passing through the PW and did not enable  any L2 protocols via PW.( believe this is a good practice.. ;-) )
    BTW  I'll clear STP protocol as you suggested and see the results.
    Also I can not configure port mode PW, since all my L2 & L3 customers interface with MPLS PE via this Gig interface.
    My  understanding on MST BPDUs are passing through native VLAN. Hence in my  scenarion, if i'm not passing native VLAN throught the PW, what could  be the reason for blocking the entire port due to the "inconsistance  superior BPDU receive via VLAN 2500"?
    Do I need to block STP on 7609 box itself? (read on one blog asking to disable STP on SUP720 on 7609)
    Pl clarify.
    Thank You,
    Chaminda

  • PPPoE over EoMPLS

    There are 10 DSLAMs;
    Neccessary to migrate to MPLS network;
    Each DSLAM connected through 802.1Q trunk to the one PPPoE terminator, there are many vlan subinterfaces with PPPoE enable on.
    The question: how to tunnel the each DSLAM trunk to one trunk connected to PPPoE terminator?
    The problem is EoMPLS is point to point technology.
    But PPPoE terminator is in a center of virtual star.

    The document has more information about Cisco DSLAMs.
    http://www.cisco.com/univercd/cc/td/doc/product/dsl_prod/ios_dsl/rel122/relnotes/reln1225.pdf

  • EoMPLS issue

    Hi all,
    I have seen a few questions posted on the forum about EoMPLS issues, but the one I have is different to those already posted and responded too.
    I have attached a document which includes the topology, configurations and output from commands to show the problem.
    Basically between the two PE routers concerned with the EoMPLS tunnel, I'm receiving labels for the VC from the egress PE, as well as the next hop label. However, the VC will not become active and the next-hop address (shown in one of the outputs) is stating it is an invalid address.
    Any ideas?
    Thanks

    Harold,
    Many thanks with your reply. Changing it from a VLAN-based EoMPLS configuration to a Port-Based EoMPLS configuration brought the VC up.
    I was hoping on using VLAN based so I could try to do VLAN re-writing on the 6509. But not being classed as a router, I wasn't sure if this would even be possible anyway. Any suggestions on the best way to renumber the VLAN over an MPLS network? I'm work for the enterprise and this is a self managed MPLS network so either way the re-mapping of VLANs falls into my basket if we have to do it outside the MPLS network. It is just alot cleaner with MPLS...
    Regards
    Steve

  • A problem with threads

    I am trying to implement some kind of a server listening for requests. The listener part of the app, is a daemon thread that listens for connections and instantiates a handling daemon thread once it gets some. However, my problem is that i must be able to kill the listening thread at the user's will (say via a sto button). I have done this via the Sun's proposed way, by testing a boolean flag in the loop, which is set to false when i wish to kill the thread. The problem with this thing is the following...
    Once the thread starts excecuting, it will test the flag, find it true and enter the loop. At some point it will LOCK on the server socket waiting for connection. Unless some client actually connects, it will keep on listening indefinatelly whithought ever bothering to check for the flag again (no matter how many times you set the damn thing to false).
    My question is this: Is there any real, non-theoretical, applied way to stop thread in java safely?
    Thank you in advance,
    Lefty

    This was one solution from the socket programming forum, have you tried this??
    public Thread MyThread extends Thread{
         boolean active = true;          
         public void run(){
              ss.setSoTimeout(90);               
              while (active){                   
                   try{                       
                        serverSocket = ss.accept();
                   catch (SocketTimeoutException ste){
                   // do nothing                   
         // interrupt thread           
         public void deactivate(){               
              active = false;
              // you gotta sleep for a time longer than the               
              // accept() timeout to make sure that timeout is finished.               
              try{
                   sleep(91);               
              }catch (InterruptedException ie){            
              interrupt();
    }

  • A problem with Threads and MMapi

    I am tring to execute a class based on Game canvas.
    The problem begin when I try to Play both a MIDI tone and to run an infinit Thread loop.
    The MIDI tone "Stammers".
    How to over come the problem?
    Thanks in advance
    Kobi
    See Code example below:
    import java.io.IOException;
    import java.io.InputStream;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.media.Manager;
    import javax.microedition.media.MediaException;
    import javax.microedition.media.Player;
    public class MainScreenCanvas extends GameCanvas implements Runnable {
         private MainMIDlet parent;
         private boolean mTrucking = false;
         Image imgBackgound = null;
         int imgBackgoundX = 0, imgBackgoundY = 0;
         Player player;
         public MainScreenCanvas(MainMIDlet parent)
              super(true);
              this.parent = parent;
              try
                   imgBackgound = Image.createImage("/images/area03_bkg0.png");
                   imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
                   imgBackgoundY = this.getHeight() - imgBackgound.getHeight();
              catch(Exception e)
                   System.out.println(e.getMessage());
          * starts thread
         public void start()
              mTrucking = true;
              Thread t = new Thread(this);
              t.start();
          * stops thread
         public void stop()
              mTrucking = false;
         public void play()
              try
                   InputStream is = getClass().getResourceAsStream("/sounds/scale.mid");
                   player = Manager.createPlayer(is, "audio/midi");
                   player.setLoopCount(-1);
                   player.prefetch();
                   player.start();
              catch(Exception e)
                   System.out.println(e.getMessage());
         public void run()
              Graphics g = getGraphics();
              play();
              while (true)
                   tick();
                   input();
                   render(g);
          * responsible for object movements
         private void tick()
          * response to key input
         private void input()
              int keyStates = getKeyStates();
              if ((keyStates & LEFT_PRESSED) != 0)
                   imgBackgoundX++;
                   if (imgBackgoundX > 0)
                        imgBackgoundX = 0;
              if ((keyStates & RIGHT_PRESSED) != 0)
                   imgBackgoundX--;
                   if (imgBackgoundX < this.getWidth() - imgBackgound.getWidth())
                        imgBackgoundX = this.getWidth() - imgBackgound.getWidth();
          * Responsible for the drawing
          * @param g
         private void render(Graphics g)
              g.drawImage(imgBackgound, imgBackgoundX, imgBackgoundY, Graphics.TOP | Graphics.LEFT);
              this.flushGraphics();
    }

    You can also try to provide a greater Priority to your player thread so that it gains the CPU time when ever it needs it and don't harm the playback.
    However a loop in a Thread and that to an infinite loop is one kind of very bad programming, 'cuz the loop eats up most of your CPU time which in turn adds up more delays of the execution of other tasks (just as in your case it is the playback). By witting codes bit efficiently and planning out the architectural execution flow of the app before start writing the code helps solve these kind of issues.
    You can go through [this simple tutorial|http://oreilly.com/catalog/expjava/excerpt/index.html] about Basics of Java and Threads to know more about threads.
    Regds,
    SD
    N.B. And yes there are more articles and tutorials available but much of them targets the Java SE / EE, but if you want to read them here is [another great one straight from SUN|http://java.sun.com/docs/books/tutorial/essential/concurrency/index.html] .
    Edited by: find_suvro@SDN on 7 Nov, 2008 12:00 PM

  • J2ME problem with threads

    Hi all,
    I would like to ask you for a help. I need to write a small program at my university. I started to write a midlet which function would be to countdown time for sports activities. I woul like to start a new thread - the one that counts down - and at the same time make the main thread sleep. After the "countdown" thread finishes, the main thread wakes up and waits for user input. The problem is that when the "countdown" thread finishes his work, I've got Uncaught exception java/lang/NullPointerException. error and the midlet halts.
    Below you can find the code
    import java.lang.*;
    import java.util.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class intervals extends MIDlet implements CommandListener
    public Display ekran;
    private SweepCanvas sweeper;
    private Form rundy;
    private TextField round0, round1, round2, round3, round4, round5, round6, round7, round8;
    private long czas,x;
    private Command exitCommand;
    private Command addRound;
    private Command delRound;
    private Command start;
    private TextField repeat;
    private Form odliczanie;
    private Alert ostrz;
    Licznik thread;
    String test;
    StringItem test1;
    int parz,i,j,k;
    static int l;
    int ilrund;
    int ilpowt;
    Item sec;
    long sec1;
    public intervals()
        rundy = new Form("Interwa&#322;y sportowe");
        exitCommand = new Command("Wyj&#347;cie", Command.EXIT, 2);
        addRound = new Command("Dodaj","Dodaj rund&#281;", Command.ITEM,1);
        delRound = new Command("Usu&#324;","Usu&#324; ostatni&#261; rund&#281;", Command.ITEM,1);
        start = new Command("Start", Command.ITEM,1);
        odliczanie = new Form("Odliczanie");
        TextField dodaj(TextField kolej)
            kolej=new TextField("Podaj czas (s) rundy "+parz,null, 4, TextField.NUMERIC);//stworzenie nowej instancji do wybierania czasu trwania rundy
            if(rundy.size()==0)
                rundy.insert(rundy.size(),kolej);
                else
                    rundy.insert(rundy.size()-1, kolej);
            return kolej;
        void odliczanie(TextField round)
            monitor m=new monitor();
            k=Integer.parseInt(round.getString());
            ekran.setCurrent(odliczanie);
            thread=new Licznik(k,odliczanie);
            thread.start();
            ekran.setCurrent(rundy);
    public void startApp()// throws MIDletStateChangeException
        rundy.deleteAll();
        repeat = new TextField("Podaj ilo&#347;&#263; powtórze&#324;",null,1,TextField.NUMERIC);
        rundy.addCommand(addRound);
        rundy.addCommand(exitCommand);
        rundy.setCommandListener(this);
        Canvas obrazek = new MyCanvas();
        ekran = Display.getDisplay(this);
        ekran.setCurrent(obrazek);
        czas=System.currentTimeMillis();
        while (System.currentTimeMillis()<czas+1000)
            continue;
        ekran.setCurrent(rundy);
    public void pauseApp()
    public void destroyApp(boolean unconditional)
        notifyDestroyed();
    public void commandAction(Command c, Displayable s)
        if (c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
        else if(c==addRound)
            if(rundy.size()==0)//Sprawdzenie ilo&#347;ci elementów w celu poprawnego wy&#347;wietlania liczby rund w formie
                parz=1;
                else
                parz=rundy.size();
            switch(parz)
                case 1:
                    round0=dodaj(round0);break;
                case 2:
                    round1=dodaj(round1);break;
                case 3:
                   round2= dodaj(round2);break;
                case 4:
                    round3=dodaj(round3);break;
                case 5:
                    round4=dodaj(round4);break;
                default:
                    ostrz=new Alert("Uwaga","Maksymalna liczba rund wynosi 9", null, AlertType.INFO);
                    ostrz.setTimeout(3000);
                    ekran.setCurrent(ostrz);
            if(rundy.size()==1)
                rundy.append(repeat);
                rundy.addCommand(start);
            rundy.addCommand(delRound);
        else if(c==delRound)
            if(rundy.size()!=0)
                rundy.delete(rundy.size()-2);
                if (rundy.size()==1)
                    rundy.deleteAll();
                if(rundy.size()==0)
                    rundy.removeCommand(delRound);
                    rundy.removeCommand(start);
        else if(c==start)
            ilrund=rundy.size()-1;
            if(this.repeat.size()>0)
                ilpowt=Integer.parseInt(this.repeat.getString());
            ekran = Display.getDisplay(this);
            for (i=1; i<=ilpowt;i++)
                odliczanie= new Form("Odliczanie");
                 for (j=0;j<ilrund;j++)
                    switch(j)
                         case 0:
                             odliczanie(round0);
                             break;
                         case 1:
                             odliczanie(round1);
                             break;
                         case 2:
                             odliczanie(round2);
                             break;
                         case 3:
                             odliczanie(round3);
                             break;
                         case 4:
                             odliczanie(round4);
                             break;
                         case 5:
                             odliczanie(round5);
                             break;
                         case 6:
                             odliczanie(round6);
                             break;
                         case 7:
                             odliczanie(round7);
                             break;
                         case 8:
                             odliczanie(round8);
                             break;
    class Licznik extends Thread
        int czas1,k;
        Form forma;
        monitor m;
        public Licznik(int k,Form formap)
            czas1=k;
            forma=formap;
        public synchronized void run()
            while(czas1>0)
                forma.deleteAll();
                forma.append("Czas pozosta&#322;y (s): "+czas1);
                try{Thread.sleep(1000);} catch(InterruptedException e){e.printStackTrace();}
                czas1--;
            if(czas1<=0)
                m.put();
        }and monitor class
    public class monitor
    boolean busy=false;
    synchronized void get()
        if(!busy)
            try
                wait();
            }catch(InterruptedException e){e.printStackTrace();}
        notify();
    synchronized void put()
        if(busy)
            try
            wait();
            }catch(InterruptedException e){e.printStackTrace();}
        busy=true;
        notify();
    }Can anybody help me with this?

    Groovemaker,
    Your Licznik class has a member m of type monitor, which has not been instantiated (in other words is null) hence, when calling m.put() you get NullPointerException. Please also mind, that using Thread.sleep(1000) is not an accurate way of measuring time.
    If I may, please use recommended for Java class naming conventions - some of your names use lower case, while other don't which is confusing to the reader.
    Daniel

Maybe you are looking for

  • Automatically run applications on start up

    Hello all: Does anyone know how to automatically run certain applications such as Mail on start up? I don't think this is an automater function but not completely sure. Thanks in advance!

  • Super crashes?

    Using the latest FCP X (ver. 10.0.9).  Just started using it. My system - MacBook Pro 2.66 GHz Intel Core i7, with 8 GB Ram, 1067 MHz DDR3 I'm getting these very unusual crashes.  While working with FCP X the screen suddenly goes black, everything fr

  • Force Date "Display Pattern"??

    Greetings, We are having troubles with the "Display Pattern" of Date fields.  The scenario is that we receive data in XML, apply it to the form, and then want it displayed in a specific format on the Form, but it doesn't work like it should. For exam

  • WLC downgrade

    I currently have 4400 series and 2000 series controller which are running 4.2.176 code. I have purchased some 2112 and 2125 but they have come with 5.2 code, is there a way to downgrade them to 4.2.176? I haven't been able to find this code on the CC

  • HT203164 i cannot burn a CD from my playlist and I am steaming mad.  There is no help on the internet for this.

    I keep getting error 4310 when i try to burn a CD.  I checked all of the things the trouble shooting page said to check.  I have the latest version of Itunes, i have windows 8.  there was link to download some "fix it' software, but i wasnt sure if i