How to solve the IIB10 toolkit errors for IIB9 projects - java

I have imported the projects that I'm using in IIB9 without any errors, now I have installed the IIB10 toolkit and I have imported the same IIB9 projects in my IIB10 toolkit. But I found few errors which I'm unable to resolve those, only few projects are getting the error as: "unable to locate a class definition named com.src.helloworld.java in the project or reference project" but I have given the required references to the projects and when Im checking the java compute class I can go into that class code. Please suggest and help me out on this.

I also got this error after upgrading to IIB10.
The reason is exactly what #Alaychem described above - internal differences between "Normal" java projects and javaCompute nodes.
When a Java project is created by adding a JavaCompute node to a MsgFlow, a '.project' file is created with internal definitions of IIB. However, when a Java project is created by making 'new -> Java project' (="normal Java") - also a '.project' file is created, but this time with some less definitions in it.
Therefore, if you created A "normal" Java project, and afterwards connected it to a MsgFlow, after upgrading to IIB10 it might not be recognized anymore, because of these missing definitions in the '.project' file.
A quick way to solve the error in IIB10 without re-defining a JavaCompute node, is to add the missing definitions to the '.project' file of your Java project with the errors.
How? -> Open another Java project that you have, and compare the differences between it's '.project' file, to the '.project' file of the Java project with the errors. Just copy the missing definitions. Afterwards - refresh the Java project (F5) and rebuild the project.
Some pictures to make it clear:
First image - '.project' file of a Java project created by JavaComputeNode. In yellow are the missing definitions. Just copy them.
Second image - '.project' file of a Java project created by a "normal" Java project. Copy to it the lacked 'yellow' definitions from previous picture.

I got this error when mixing JavaCompute classes and "normal" classes.
From My answer at mqseries
"Normal" java projects and javaCompute projects are not the same, for some reason. The src/output libs in. classpath file are not the same, and probably some other differences, that cause the toolkit to treat them differently.
My project was normal java project, that a java compute class added into it later. The v8 toolkit manage with it, but v10 does not.
Moving the javaCompute class to a new javaCompue project (through double clicking new javaCompute Node) did the trick
P.S Adding the normal java files into javaCompue project seems like a bad strategy. It caused some import issues at IBM classes.

Related

Dependencies with Java, gradle, Intellij

I am working on a Java project for a friend's small company who had his only developer quit and is in a bad spot. I am a long term .Net developer, but I can understand the code pretty easily. There is one problem and that is related to library dependencies. There is a data access library that gets called by another "main" app. I made changes to the data access project and now I am trying to use that library in the main project. Problem is, the main program can't resolve the reference to the new version of the library.
If I go into Project Structures, look at libraries, I see the old version of the library jar is pointing to c:/users/me/.gradle/caches/modules/files/dataaccessstuff.jar. I also went into the main project, looked at the build.gradle file and changed the version of the data access to match the version that I created and I keep getting errors that the version I am referencing can not be found.
I don't see how to publish the data access jar to a location that the main project can reference.
I tried to just build the data access layer and then find the jar that was generated and then add that path to Project Structures. I was hoping that this would be the same as in .Net where you can directly reference a dll, but the main project still is not able to resolve that reference.

Java intellisense not working when imported projects not available

I'm reviewing an isolated Java project in VSCode. By that I mean that I have the project itself, but not any of the projects that it depends on. From what I can tell, the result is that Intellisense has been turned off for the project, which makes navigating around the code a pain.
For example, you can see below that VSCode can't find the definition of a method, even though it's just 3 lines down. On the side, you can see the errors it's encountered trying to load various artifacts.
Is there a way to turn Intellisense back on, at least for the objects that are defined within the project itself? I have the MS Java extension pack installed.
To clarify, these are internal projects that it depends on and I don't have on my machine.
I just noticed there's a feature that might help you get around this. Check out "Lightweight Mode" here: https://code.visualstudio.com/docs/java/java-project
Maybe this will get away from having access to mvn full resources and just get the quick-n-dirty navigation as the docs seem to indicate!
Lightweight Mode
VS Code for Java supports two modes, lightweight and standard. With
lightweight mode, only source files and JDK are resolved by the
language server; with standard mode, imported dependencies are
resolved and the project is built by the language server.
...works best when you need a super quick-to-start and lightweight
environment to work with your source files, for example, reading
source code, navigating among source code and JDK, viewing outline and
Javadoc, and detecting and fixing syntax errors. Also, code completion
is supported within the scope of source files and JDK... Lightweight mode doesn't resolve imported dependencies nor build the project.
Your project throwed project build error: Non resolved parent pom for com.....
When errors are resolved, the intellisense should work as normal.
Please have a look at this question. Try and see if error goes away.
Project build error: Non-resolvable parent POM.

Eclipse editor/build losing access to imported javax classes

I fixed my problem but I don't know how/why this fixed it so I am looking for an explanation.
I opened my project yesterday and I could no longer build due to the fact that the java and jsp imports could no longer see javax.* classes. I had another project that worked fine but could find no differences in their build paths.
After reading several threads on build path, etc. and not finding any problems in the configuration file I simply retyped the import in one of the source files, eclipse was able to lookup class tree as I typed in the editor, and once one of the imports was retyped the project would now build.
I would like to understand what in the Eclipse project configuration was hit and why this happened and how this method I used actually resolved the problem.

referencing (pure java) project in Android project (Could not find class)

I am trying to reference a pure java-Project in my Android-Project -> The Java-Project has a whole bunch of classes I need to use. Oh, and as the first response pointed out: I am using eclipse, yes :)
Only Problem is: I Always get Could not find class 'XXX', referenced from method com.example.helloworld.MainActivity.onCreate. I seem to have missed SOME step or error...?
What I already did:
The Project is added as Project into the Java Build Path (logically nessecary)
It is marked in "Order and Export" in the Java Build Path and pushed to the top (this solved the problem for someone else here when dealing with Jar-files)
Ir is marked in "Project References" on Project settings.
I added the folder where the relevant class is under "Libraries" in build Path... I am not sure if that should be nessecary.
The Java-Project I reference has a whole load of Jars, but if that is the reason, should I not get a different errormessage?
I had the same issue and after some hours of frustration and search I have finally found the answer here:
Android, class not found from imported jar file
Basically, the issue was that the referenced pure-java project or the generated jar was built with Java 1.7, and Android projects are set to use 1.6.
Two ways to do this.
Jar that java project and copy the jar to the libs folder of your Android project.
Add the project as a dependent project to your Android project
Both work wonderfully.
But mind you, this pure-java project must add android.jar and not things like rt.jar :). Else you will get Dalvik exceptions.
Edit :
Dont forget to refresh and Project - Clean your android project.
Two things to check (you mentioned you are using Eclipse):
If your android project needs to use the pure-java project's JARs, check that those JARs are being exported in the build path options of the pure-java project. This is in the build path of the pure-java project you are trying to include, not the build path of the android project that is trying to include it. Under "Order and Export" tab for the pure-java project, note the comment "Exported entries are contributed to dependent projects". In this case, your android project is the dependent project and your pure-java project needs to do the contributing.
Make sure the pure-java project is actually opened in the IDE in addition to your android project. Probably trivial but sometimes overlooked.
If answer does not suffice, you may wish to mention if the missing classes are in .java source files, or if they are only found in JARs in the build path of the pure-java project
Edit: To further track down the issue, please confirm the following to make sure I understood your question:
The pure-java project does successfully build in the IDE
The 'class not found' error is one you are getting when you try and -build- your android project and not when you try and -run- it.
CLASSPATH (aka build path) can be nasty to untangle. If including the project is not working (assuming it does build), you could try building a JAR of your pure-java project and copying (and including) that and all the other JARs into your android project.
The android SDK does certainly complicate the build environment. One way to find out whether the problem is (A) your android project setup) OR (B) the way the pure-java project is packaged) is to create a different pure java project and try including the first one, preferably using the -exact- same line of code that gives you the build error in the android project, if possible.

Strange problem with imports in Java Application

I'm building a plugin to extend the Eclipse BPEL Designer. That plugin is supposed to allow users to add meta information to certain model elements via EAnnotations. I already did the same thing for a BPMN model and it work just finde but when doing this for the BPEL designer I reveive rather strange exceptions.
The first I thing realized when trying to extend the BPEL Designer was that the designers plugins are defined in an unusual package structure. Instead of org.eclipse.bpel.xxx they have a "bin" in front of all package names. When I'm trying to import some of the designers classes I therefore have to refernce the bin path to make it work. However all the examples I was able to find just imported classes from the ordinary package structure.
Most of the time importing classes with the bin in front of the package name worked fine for me but every now and then I receive a strange error message. The message is in the form of: The type org.eclipse.bpel.xxx cannot be resolved. It is indirectly referenced from required .class files
It seems that Eclipse somehow can't find certain classes. I'm stuck at this point for over a week now and don't find any solution. From my point of view the problem has to be seen in the BPEL Designer plugins. Inside those plugins they reference classes in the form of org.eclipse.bpel.xxx but as I said when I reference those plugins their classes are inside packages with a "bin" in front of the normal package name. Could that be an explanation why certain classes can't be referenced by Eclipse and I get those strange error messages?
I'd appreciate any new ideas about that problem and hope that somwebody can give me an advice to solve that problem.
Cheers
Stefan
I already encountered in the past such troubles ...
I think there is a problem with the export/import of the BPEL Designer plugin.
How did you get this plugin ? Are you working with binary plugin or plugin imported as source in your SDk ?
Try to get again this plugin, may be an other version, or from an other source .. an update site.
I really think these "bin" packages/folders should not be here
Hope this can help ...

Categories

Resources