<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <font size="4" face="monospace">ehcache has several tactics for
      estimating the size of cached objects, which it uses for eviction
      calculations.  One of them uses Unsafe, and it appears to be using
      calls that don't work on value objects (and these calls are
      deprecated.)  It claims these tactics are pluggable.<br>
      <br>
      The solution is to reconfigure ehcache to use a better-behaved
      sizeof estimator.  There's some documentation (not much, though)
      here:<br>
      <br>
          <a class="moz-txt-link-freetext" href="https://github.com/ehcache/sizeof?tab=readme-ov-file">https://github.com/ehcache/sizeof?tab=readme-ov-file</a><br>
      <br>
    </font><br>
    <div class="moz-cite-prefix">On 8/2/2024 4:36 PM, Anderson
      Vasconcelos Pires wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CACB8oqUXrFW2Mw-bV-VdPVez3NQFD6_vGM+KthzUM+yjOhO9Zg@mail.gmail.com">
      
      <div dir="ltr">Hi guys,
        <div><br>
        </div>
        <div>
          <div>I just ran a spring boot application without modification
            to use the value class.</div>
          <div><br>
          </div>
          <div>
            <div>
              <div>The application runs normally. I just found the error
                below. I am not saying that this should not happen.
                Specifically because the method is marked for removal (<a href="https://openjdk.org/jeps/471" moz-do-not-send="true" class="moz-txt-link-freetext">https://openjdk.org/jeps/471</a>).</div>
              <div><br>
              </div>
              <div>Caused by: java.lang.UnsupportedOperationException:
                can't get field offset on a value class: private final
                strictfp long java.lang.Long.value<br>
              </div>
              <div> at
<a class="moz-txt-link-abbreviated" href="mailto:jdk.unsupported@23-valhalla/sun.misc.Unsafe.objectFieldOffset">jdk.unsupported@23-valhalla/sun.misc.Unsafe.objectFieldOffset</a>(Unsafe.java:659)
                ~[?:?]<br>
              </div>
            </div>
            <div>at
              org.ehcache.sizeof.impl.UnsafeSizeOf.sizeOf(UnsafeSizeOf.java:120)
              ~[ehcache-3.10.8-jakarta.jar:3.10.8]<br>
            </div>
            <div><br>
            </div>
            <div>OS: Windows Server</div>
            <div>Compiled with Jdk 17</div>
            <div>Run with --enable-preview</div>
            <div><br>
            </div>
            <div>Dependencies:</div>
            <div>org.springframework:spring-jdbc:6.1.3<br>
              org.springframework.security:spring-security-test:6.2.1<br>
              org.springframework.security:spring-security-ldap:6.2.1<br>
              org.springframework.ldap:spring-ldap-core:3.2.1<br>
              org.springframework.boot:spring-boot-starter-web:3.2.2<br>
              org.springframework.boot:spring-boot-starter-tomcat:3.2.2<br>
              org.springframework.boot:spring-boot-starter-test:3.2.2<br>
org.springframework.boot:spring-boot-starter-security:3.2.2<br>
              org.springframework.boot:spring-boot-starter-mail:3.2.2<br>
              org.springframework.boot:spring-boot-starter-log4j2:3.2.2<br>
org.springframework.boot:spring-boot-starter-data-jpa:3.2.2<br>
              org.springframework.boot:spring-boot-starter-cache:3.2.2<br>
              org.springframework.boot:spring-boot-starter:3.2.2<br>
              org.springframework.boot:spring-boot-starter<br>
              org.hibernate.orm:hibernate-core:6.4.1.Final<br>
              org.hibernate.orm:hibernate-jcache:6.4.1.Final<br>
              org.hibernate.orm:hibernate-envers:6.4.1.Final<br>
              org.snmp4j:snmp4j:3.7.7<br>
              org.samba.jcifs:jcifs:1.3.18-kohsuke-1<br>
              org.openjdk.nashorn:nashorn-core:15.4<br>
              org.glassfish.jaxb:txw2:4.0.4<br>
              org.glassfish.jaxb:jaxb-runtime:4.0.4<br>
              org.ehcache:ehcache:3.10.8<br>
              org.apache.tomcat:annotations-api:6.0.53<br>
              org.apache.poi:poi-ooxml:5.3.0<br>
              junit:junit:4.13.2<br>
              javax.cache:cache-api:1.1.1<br>
              io.grpc:grpc-stub:1.61.1<br>
              io.grpc:grpc-protobuf:1.61.1<br>
              io.grpc:grpc-netty-shaded:1.61.1<br>
              com.oracle.database.jdbc:ojdbc11:21.9.0.0<br>
              com.microsoft.sqlserver:mssql-jdbc:12.4.2.jre11<br>
              com.lmax:disruptor:3.4.4<br>
              com.h2database:h2:2.2.224<br>
              com.google.zxing:javase:3.5.3<br>
              com.google.zxing:core:3.5.3<br>
              com.google.guava:guava:33.0.0-jre<br>
            </div>
            <div><br>
            </div>
            <div>Best regards,</div>
            <div>Anderson.</div>
            <div><br>
            </div>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>