• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

2011 - 2018 upgrade ORM Issues

New Here ,
Dec 16, 2019 Dec 16, 2019

Copy link to clipboard

Copied

Has anyone else received this error when migrating from 11 to 2018 with their ORM?

 

java.lang.NullPointerException

	at com.sun.xml.bind.v2.runtime.unmarshaller.StAXConnector$1.getPublicId(StAXConnector.java:101)

 

The site I am working on is using a manually created hibernate.hbmxml

I found 1 post about this here but no solution: https://community.adobe.com/t5/coldfusion/java-null-pointer-error-while-migrating-to-coldfusion18/td...

TOPICS
Advanced techniques , Getting started , Server administration

Views

803

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2019 Dec 16, 2019

Copy link to clipboard

Copied

I realize the problem started happening "on upgrade to CF2018", but no, I'm not aware of that being an issue generally.

So let's start with something simpler as a possible explanation.  Had you updated CF2018 after installing it? (The latest current update is update 7, from last week.) If you had, then we should check if perhaps you had an error IN the applying of the update itself.

 

Check to make sure there were no errors in the update. See the update error log, as I discuss in the post https://coldfusion.adobe.com/2019/03/problems-applying-cf-update-check-first/, looking for confirmation of all "successes" and 0 "errors" (in a table I which I discuss how to find there.)  It's not enough to say "I can access the Admin". 

If there WAS an error in the update process, I also tell how to solve it.

 

If that is not the issue, let us know and we can proceed from there. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 17, 2019 Dec 17, 2019

Copy link to clipboard

Copied

Thank you for the link and replying Charlie.  To give you some background I am working on upgrading ColdFusion 11 to ColdFusion 2018.  ColdFusion 11 was a 32 bit install and ColdFusion 2018 I went with the 64 bit install.  They are both installed locally on my laptop using IIS.

 

I installed ColdFusion 2018 and during the install there was an error of  "Error","http-nio-8518-exec-6","12/11/19","07:47:01","CFADMIN","Could not import your ColdFusion Runtime settings. - String index out of range: -1" I assumed this was because in ColdFusion 11 we are running a different version of Java then what it was installed with and that version of Java was a 32 bit version. The ColdFusion 2018 install is using the Java version installed with Coldfusion "C:/ColdFusion2018/jre"

 

Yesterday I also updated "patched" the ColdFusion 2018 to version 7. I started with update 3, 4,5, 6 would not install so I did 7.  When I reviewed the logs each install that was successful had a log and showed 0 Warnings, 0 NonFatalErrors, 0 FatalErrors. I am able to work in the ColdFusion Admin without any issues. I can also run a small sample code on the Coldfusion 2018 server just fine, but when I load our companies application I get that strange Java error. 

 

From what I can tell the marsheller is what reads in XML config data and works with it which would have me believe that something in the ORM configuration changed "the hibernate.hbmxml" file.  I did see the release notes stating that the class names needed to be changed from CFC:app.. to CFC.app... but that change still creates the same error.  If I remove everything inside the <hibernate-mapping> tags then that error is no longer there.  The hibernate.hbmxml was manually created for ColdFusion 11 vs Coldfusion creating it. I am new to hibernate and will keep on my path of learning that as well in hopes it gives me more insite to fix this but if anyone else has ran into something like this and has a fix you could share it would greatly help.  Thanks in advance Andy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2019 Dec 18, 2019

Copy link to clipboard

Copied

So far I have tracked this down to the hibernate.hbmxml.

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"
[
<!ENTITY common SYSTEM "common.hbm.xml">
]>

<hibernate-mapping>

<class entity-name="Address" name="cfc:app.model.address.Address" table="Address">
       &common;

 

That removing "&common;" stops the java.lang.NullPointerException error but then gives me:

The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,fetch-profile*,resultset*,(query|sql-query)*)".

 

I am not able to find anything on this as in what it is doing or how to correct it?  Has anyone who has worked with hibernate in the past familier with this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

Copy link to clipboard

Copied

Could you share any hbmxml file(s) you have, in full?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2019 Dec 18, 2019

Copy link to clipboard

Copied

About that &common, that's a feature in hibernate that lets you in effect "include" the XML from another hibernate file. Note how your first xml fragment has a line near the top:

<!ENTITY common SYSTEM "common.hbm.xml">

That is showing that you should have another file, common.hbm.xml, and it would seem that whatever is in there is your problem. You could try making it empty....or perhaps it doesn't exist.

 

If you may wonder how you could know that (especially since you admit to being new to Hibernate), I will say that I also have not worked with it much at all, either. 🙂 But I lucked out in doing some searching for you and found this old post that shows the very same &common element and file name being used:

http://jbanken.blogspot.com/2010/10/cf9-hibernate-file-includes.html

Let us know if that gets you further down the road.


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2019 Dec 18, 2019

Copy link to clipboard

Copied

Charlie thanks for that link that looks excatly like the code I am looking at.  When I remove the included file and copy the contents into the hibernate.hbmxml then restart coldfusion and reload the application I still get the same error so I think you are right that the included file is the issue. Below is the code from the included file "common.hbm.xml" it just seems like somethings changed in ColdFusion 2018 where this way of coding isn't valid anymore.  When I asked the question in the CFML Slack channel it seems no one uses these hibernate.hbmxml files anymore?

 

<id name="id" type="string">
<column name="ID" sql-type="uniqueidentifier" />
<generator class="guid" />
</id>
<property name="active" type="boolean">
<column name="Active" sql-type="bit" />
</property>
<property name="createdOn" type="timestamp">
<column name="Created_On" sql-type="datetime" />
</property>
<property name="createdBy" type="string">
<column name="Created_By" sql-type="uniqueidentifier" />
</property>
<property name="modifiedOn" type="timestamp">
<column name="Modified_On" sql-type="datetime" />
</property>
<property name="modifiedBy" type="string">
<column name="Modified_By" sql-type="uniqueidentifier" />
</property>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019

Copy link to clipboard

Copied

I probably have less ORM experience than Charlie. What I'd recommend, though, is to copy your existing customized hbm.xml files somewhere else, then let CF generate non-customized ones, then edit those and see what's different as far as file structure, elements, etc. It might be easier for you to recreate the custom ones after reading the standard ones.

 

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 22, 2019 Dec 22, 2019

Copy link to clipboard

Copied

Hi larsona,

I would

1) no longer use the HBMXML files generated manually. I would make a back-up of these files, for example, by renaming each, {currentFileName}.oldhbmxml

2) henceforth use the attributes of this.ORMSettings in Application.cfc to enable ColdFusion to automatically generate and manage the HBMXML files. As you can see in that documentation, the attributes concerned are:

 

autogenmap
(default=true)
Specifies whether ColdFusion should automatically generate mapping for the persistent CFCs. If autogenmap=false, mapping should be provided in the form of .HBMXML files.

 

cfclocation
Specifies the directory (or array of directories) that should be used by ColdFusion to search for persistent CFCs to generate the mapping. If cfclocation is set, ColdFusion looks at only the paths specified in it. If it is not set, ColdFusion looks at the application directory, its sub-directories, and its mapped directories to search for persistent CFCs.

 

ormconfig
(Don't use!)

 

savemapping
(default=false)
Specifies whether the generated Hibernate mapping file has to be saved to disc. If you set the value to true, the Hibernate mapping XML file is saved with the filename "CFC name".hbmxml in the same directory as the CFC. If any value of savemapping is specified in CFC, it will override the value specified in the ormsetting.

 

useDBForMapping
(default=true)
Specifies whether the database has to be inspected to identify the missing information required to generate the Hibernate mapping. The database is inspected to get the column data type, primary key and foreign key information

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 24, 2020 Jan 24, 2020

Copy link to clipboard

Copied

LATEST

Thanks everyone for the replies.  What I found out was that in the hibernate.hbmxl file there was an include statement

<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"
[
<!ENTITY common SYSTEM "common.hbm.xml">
]>

<hibernate-mapping>

<class entity-name="Address" name="cfc.app.model.address.Address" table="Address">
&common;

 

When I removed the &common; include and moved what was in the common file in it's place I was able to get past the java.lang.NullPointerException error I was having and get the application to load.  I am not sure what is wrong with the the code or why includes are not allowed anymore but the application was only including the common file in a few locations so it was not a big deal to make the change.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation