I need help upgrading OroCommerce to 4.1.1 - orocommerce

I just upgraded from 3.1.17 to 4.1.1 and I'm finding a problem with my shopping lists.
When I get to /customer/shoppinglist/5064 I see this:
Looking at my log files from production I see:
[2020-06-23 17:42:56] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\UndefinedMethodError: "Attempted to call an undefined method named "getDigitalAsset" of class "Proxies\__CG__\Oro\Bundle\AttachmentBundle\Entity\File"." at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php line 47 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Attempted to call an undefined method named \"getDigitalAsset\" of class \"Proxies\\__CG__\\Oro\\Bundle\\AttachmentBundle\\Entity\\File\". at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php:47)"} []
I went to look at the code and I see that in fact there is no method getDigitalAsset in oro/platform/src/Oro/Bundle/DigitalAssetBundle/Provider/FileTitleProvider.php, nor in the proxy... how can this be?
I checked this on my VM (where the problem is not happening) and I see that there's this definition in the proxy class:
/**
* {#inheritDoc}
*/
public function getDigitalAsset()
{
$this->__initializer__ && $this->__initializer__->__invoke($this, 'getDigitalAsset', []);
return parent::getDigitalAsset();
}
But again, I don't see a method called getDigitalAsset in the parent class.
I had some issues when doing the upgrade (I realized my nodejs wasn't upgraded as I thought it was), could that have anything to do with the issue?
Thanks
Edit:
I went through my platform upgrade again and found that there were some problems that prevented it from finishing completely.
This is what I found:
> loading Oro\Bundle\CMSBundle\Migrations\Data\ORM\LoadImageSlider
In LoadImageSlider.php line 117:
Attempted to call an undefined method named "setMainImage" of class "Oro\Bundle\CMSBundle\Entity\ImageSlide".
I commented out the loop inside the load method and re-run the upgrade. Then I got:
> loading Oro\Bundle\CMSBundle\Migrations\Data\ORM\LoadImageSlider
In QueryException.php line 65:
[Semantical Error] line 0, col 117 near 'digitalAsset': Error: Class Oro\Bundle\AttachmentBundle\Entity\File has no association named digitalAsset
In QueryException.php line 43:
SELECT file, digitalAsset, sourceFile FROM Oro\Bundle\AttachmentBundle\Entity\File file INNER JOIN file.digitalAsset digitalAsset INNER JOIN digitalAsset.sourceFile sourceFile WHERE file.parentEntityClass = :parentEntityClass
AND file.parentEntityId = :parentEntityId AND file.parentEntityFieldName =
:parentEntityFieldName
Finally I was able to complete the upgrade by commenting out the whole body of the load method

I had some issues when doing the upgrade (I realized my nodejs wasn't upgraded as I thought it was), could that have anything to do with the issue?
It looks like you have multiple versions of nodejs installed. To make an application use the right one, you can provide the absolute path to the executable with the AssetBundle configuration, like:
# config/config.yml
oro_asset:
nodejs_path: /usr/local/node
npm_path: /usr/local/npm

Related

Migration script fails with IllegalStateException due to SHADOW_TABLE_NAME_SUFFIXES

I've updated the Room version from 2.4.3 to 2.5.0-alpha03 and after the last migration, the JSON generated will once in a while fail with
Caused by: java.lang.IllegalStateException: Cannot parse existing schema file: C:\mypath\com.example.MyDatabase\74.json. If you've modified the file, you might've broken the JSON format, try deleting the file and re-running the compiler.
If you've not modified the file, please file a bug at
https://issuetracker.google.com/issues/new?component=413107&template=1096568
with a sample app to reproduce the issue.
at androidx.room.vo.Database.exportSchema(Database.kt:111)
at androidx.room.DatabaseProcessingStep.process(DatabaseProcessingStep.kt:123)
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:123)
at androidx.room.compiler.processing.javac.JavacBasicAnnotationProcessor.process(JavacBasicAnnotationProcessor.kt:71)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:197)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:985) ... 44 more
After checking out the differences between the last schema file 73.json and the new one, 74.json, apart from the changes I've wanted to make, there's this block:
"SHADOW_TABLE_NAME_SUFFIXES": [
"_content",
"_segdir",
"_segments",
"_stat",
"_docsize"
],
"shadowTableNames$delegate": {
"initializer": {},
"_value": {}
},
inside the only ftsVersion block I have. Whatever I write in the migration script doesn't matter, I always get the same issue. What I've found is that SHADOW_TABLE_NAME_SUFFIXES is a static variable from androidx.room.migration.bundle.FtsEntityBundle & if I delete this block from 74.json, I don't get the issue anymore.
Can anyone help me with more info on this and why it could pop up in the schema file?
I've posted a bug report as per the stack trace's advice and it seems to be an issue from Room 2.5.0-alpha02 and 2.5.0-alpha03, which they will fix https://issuetracker.google.com/issues/246751839

Upgrade to Java 17 throws java.lang.RuntimeException: Error creating extended parser class: Could not determine whether class has already been loaded

I am using jtwig lib and the code was working fine but when we upgraded to Java 17, I am getting the below mention runtime exception.
Below is the method and throws RuntimeException while calling template.render()
String renderDescription(String templatePath,String userId, String caseId) {
JtwigTemplate template =
JtwigTemplate.classpathTemplate(templatePath);
JtwigModel model = JtwigModel.newModel()
.with("userId", userId)
.with("caseId", caseId)
.with("statusPageUrlTemplate",
config.getStatusPageUrlTemplate());
return template.render(model);
}
java.lang.RuntimeException: Error creating extended parser class: Could not determine whether class 'org.jtwig.parser.parboiled.base.BooleanParser$$parboiled' has already been loaded
at org.parboiled.Parboiled.createParser(Parboiled.java:58)
at org.jtwig.parser.parboiled.ParserContext.instance(ParserContext.java:31)
at org.jtwig.parser.parboiled.ParboiledJtwigParser.parse(ParboiledJtwigParser.java:37)
at org.jtwig.parser.cache.InMemoryConcurrentPersistentTemplateCache.get(InMemoryConcurrentPersistentTemplateCache.java:39)
at org.jtwig.parser.CachedJtwigParser.parse(CachedJtwigParser.java:19)
at org.jtwig.JtwigTemplate.render(JtwigTemplate.java:98)
at org.jtwig.JtwigTemplate.render(JtwigTemplate.java:74)
I was facing a similar issue after upgrading JVM version, and I found that adding this environment variable helped:
JDK_JAVA_OPTIONS=--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED
I believe it has something to do with stricter default limits on reflection when trying to inspect built-in classes.

Angular7 + XHook gives ERROR TypeError: Illegal invocation

I have a chrome plugin runnin Xhook which intercepts xhr requests.
This used to work with angular js. Now I am using an Angular 7 application And I am getting an error when I make following request
this.http.get('someurl').subscribe((data: any) => {
});
Which triggers xhr.send(reqBody); in the angular http.js library. The error is on the subscribe part, if I remove this the error is gone.
The error is the following:
core.js:15724 ERROR TypeError: Illegal invocation
at ZoneTask.scheduleTask [as scheduleFn] (zone.js:3238)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (zone.js:410)
at Object.onScheduleTask (zone.js:301)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.scheduleTask (zone.js:404)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleTask (zone.js:238)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.scheduleMacroTask (zone.js:261)
at scheduleMacroTaskWithCurrentZone (zone.js:1245)
at zone.js:3276
at _global.<computed>.proto.<computed> [as send] (zone.js:1569)
at Observable._subscribe (http.js:1726)
I am using this library: https://github.com/jpillora/xhook and the error is caused by line 478 facade.send = function(body) https://github.com/jpillora/xhook/blob/gh-pages/dist/xhook.js
I am thinking that: either angular tries to run the overridden function but something is not accessible because of zone.js, or I am missing certain properties, function in the object that overrides xhr?
If anyone has any information or solution on the subject that would be dearly appreciated.

Changing java heapsizes for a websphere server using websphere and wsadminlib.py

Im trying to call a command from wsadminlib.py to change the initialHeapSize and the maximumHeapSize in a script. But unfortunately my jython (and general scripting knowledge) is still total newbie.
Im using the call
#Change Java Heap Size
setJvmProperty(nodeName,serverName,maximumHeapsize -2048 ,initialHeapSize -2048)
Which should relate to the command in the wsadminlib.py library
def setJvmProperty(nodename,servername,propertyname,value):
"""Set a particular JVM property for the named server
Some useful examples:
'maximumHeapSize': 512 ,
'initialHeapSize':512,
'verboseModeGarbageCollection':"true",
'genericJvmArguments':"-Xgcpolicy:gencon -Xdump:heap:events=user -Xgc:noAdaptiveTenure,tenureAge=8,stdGlobalCompactToSatisfyAllocate -Xconcurrentlevel1 -Xtgc:parallel",
"""
jvm = getServerJvm(nodename,servername)
AdminConfig.modify(jvm, [[propertyname, value]])
But I'm met with this issue when i run the script
WASX7017E: Exception received while running file "/etc/was-scripts/administrateservertest.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "", line 14, in ?
NameError: maximumHeapsize
Any suggestions would be appreciated as I'm tearing my hair out trying to work this out
this was answered by a friend on face book
I think you might need to make two calls, one for each property you
want to set. e.g.
setJvmProperty(nodeName,serverName,'maximumHeapsize',2048)
For others looking for a more specific answer, try this:
AdminConfig.modify(jvmId,[['genericJvmArguments',arguments],["maximumHeapSize", str(1536)]])

Weblogic Exception after deploy: java.rmi.UnexpectedException

Just encountered a similar issue as described in the below article:
Question: Article with similar error description
java.rmi.UnmarshalException: cannot unmarshaling return; nested exception is:
java.rmi.UnexpectedException: Failed to parse descriptor file; nested exception is:
java.rmi.server.ExportException: Failed to export class
I found that the issue described is totally unrelated to any Java update and is rather an issue with the Weblogic bean-cache. It seems to use old compiled versions of classes when updating a deployment. I was hunting a similar issue in a related question (Question: Interface-Implementation-mismatch).
How can I fix this properly to allow proper automatic deployment (with WLST)?
After some feedback from the Oracle community it now works like this:
1) Shutdown the remote Managed Server
2) Delete directory "domains/#MyDomain#/servers/#MyManagedServer#/cache/EJBCompilerCache"
3) Redeploy EAR/application
In WLST (which one would need to automate this) this is quite tricky:
import shutil
servers=cmo.getServers()
domainPath = get('RootDirectory')
for thisServer in servers:
pathToManagedServer = domainPath + "\\servers\\" + thisServer.getName()
print ">Found managed server:" + pathToManagedServer
pathToCacheDir = pathToManagedServer + "\\" + "cache\\EJBCompilerCache"
if(os.path.exists(pathToCacheDir) and os.path.isdir(pathToCacheDir) ):
print ">Found a cache directory that will be deleted:" + pathToCacheDir
# shutil.rmtree(pathToCacheDir)
Note: Be careful when testing this, the path that is returned by "pathToCacheDir" depends on the MBean-context that is currently set. See samples for WLST command "cd()". You should first test the path output with "print domainPath" and later add the "rmtree" python command! (I uncommented the delete command in my sample, so that nobody accidentially deletes an entire domain!)