I've installed and tested ASM on my localhost successfully (we use Hybris 1811). Then I wanted to transfer it on our dev server (actually it was only changes in localextensions.xml and regenerated extensionsinfo.xml), so in extensionsinfo.xml of my storefront there is the addon registrated like this:
<requires-extension name="assistedservicestorefront "/>
But it doesn't generate files in views:
[DefaultCMSComponentRendererRegistry] Error processing component tag. currentComponent [AssistedServiceComponentModel (8796814312508#2)] exception:
File [/WEB-INF/views/responsive/cms/assistedservicecomponent.jsp] not found
I've imported the same .impex file as in the manual for installing ASM (from help.hybris.com) and as on the localhost (cms-content.impex to include component and Jsp).
Even though I run update in HAC, I tried to sync content catalog. I checked extensions in HAC, it contains same ASM extensions as on my local machine: assistedservicefacades, assistedserviceservices, assistedservicestorefront.
When I checked the backoffice, the component with that ID is really there and it's in online catalog.
How do I make those files to generate? Or should I somehow override them with my custom views? But I think it would be bad approach.
UPDATE: I also tried to add this entry to project.properties of my storefront:
sikob2cstorefront.additionalWebSpringConfigs.assistedservicestorefront=classpath\:/assistedservicestorefront/web/spring/assistedservicestorefront-web-spring.xml
but then I got the error loading beans:
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultStorefrontTenantDefaultFilterChainList': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AssistedservicestorefrontFilterListMergeDirective' defined in class path resource [assistedservicestorefront/web/spring/assistedservicestorefront-web-spring.xml]: Cannot resolve reference to bean 'assistedServiceFilter' while setting add; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assistedServiceFilter' defined in class path resource [assistedservicestorefront/web/spring/assistedservicestorefront-web-spring.xml]: Cannot resolve reference to bean 'assistedServicePathRestrictionEvaluator' while setting bean property 'assistedServicePathRestrictionEvaluator'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'assistedServicePathRestrictionEvaluator' available
# Install assistedservicestorefront
# Replace Mystorefront with your storefront extension name
ant addoninstall -Daddonnames="assistedservicestorefront" -DaddonStorefront.yacceleratorstorefront="Mystorefront"
I think you have missed installing the assistedservicestorefront addon or if you've already installed then check whether below changes have taken place on your server.
addoninstall command makes below changes
Adds assistedservicestorefront into extensioninfo.xml of your storefront extension
like
<requires-extension name="assistedservicestorefront "/>
Generate a new project.properties file from project.properties.template inside assistedservicestorefront, which has following entries.
Replace yacceleratorstorefront with your storefront extension name in the below property.
#Specifies the location of the spring context file added automatically to the global platform application context.
assistedservicestorefront.application-context=assistedservicestorefront-spring.xml
yacceleratorstorefront.additionalWebSpringConfigs.assistedservicestorefront=classpath:/assistedservicestorefront/web/spring/assistedservicestorefront-web-spring.xml
assistedservicestorefront.javascript.paths.mobile=/responsive/common/js/assistedservicestorefront.js;/responsive/common/js/jquery.tablesorter.pager.js;/responsive/common/js/jquery.tablesorter.min.js;/responsive/common/js/Chart.min.js;/responsive/common/js/asm.storefinder.js
assistedservicestorefront.javascript.paths.responsive=/responsive/common/js/assistedservicestorefront.js;/responsive/common/js/jquery.tablesorter.pager.js;/responsive/common/js/jquery.tablesorter.min.js;/responsive/common/js/Chart.min.js;/responsive/common/js/asm.storefinder.js
assistedservicestorefront.css.paths.mobile=/responsive/common/css/assistedservicestorefront.css;/responsive/common/css/storeFinder.css;/responsive/common/css/customer360.css
assistedservicestorefront.css.paths.responsive=/responsive/common/css/assistedservicestorefront.css;/responsive/common/css/storeFinder.css;/responsive/common/css/customer360.css
assistedservicestorefront.redirect.customer_and_cart=/cart
assistedservicestorefront.redirect.customer_only=/my-account
assistedservicestorefront.redirect.error=/
assistedservicestorefront.redirect.order=/my-account/order/%s
assistedservicestorefront.deeplink.link=/assisted-service/emulate
cscokpit.assistedservice.deeplink=true
assistedservicestorefront.profile.cookie.name=profile.tracking.pause
#AIF AJAX call timeout in milliseconds
assistedservicestorefront.aif.timeout=7000
So if you don't want to run addoninstall command in each environment then you can manually do these two changes. You can refer to the generated project.properties file inside your addon and copy all those properties to your storefront's project.properties or local.properteis file and commit the changes.
Related
Sometimes I get a BeanCreationException when starting a Java Spring Boot single-JAR application built by Gradle. My investigations show that it depends on the JAR file and how it has been built by Gradle. Most often (but not always) I see the exception when I build the project on a Linux system. But I have never reproduced the issue with a JAR built on Windows or when running from IntelliJ Idea.
I tried to compare the content of a working JAR with the JAR throwing the exception - all the *.class files (including meta and resources) were binary equal, the only difference was in the order the files were stored in the JAR/ZIP archive. I also tried to unpack the failing JAR on Windows and just repack it into a new JAR file (using 7-zip) - the application started without any exceptions. This weird workaround solved the issue, but it's not something I'd like to do after each build on a linux machine.
The exception suggests to check circular references, so I tried replacing #Autowired properties with #Autowired bean constructors to help me to find the problem but that didn't help. The stacktrace does not mention any of my classes, so I don't know what bean could be responsible for the issue. And because of the fact the issue happens only sometimes and is solvable by repacking the JAR file, I'm not sure there are any circular references anyway.
Could you please help me? Any advice or suggestion is welcomed.
JDK: openjdk 8u262
Gradle version 5.6
Spring boot 2.3.1
Exception message:
BeanCreationException: Error creating bean with name 'webConfig':
Invocation of init method failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource
[org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]:
Unsatisfied dependency expressed through method 'requestMappingHandlerAdapter' parameter 0;
nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException:
Error creating bean with name 'mvcContentNegotiationManager':
Requested bean is currently in creation: Is there an unresolvable circular reference?
By default, Spring manages itself bean's lifecycle and then, arranges their initialization order during the startup.
Here a full example of usage #DependsOn annotation to order the bean instanciation.
You can also found more detail in the official Spring documentation
Our application should use a .properties file which is created in deploy time on the host filesystem, thus it is not being bundled with the application .war in build time. It is opened and read by a loader class during the Spring application context creation
<bean id="propertiesLoader" class="com....PropertiesLoader">
<property name="propertiesFileLocation" value="${PROPERTIES_FILE_LOCATION}"/>
...
where the file path value of PROPERTIES_FILE_LOCATION is defined in theapplication.properties file in src\main\resources of the application's -web maven module
PROPERTIES_FILE_LOCATION=/home/.../propertyfilename.properties
and the type of the propertiesFileLocation field is String and it is being accessed via new FileInputStream(propertiesFileLocation) in PropertiesLoader.java class
With this setup the application context creation is successful. However, we also have some integration tests in our project which also setup a Spring context for their execution. We though to store a copy of propertyfilename.properties file into src\test\resources of the -it maven module and refer it from its it.properties like
PROPERTIES_FILE_LOCATION=classpath:somedirectory/propertyfilename.properties
however during the creation of the integration test context we receive the following exception
[ERROR] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'propertiesLoader' defined in URL
[ERROR] Caused by: java.io.FileNotFoundException: classpath:somedirectory\propertyfilename.properties
(The filename, directory name, or volume label syntax is incorrect)
Now if we modify the type of the propertiesFileLocation field to org.springframework.core.io.Resource and we access it via propertiesFileLocation.getInputStream() in PropertiesLoader.java, that makes the integration tests context creation succesful, but at the same the real application context creation fails with
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertiesLoader' defined in URL
[file:/.../tomcat/work/Catalina/localhost/_/loader/conf/spring/springmvc/springmvc-util.xml]: Invocation of init method failed;
nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/home/.../propertyfilename.properties]
This seems to be a "deadlock" situation, as either the application or the integration test context creation fails. Is there a way with which both context can be succesfully created?
Resource loading is quite well documenten in the Spring References Guide. When you don’t prefix the resources with the location to load it from it will default to the default location of the ApplicationContext. For the web application that will be the root of the archive, basically what is in the WEB-INF directory. \
You want to load a file resource for this prefix the resource with file: and in your test use classpath: to have it loaded from the `classpath. This way it will work regardless of which default location the application context uses.
I am trying to initialize and build a Springboot Application that uses AWS dependencies on Net Beans, however, I am having a problem building the project. After resolving the errors after creating the project I am getting an error when I try to build. The message I get is
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cloud.aws.context.support.io.ResourceLoaderBeanPostProcessor#0': Cannot resolve reference to bean 'amazonS3' while setting constructor argument;
I found some previous answers saying to put cloud.aws.stack.auto=false in my application.properties file, however, I seem to be getting the same problem after I clean and build again.
If you are building/ testing or running locally (as opposed to EC2) then you need to have a region property such as in application.properties assuming you use the default profile for build and test.
cloud.aws.region.static=us-east-1
Newbie question: I have different projects that im doing in STS, all opened. For example i have myproject_mvc and myproject_datamodel.
In myproject_mvc are the views and controllers.
In myproject_datamodel are the class of the Model like: Person, Car, etc.
the project_datamodel is used in other projects too. So i want to add a reference and use it like if that class where in myproject_mvc.
I added doing right click over myproject_mvc Build Path/Configure Build Path/Projects and i added the porject there, but when i run the application i recieve this error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: solvian_datamodel/Vehicle
Maybe i have to register that dependency in pom.xml or other file that i dont know.
You need to configure Web Deployment Assembly in STS.
Try following:
Go to myproject_mvc's properties -> Deployment Assembly.
Click Add button.
Add dependency projects.
Hope this helps.
I'm trying to use Hibernate with Spring in Eclipse. I get the following error when I try to run the welcome file on the server:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.lang.Class[]' for property 'annotatedClasses';
nested exception is java.lang.IllegalArgumentException: Cannot find class [com.vaannila.domain.User]
The class com.vaannila.domain.User is in the Java Resources:src folder of the project in eclipse. Why isn't it being located?
From time to time Eclipse is a bit picky about deploying a project correctly. It seems that it has to do with the installed plugins. When this happens to me in the 'Servers'-view of the 'Debug'-Perspective i click the 'add and remove' menu and remove my project from deployment - save it - add it again and redeploy. Usually this does the trick.
Another try is to start Eclipse with the -clean option.