4

I'm trying to configure AtomPullServer for viewing Apache CXF logs. I'm using Tomcat 7, Apache CXF 2.7.6, Apache Abdera 1.1.3.

According to documentation, the only thing that I should do will be to add this to the Spring context configuration file

<bean id="atomPullServer" class="org.apache.cxf.management.web.logging.atom.AtomPullServer" init-method="init">
    <property name="level" value="ERROR" />
    <property name="maxInMemorySize" value="100"/>
</bean>

<jaxrs:server id="atomServer" address="/atom">
    <jaxrs:serviceBeans>
        <ref bean="atomPullServer"/>
    </jaxrs:serviceBeans>

    <jaxrs:providers>
        <bean id="feed" class="org.apache.cxf.jaxrs.provider.atom.AtomFeedProvider" />
        <bean id="entry" class="org.apache.cxf.jaxrs.provider.atom.AtomEntryProvider" />
        <bean class="org.apache.cxf.jaxrs.ext.search.SearchContextProvider"/>
    </jaxrs:providers>
</jaxrs:server>

But as soon as I added it, I get (in the console) Exception in thread "http-bio-8080-exec-X" java.lang.OutOfMemoryError: PermGen space while accessing any of the services and of course the server does not respond anymore. If I remove these lines everything works fine.

Any idea what could be the problem?

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Adrian Ber
  • 20,474
  • 12
  • 67
  • 117

2 Answers2

3

The java.lang.OutOfMemoryError: PermGen space error usually occurs when the amount of java class meta information loaded by the JVM exceeds the threshold.

There could be different possible causes of this problem (discussed here), but it may just be that configuring the atom server triggers the loading of additional classes which don't fit into the default permgen area.

You should try to increase the PermGen size for your Tomcat's JVM by setting the following JVM option:

-XX:MaxPermSize=256m

Refer to this answer for more information.

Community
  • 1
  • 1
Alexey Gavrilov
  • 10,593
  • 2
  • 38
  • 48
  • This indeed solves the problem, but what I wanted to understand is why you need such a huge amount increase in memory just for a few log records. – Adrian Ber Jun 13 '14 at 17:20
  • PermGen size is not connected to amount of data. It is used to store class information, i.e. code. The increase is needed to accommodate all the required classes loaded by the atom pull server component. – Alexey Gavrilov Jun 13 '14 at 19:18
1
<property name="maxInMemorySize" value="100"/>

I think this 100 too high. Probably your memory is too low for storing 100 records, try increasing it memory, or you can reduce this number. It might help.

  • Is nowhere near high. It can easily work with 1000. Those 100 objects translates to at most a few (maybe hundreds) kilobytes depending on the message size. – Adrian Ber Jun 13 '14 at 17:17