Namespace exists but not found and absent in Object Browser - reference

I am trying to use Archetype model namespace (Archetype.Models) in my code behind. The ddl exists in bin and my views see the namespace.
using Archetype.Models;
However when I want to use it in a controller it gives an error saying the namespace couldn't be found.
I can see it is not listed in my project Object Browser - may this be related? If so how to fix it?
Thanks

I checked references and actually had to add the reference to dll
My controller then started to see the archetype model

Related

JHipster - entity generation - dynamic filtering for the entities

I have created a new jhipster project v4.13.3.
When creating a entity e.g.:
jhipster entity Employee
And selecting Dynamic filtering for the entities with JPA Static metamodel
An EmployeeQueryService class is subsequently created.
When looking in this class at the createSpecfication method, there are entries like this:
(buildStringSpecification(criteria.getFirstName(), Employee_.firstName));
Employee_ as far as I can tell is not defined anywhere and Intellij reports "cannot resolve symbol".
Running mvn, no errors are reported and the app runs fine.
Am I missing something?
Thanks
As documented, JPA static metamodel is generated by an annotation processor at build time. Maven knows about it, your IDE doesn't.

MVC Ninject: How to add NinJect bindings from an MVC Area project

I've been using this blog example:
http://blog.longle.net/2012/03/29/building-a-composite-mvc3-application-with-pluggable-areas/
I have the concepts working in my solution. However, I'm trying to figure out a good way only add bindings to the kernel if a user has permissions to access a module/area.
I've read up some on the ServiceLocator but I was trying to stay away from it.
One thing I'm trying just to get things to work is user Contructor injection in the default constructor for a module. It's working but is a hack.
The pattern I'm using, each module project you create an class that inherits from AreaRegistion. When each module project builds, relevant files are copied to the Areas folder of the main web project. Then when the main project loads, reflection is used to load all module assemblies. Then when AreaRegistration.RegisterAllAreas() is called, it detects and loads all the modules with a class that inherits AreaRegistration.
I'd like to figure out an good way to access the Ninject kernel and add bindings in the module class that inherits from AreaRegistration. I would imagine initiating code to add bindings from the RegisterArea() override.
I'm looking for any suggestions on how to do this without resorting to the ServiceLocator.
Any ideas would be greatly appreciated.
For now I've found a better solution and that's to use NinjectModule. In the Plugin class, I'm going to create a class which inherits from NinjectModule. Then setup the pluging bindings in the Load overload.
Then use Kernel.Load in my main app bootstrapper to initialize the Load overloads in all plugin classes which inherit from NinjectModule.

XPages - Can't instantiate class: 'Cannot find class <<classname>> in NSF'

I have an XPages application that has been running quite happily for the last couple of years.
The application uses some Java classes as converters that are used to convert data entry on certain fields to upper case, proper case, etc. This functionality has been present and working since the app was first deployed.
Today I was asked to make a change to one of the pages, adding a new field. The change was made in a test copy of the database, the app rebuilt and tested and all was fine.
The same change was then promoted into the live database, but after being rebuilt the error
Can't instantiate class: 'Cannot find class uk.co.xxx.beans.UpperCase in NSF'.
is being returned.
I have tried rebuilding the app and cleaning the project numerous times without success. I have also tried amending the code in the Java class and rebuilding.
If I remove all references to the UpperCase class it then complains about the ProperCase class. It appears as if the app has lost its reference to the Java classes and rebuilding isn't fixing the problem.
As an interim solution I have removed all uses of these classes so that users can at least display the page - but this is obviously not a long term solution. As soon as I reinstate one instance and rebuild, the error returns.
The only change in the app has been the addition of the new field. Removing it makes no difference.
Can you suggest anything else I can try and what may be causing the problem?
Open production db in designer and using Navigator view open WebContent/WEB-INF and delete classes folder. Then rebuild the app or refresh it from template again.
Sometimes classes are not updated correctly. I've seen it few times.
I have seen this too (domino 8.5.3). I recompile until it eventually works. With a restart of the http task thrown in for good measure. How are you deploying the classes within the db or as jar files in lib/ext?
I ran into similar issues with 8.53 FP2 with the same "can't instantiate errors" if accessed by a designer client. I even put a PRD in at IBM for it.
In order to fix this problem we had to update to the server and clients to FP5. We had a work around before we could update the FP5. We had to modify how the application was rolled out. Once the database was updated from a template we had to do a clean then a build while use our Application ID used for signing applications.
http://www-01.ibm.com/support/docview.wss?uid=swg21639571
JDAE8ZV2CX
XPage With Java Design Element Breaks When Domino Designer opens after applying 8.5.3 Fix Pack 2 interim fix of any 853 Fix Pack 2/Fix Pack 3 hotfix

Robolectric uses incorrect resource id from library when inflating view

This is not exactly a question as I found the solution for the problem. Just hope it will help others who can encounter it.
We use Robolectric to write unit tests for a project which uses a library (actually several libraries). The libraries as well as application uses a lot of resources.
Lets suppose that Eclipse workspace contain project Library (with "library.package" as top package) which creates an Android library and project Application (with "app.package" at the top) which uses Library. the project Test is Robolectric project which refers to the Application project.
All of a sudden we found that very simple test which checks for existence of a particular view in the activity fails. For example:
#Test
public void testProgressBarInit() {
LoginActivity activity = Robolectric.buildActivity(LoginActivity.class).create().get();
assertTrue(activity.findViewById(R.id.status_text) instanceof TextView);
}
The library project implements the LoginActivity and defines an appropriate resources (layout). Failing tests run perfectly before we changed our code structure a little bit eliminating one more library.
Running the test under debugger showed that findViewById call uses correct value of the R.id.status_text taken from Application/gen/R.java file. At the same time, we discovered that the value of R.id.status text in the Application/gen/R.java differs from the value in Library/gen/R.java. Also, the Appication/gen directory contains file library.package.R.java which contains the same value for status_text as in the Application/gen/R.java (which differs from original one in the Library/gen/R.java). It is normal behavior of aapt tool which can change resource ids while merging resources from the library and the application.
After some investigations we found the following:
Robolectric loads resource IDs which was defined in the library twice: once using R.class from application project and another using R.class from the Library project
which class is loaded depends on the class path configuration
to run tests we need to export the Library project from the Application project
if Library project is exported before Application/gen folder in the class path configuration, Robolectric replaces resource ids by those found in the Library/bin/classes/library/package/R.class
if Library project is exported after Application/gen folder, Robolectric uses correct resources found in the Application/bin/library/package/R.class.
It is certainly a bug in the Robolectric implementation as it should not load resource ids from R.class associated with library package. All ids are propagated to the Application/gen/R.java (see discussion here on GitHub).
If you encounter this or similar problem with resource usage while using Robolectric, make sure that you export library project after Application/gen folder in the Build Path-Order and Export configuration.

How does Orchard resolve references in modules?

The documentation (here and here) is notably lacking information on how references in modules are resolved:
References Resolution
(TODO: Explain how Orchard figures out references by looking at the "References" section of the csproj file as well as looking at additional assembly binaries dropped in each module "bin" directory)
Unfortunately, this is exactly the information that I need. I have created a custom module that has a reference to a custom-built, in-house DLL. When I try to use a class from this DLL, I get the following Exception:
Could not load type 'Custom.MyClass' from assembly 'Custom, Version=[version], Culture=[culture], PublicKeyToken=[token]'.
So, my question is thus: What does Orchard do with module references, and is there anything special I need to do to have Orchard pick up my module's references?
EDIT: Looks like some better information can be found in this blog post and its comments. However, my custom assembly already exists in src\Orchard.Web\App_Data\Dependencies, and I'm still getting the error.
EDIT2: We have a copy of the custom DLL in the lib folder, so I tried referencing that one instead (as we have another module that does so successfully), but still no change.
EDIT3:: In reference to the previous two edits, it's not copying from the lib folder to the App_Data\Dependencies folder. I just added a new DLL to the lib folder and referenced it, and it didn't appear in the Dependencies folder. I think the current Custom.dll isn't replacing the one that's there, which is why I'm getting the error I am. But why isn't Orchard copying into the Dependencies folder?
In order to have Orchard to use your custom module you need to have it on path: your_web_application_path/Modules/your_custom_module, we are using sym links to achieve that.
Then your main module (web application) should see your custom module. If you are adding new module to existing orchard app, you probably need to enable it by hand from admin panel/modules menu. For new installations you could add feature enable directive to your recipe and add dependency to main module.txt file (assuming you want your module always on).
Another trouble shooting tips:
make sure your module build path is set to bin/ folder (not some bin/debug etc.)
make sure your module is really an orchard module (have module.txt file) and is seen in admin panel/modules
make sure it is enabled, new modules are by default disabled
make sure referenced libraries are referenced from static folder I mean not from someting like bin which is clean up during rebuild

Resources