Upgrading from core 1.0 to 2.2 - oracle

I'm trying to upgrade a huge project from core 1.0 to 2.2. I decided to do this through creating new project from scratch and just moving there all files from existing project. I did that, fixed all errors related to usage of inappropriate packages, old syntax etc.
Now I get the login page when running project, but after actually logging in i get TypeLoadException.
"TypeLoadException: Could not load type 'System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider' from assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

Related

How to update the quarkus version used

What is the recommended way of upgrading the quarkus version used in an existing application?
I have taken a look at my pom.xml, since the quarkus extensions dont specify the version used, I assume that they will get updated based on the main quarkus version.
The properties which look to be relevant in the update are quarkus-plugin.version, quarkus.platform.group-id and surefire-plugin.version.
How can I decide which ones to change, and is there anything else to be aware of?
There is one important thing to know, we have:
Quarkus Core: this is the main Quarkus artifacts + all the core extensions: the quarkus-bom is the one of Core. The Quarkus Maven plugin is part of it too.
Quarkus Platform: it contains more extensions such as Camel Quarkus: the quarkus-universe-bom is the one from the Platform, it contains the Core + the additional extensions
We usually release Quarkus core then Quarkus Platform with a few days between the two as we often need a release of Camel Quarkus, which is an Apache project and organizes a 72 hours vote for each release.
In a newly created project, you have the following properties:
<quarkus-plugin.version>1.1.1.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.1.1.Final</quarkus.platform.version>
quarkus-plugin.version is the version of the Quarkus Maven plugin, it should be in line with the version of the core you use
quarkus.platform.artifact-id can right now either be quarkus-universe-bom for the whole Platform or just quarkus-bom for the Core only.
quarkus.platform.version is the version of the BOM.
Usually all these versions should be aligned. But... it could happen that we would need some quick update in the Platform and not of the core and we could then only release a new version of the platform. This hasn't happened yet to be honest.
Let's take an example of what happened today: I released Quarkus Core 1.2.0.Final but we are still waiting for Camel Quarkus to be released to release the Platform.
If you want to update early, you can change the BOM to use the quarkus-bom and update everything to 1.2.0.Final.
Or you can wait for the Platform to be released early next week and stay on the Platform quarkus-universe-bom.
We also only update the website documentation and code.quarkus.io when the full Platform is released.
It used to work to simply issue the command
mvn io.quarkus:quarkus-maven-plugin:1.4.2.Final:create
in the base project directory for it to automatically update the Quarkus versions in the project pom.xml file, but since 1.6.0.Final it errors:
project XXXXX: Unable to generate the project in a directory that already contains a pom.xml -> [Help 1]
I will create an improvement suggestion ticket at Quarkus to restore this functionality, maybe with a dedicated maven goal (like update)

How to make antlr 4 runtime as an osgibundle?

I have created a eclipse plugin and converted it to maven,which needs the dependency of antlr but when the plugin execute it says it cant find the required package. Then i came to know anltr is not osgi bundle. any one please tell me how to convert the antlr jar file into an osgi bundle.? The antlr dependency must support my mvenized eclipse plugin
The main ANTLR 4 project doesn't support this (see issue #689). However, I've recently created an independent fork of the project which aims to target a number of issues related to the use of ANTLR 4 in large(r)-scale and/or performance-critical applications. One of the items I'd like to implement is using OSGi for improved runtime versioning instead of the manual mechanism currently in place. I recommend filing an issue with this fork of the project so I can include these changes as part of my initial release.
https://github.com/tunnelvisionlabs/antlr4/issues

I am getting java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContext

I have added spring-web.4.0.jar in classpath. It contains the class - org.springframework.web.context.WebApplicationContext. but when I try to run it in eclipse it shows me an error : org/springframework/web/context/WebApplicationContext.
How to resolve this error?
Choosing "Clean..." from the server contextual menu helped me get rid of this problem.
Try clean and rebuild your eclipse project, because sometimes eclipse gets out of date.
Alternatively, if this doesn't help, you need to verify that the runtime path indeed points to the correct jar, and that the jar does indeed contain the WebApplicationContext.class and is readable.
To see the runtime path, use the debug view (Window - Views- Debug), right click to view properties.
Find the jar and open it with a normal zip viewer to see if the file reads correctly.
The root cause of this problem can be almost literally anything, but here are a few weird things to check:
Maven dependencies with test or provided scope that should be normal scope
Spring XML files have schema versions that don't match framework version (3.0 or 4.0)
Spring XML references "https://" instead of "http://" or vice-versa (depends on version)
web.xml file containing ${} references not compatible with chosen web server
Conflicting version of very core libraries such as Jackson, Servlet API, spring-*
Misconfigured or missing or incompatible loggers: slf4j, log4j, jcl
Mixing of old and new: jdk version, spring version, dependency versions, IDE, server
Maven dependencies not showing up in Deployment Assembly (this one went away with upgrades)
Stale or locked jarfiles... may require a reboot, tomcat "Clean..." not enough
Missing required -D or environment variables
My application ended up with several of these all wrong one after another.
The exception is misleading. Setting a debugger breakpoint on the exception sometimes helps.

NetBeans 7.3 maven project "No web folder found"

I am running the latest version of NetBeans (7.3) with GlassFish and I have created a maven web project that adds the necessary JSF 2.1 dependency. I am able to deploy the project and access the home page. The problem is that when I try to use the "JSF pages from Entities" wizard, I get the following error "No web folder found". If I try to add the JSF 2.1 framework support thru "Project/Properties/Framework" I get the same error.
I assume that NetBeans does not know that a "web folder" already exists but at a different location "project/src/main/webapp" (maven) instead of "project/web" as it normally expects if the project is a non-maven project. Does anybody know if there is a setting I can change, to let NetBeans know that the web folder is located under "project/src/main/webapp" instead of "project/web"?
I tried to get support thru the NetBeans forum/mailing-list but nobody responded.
I had the same problem when I tried to import an eclipse project.
After editing the "nbproject/project.properties" manually, changing the build.web.dir property to the right directory (WebContent instead of web) it seemed to work.

Adding Unit Test Project to ASP.Net MVC 4 Project

Just like this guy, I didn't create a unit test project for my MVC 4 project when it was first created. Now I want to go back and add one.
To that end, I created a new Unit Test Project.
Now, I right-click on a private method in one of my controllers, select Create Unit Tests, and get a popup dialog asserting:
Unit Test Generation Error: The following error was encountered while reading module
'My.Project': Could not resolve the type reference: [System.Web.Mvc, Version 3.0.0.0,
Culture=neutral, PublicKeyToken={why doesn't MS support cut and
paste??}]System.Web.Mvc.AllowAnonymousAttribute.
AllowAnonymousAttribute is new to MVC 4. Why is the Unit Test Generator trying to resolve against the MVC 3 assembly though?
My.Project compiles and runs just fine, AllowAnonymousAttribute and all, and clearly is reverencing System.Web.Mvc, Version 4.0.0.0.
UPDATE
MyMvc.csproj contains
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
The DLL at HintPath is confirmed to be version 4.0.0.0
MyMvc.Test.csproj contains
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
This is no longer an issue in VS2012.
VS2012 no longer supports the add unit test wizard. Manually added unit tests work fine.
Download Resharper (there's a free 30 day trail) and press alt+enter. It will automatically add what is needed.

Resources