9

I am using JBoss Developer Studio. I have a project with a persistence.xml file. The file is perfect to me, but I keep getting this error on the tab that lists all the Problems of my project.

Class "[Ljava.lang.String;@22ec7158" cannot be resolved

I include the picture for a better context.

enter image description here

When I click on the error, so that it takes me to the place where the error is happening, it takes me to the end of the file.

Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Persistence">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:jboss/datasources/MemberOfferDS</jta-data-source>
    <class>com.bbb.memberoffer.model.SycsCoordinator</class>
    <class>com.bbb.aicweb.memberoffer.model.SycsCoordinatorPhoneNumber</class>
    <class>com.bbb.memberoffer.model.SycsCoordinatorClub</class>
    <class>com.bbb.memberoffer.model.SycsCoordinatorSecurityGroup</class>
    <class>com.bbb.memberoffer.model.SycsCoordinatorClubPk</class>
    <class>com.bbb.memberoffer.model.PhoneNumberType</class>
    <class>com.bbb.memberoffer.model.Club</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
        <!-- Not sure if this is the right one to use or not? -->
        <property name='hibernate.show_sql' value='true' />
        <property name='hibernate.format_sql' value='true' />
        <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
    </properties>
</persistence-unit>
</persistence>
Jadiel de Armas
  • 8,405
  • 7
  • 46
  • 62

1 Answers1

11

You may have solved this already, however, in my case the problem was caused by referencing a class in a element that no longer existed.

EDIT: The exact reason for this type of error message is that the error generator is trying to run a toString() on a String array when it generates the error message.

Dan Smith
  • 763
  • 9
  • 14
  • Thanks. Dan. I had the same problem and your answer was the solution. However, have you figured out what such a strange error message has in common with the root cause? – Honza Zidek May 30 '15 at 06:55
  • @HonzaZidek I think it's a peculiarity in the way it checks the types. I think that the String classes that "can't be resolved" are actually the .toString() of the instances of the strings in the XML file. The hex code and output looks like something that would typically be output when calling System.out.println on a custom type without a .toString() method. But that's all a guess. In order to more closely understand what it's doing there I'd have to look at the source. – Dan Smith Jun 02 '15 at 17:37
  • The reason for this is that it is trying to run a toString() on a String array when it generates the error message. – Dan Smith Jun 20 '16 at 18:05
  • Dan, add your new comment to your answer. It is educative :) – Honza Zidek Jun 27 '16 at 07:21
  • Any way of finding the offending line in the xml? – Thomas Apr 25 '18 at 07:01