# Plugin Subscriber issue

**URL:** <https://forum.shopware.com/t/plugin-subscriber-issue/86860>\
**Category:** Shopware 6 (English)\
**Created:** [14. April 2021 um 09:04 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860 "2021-04-14T09:04:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 09:04 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/1 "2021-04-14T09:04:41Z")

</div>

I created a shopware plugin but when I tried to add an event subscriber, I got this error: " (2/2) ReflectionException The autoloader expected class „ConfigurationPlugin\Subscriber\Subscriber“ to be defined in file „/usr/www/users/ftp01000/\_abodemo/custom/plugins/ConfigurationPlugin/src//Subscriber/Subscriber.php“. The file was found but the class was not in it, the class name or namespace probably has a typo."  
In order to correct my class name, I renamed it from „ConfigSubscriber“ to just „Subscriber“. This lead to the server being crashed without prompting an error.  
I changed the name of the class bach to „ConfigSubscriber“ and now I am getting this new error:  
„Compile Error: Cannot declare class ConfigurationPlugin\Subscriber\ConfigSubscriber, because the name is already in use“.  
Kindly help me out.

---

<div class="post-metadata">

**Author:** ![Shopwarian](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shopwarian/32/12844_2.png) [@Shopwarian](https://forum.shopware.com/u/Shopwarian)\
**Post date:** [14. April 2021 um 09:08 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/2 "2021-04-14T09:08:47Z")

</div>

@hasan.h Could you post your subscriber here?

Also please make sure, that there is just one file in your Subscriber directory and it is named Subscriber.php.

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 09:29 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/4 "2021-04-14T09:29:10Z")

</div>

![Screenshot (285)](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/2/2563e99d6c6460c6dbe08aced666195c8767450e.png)

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 09:31 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/5 "2021-04-14T09:31:23Z")

</div>

and yes, there is only one file named Subscriber.php in my Subscriber directory.

---

<div class="post-metadata">

**Author:** ![Shopwarian](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shopwarian/32/12844_2.png) [@Shopwarian](https://forum.shopware.com/u/Shopwarian)\
**Post date:** [14. April 2021 um 09:39 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/6 "2021-04-14T09:39:15Z")

</div>

@hasan.h Looks good on first glance. Have you tried to clear the cache?

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 09:53 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/7 "2021-04-14T09:53:12Z")

</div>

I did. I typed bin/console cache:Clear in git bash but its still returning this error

---

<div class="post-metadata">

**Author:** ![Shopwarian](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shopwarian/32/12844_2.png) [@Shopwarian](https://forum.shopware.com/u/Shopwarian)\
**Post date:** [14. April 2021 um 09:57 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/8 "2021-04-14T09:57:20Z")

</div>

> [@hasan.h](#):
>
> ConfigSubscriber

Well, then maybe check the services.xml file. Perhaps it still contains ConfigSubscriber ? Or search for ‚ConfigSubscriber‘ in your whole project. It has to be somewhere…

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 10:05 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/9 "2021-04-14T10:05:48Z")

</div>

Here is the services.xml file:

 ![Screenshot (286)](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/c/c837ce284285784dca2f1e431af4c21722414009.png)

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 10:06 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/10 "2021-04-14T10:06:54Z")

</div>

and ConfigSubscriber is nowhere else in my project. As mentioned in the original post, this was giving some other error before I changed the name of class and changed it again.

---

<div class="post-metadata">

**Author:** ![Shopwarian](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shopwarian/32/12844_2.png) [@Shopwarian](https://forum.shopware.com/u/Shopwarian)\
**Post date:** [14. April 2021 um 10:15 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/11 "2021-04-14T10:15:31Z")

</div>

Try to replace your current \<service …\> with this:

```
<service id="ConfigurationPlugin\Subscriber\Subscriber">
    <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
    <tag name="kernel.event_subscriber"/>
 </service>
```

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 10:42 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/12 "2021-04-14T10:42:19Z")

</div>

> [@Shopwarian](#):
>
> ```auto
> <service id="ConfigurationPlugin\Subscriber\Subscriber">
> <argument type="service" id="Shopware\Core\System\SystemConfig\SystemConfigService"/>
> <tag name="kernel.event_subscriber"/>
> </service>
> 
> ```

I tried this solution and now I am getting this error:

 ![Screenshot (287)](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/0/0e0800b27fa8c3ca1668efbe78970a816aa7e4c4.png)

---

<div class="post-metadata">

**Author:** ![Shopwarian](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shopwarian/32/12844_2.png) [@Shopwarian](https://forum.shopware.com/u/Shopwarian)\
**Post date:** [14. April 2021 um 10:48 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/13 "2021-04-14T10:48:35Z")

</div>

OK, now I see it. In your screenshot, the class in named ConfigSubscriber:

 ![Screenshot (285)](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/2/2563e99d6c6460c6dbe08aced666195c8767450e.png)  
It should be named Subscriber. Then everything should click together.

---

<div class="post-metadata">

**Author:** ![hasan.h](https://avatars.discourse-cdn.com/v4/letter/h/e56c9b/32.png) [@hasan.h](https://forum.shopware.com/u/hasan.h)\
**Post date:** [14. April 2021 um 10:52 UTC](https://forum.shopware.com/t/plugin-subscriber-issue/86860/14 "2021-04-14T10:52:39Z")

</div>

Thankyou. bin/console isnt showing any error now but the website (client server) isnt letting me login. Any idea why is it showing me this error:

An error occurred while loading the web debug toolbar.
