Jasper Reports "package net.sf.jasperreports.engine does not exist" exception in JDeveloper 11.1 using WebLogic only in EAR Web Page - jar

I'm using JDeveloper 11.1, Oracle 11 and TIBCO JasperReports 6.0.1.
I'm having problems trying to generate Jasper Reports from my web page (ViewController) while using an ApplicationModule (Model - EJB) for doing that. At the end the PDF file has to be sent via email, that's why I let it into the Model project.
If I execute the ApplicationModule, it works fine, no exceptions, the PDF is very well generated and sent.
However, if I execute the client method since a web page I got this exception :
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:4: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.*;
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:5: package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.*;
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:18: cannot find symbol
symbol: class JREvaluator
public class Simple_Blue_1429546047623_56582 extends JREvaluator
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:25: cannot find symbol
symbol : class JRFillParameter
location: class Simple_Blue_1429546047623_56582
private JRFillParameter parameter_REPORT_LOCALE = null;
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:26: cannot find symbol
symbol : class JRFillParameter
location: class Simple_Blue_1429546047623_56582
private JRFillParameter parameter_Description = null;
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:27: cannot find symbol
symbol : class JRFillParameter
location: class Simple_Blue_1429546047623_56582
private JRFillParameter parameter_JASPER_REPORT = null;
^
C:\Users\rodmar\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\DefaultDomain\Simple_Blue_1429546047623_56582.java:28: cannot find symbol
symbol : class JRFillParameter
location: class Simple_Blue_1429546047623_56582
private JRFillParameter parameter_REPORT_VIRTUALIZER = null;
^
I'm just pasting a fragment.
I'm using other .jars as POI, for reading .xlsx files and inserting then into database so I don't know why I can access POI without any problem but at the same time I don't have Jasper Reports available.
I have already searched some solutions in the web but nothing solves my problems. I get some information about jdt-compiler but I don't find it into JasperReports suite. My project is really a mess with all these libraries, maybe I'm missing or adding too many ?
My EAR project at the moment is like this :
The EAR\lib:
This is a kind of a problem for jars settings, or something like that. I had already found this page but it is really strange, I don't think that my issue is something so complicated.
http://docs.oracle.com/cd/E25178_01/fusionapps.1111/e15524/adv_wls_e.htm
EDIT 1 :
I tried to look to my classpath using this code :
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader)cl).getURLs();
for (URL url: urls) {
logger.info(String.format("Classpath: %s.", url.toString()));
}
And I get this output. POI is not here but why, I'm using it without any problems while I'm not been capable of using JasperReports ?
1 ) Is POI.jar by default used in WebLogic 10.3 basic installation ? NO
EDIT 2 :
I've discovered that in WebLogic is necessary to access weblogic.utils.classloaders.GenericClassLoader which sends me all the libraries that belong to this EAR application. Using it, Jasper Reports are available however I don't know what to do to access them successfully...
GenericClassLoader jre = (GenericClassLoader) JREvaluator.class.getClassLoader();
logger.info(String.format("jre: %s, s.", jre, jre.getClassPath()));
Thanks you very much,

Well, as somebody says it was necessary to use jdt-compiler-3.1.1.jar. I added it to /lib folder and now it is working.
It's really strange that this .jar is not in the installation product for TIBCO Jasper Reports 6.0.0 actually I descend until JR 3.7.6 which is the lowest version. The file is from 28/12/2008...
Nice...

I used eclipse ecj-4.3.1.jar and it works.

First checks the dependencies of jasperReports - for example version 6.1.0 - https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/6.1.0
With this you can see if there is any dependency that is missing in your lib directory (webApp) or inside your .jar (if it is a main application of java).
That mistake also happened to me, and I solved it by adding dependence
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.3.1</version>
I hope it supports you

Related

"TS2729 [ERROR]: Property 'boundary' used before its initialization" in extern library

After updating my deno version to 1.9 today I had started having the following problem when running my tests or my scripts:
TS2729 [ERROR]: Property 'boundary' is used before its initialization.
readonly dashBoundary = encoder.encode(`--${this.boundary}`);
~~~~~~~~
at https://deno.land/std#0.63.0/mime/multipart.ts:266:52
'boundary' is declared here.
constructor(reader: Deno.Reader, private boundary: string) {
~~~~~~~~~~~~~~~~~~~~~~~~
at https://deno.land/std#0.63.0/mime/multipart.ts:269:36
I checked and I am not using the mime repository anywhere in my code, instead some other repositories must use it.
I am using the following repositories:
x/abc
std/uuid
std/fs
std/path
std/fmt
std/testing
I made sure that I am explicitely using the newest version for all of the imports of the std library (std version 0.93.0).
When I am running the files that are importing the std library (instead of running the entire application) no errors occur.
Does anyone have an idea how to resolve the error?
It seems like the repository x/abc was the problem.
I did not add a version when importing it implicitly. When importing implicitly it in the following way it worked:
import abc from "https://deno.land/x/abc#v1.3.1/mod.ts";

Why VS2019 marks my extension as deprecated

I don't use VSIX for integration (supports old VS and SSMS). Installer puts all dlls to "program files" and pkgdef and manifest to specific folders. Currently VS2019 shows message that my extension use "deprecated API".
Image with message from learn.microsoft.com but it's the same.
I done this steps:
I created asyncPackage (now empty).
Added with
Microsoft.VisualStudio.Component.CoreEditor to vsixmanifest
Generated catalog.json and manifest.json using code from here
My package looks so (constructor is empty now)
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "7.1.7", IconResourceID = 115)]
[ProvideMenuResource("MyMenus.ctmenu", 1)]
[ProvideAutoLoad(GuidList.ShellInitialized, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string, PackageAutoLoadFlags.BackgroundLoad)]
[System.Runtime.InteropServices.Guid(GuidList.guidMyPkgString)]
public sealed class MyPackage : AsyncPackage {
But VisualStudio shows message about deprecated API again and again. What I missed? What VS checks during package loading?
Edit: I created AsyncPackage, added attributes, updated integration files to VsixV3. Why VS loads extension synchronously?
For whom this can help to resolve the same issue.
As I mentioned above we don't use VSIX. And all files are coping by installer. The issue was that this was missed:
[$RootKey$\Packages\{YOUR PACKAGE GUID}]
#="YOUR PACKAGE NAME"
"AllowsBackgroundLoad"=dword:00000001
I've found it during checking all packages in private registry privateregistry.bin
Also don't forget about UI Context if you are using it:
[$RootKey$\AutoLoadPackages\$UICONTEXT_GUID}]
"$YOUR_PACKAGE_GUID”= dword:00000002
Thanks to MS git

Xamarin.Forms problems with Embedded Resources and Proguard

I have two different applications, both using files that I've included in my Xamarin.Forms project's root. The files are set as Embedded Resources under "Build Action" and then fetched using the code below.
var assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("test.text.json");
This approach works just fine with all compilation options such as AoT and LLVM, except for when Proguard is involved. If the application is compiled using Proguard it will just instantly force close without being able to read the files.
So far I've tried making exceptions for the classes in the project using a custom proguard.cfg-file that is set as my "ProguardConfiguration" in VS 2017.
-dontobfuscate
-keep class com.companyname.test** { *; }
-keeppackagenames com.companyname.test**
This has not yielded any results. The application still crashes instantly. Every other application using Proguard is working just fine as long as it's not loading any files locally. Should I use a different way of loading files or can I exclude anything else in my Proguard configuration to make this work?
EDIT: Just updating this post to draw attention to the solution. It turns out I have solved this problem before but for some reason it seems to be back. Here is the log output:
android.view.InflateException: Binary XML file line #20: Binary XML file
line #20: Error inflating class android.support.v7.widget.FitWindowsFrameLayout
Which is something that I have already added to my general Proguard rules without me having to add a special Proguard configuration to my project. As a solution this time I simply added these two lines to my proguard.cfg file:
-keep public class android.support.v7.widget.** { *; }
-dontwarn android.support.**
Thanks Alen.Toma for pointing me in the right direction.

Oracle weblogic 12c + local EJB lookup

I have a an ear file to be deployed on weblogic 12c.
I have following project structure :
1) prop-application which is an .ear file
2) prop-service which is a .jar file
3) prop-framework which is a .jar file
All are maven project.
- prop-service contains prop-framework as one of its maven dependency.
- prop-application which is an ear contains prop-service
so we can say : prop-application.ear = prop-service.jar + prop-framework.jar
prop-service.jar = more java codes + prop-framework.jar
Now there is a class in prop-framework as :
#Stateless(name = "ServiceCallerBean")
public class ServiceCallerBean implements ServiceCaller
#Local
public interface ServiceCaller
Requirement :
Now i want to lookup(call) this EJB from a from a class in *prop-service* i.e a local look. The point here is to note that prop-service.jar contains prop-framework.jar
Following is the jndi names generated by weblogic 12c server :
java:global/ProposalEngine/prop-service-0.0.1-SNAPSHOT/ServiceCallerBean.>
java:module/ServiceCallerBean.>
java:app/prop-service-0.0.1-SNAPSHOT/ServiceCallerBean.>
java:global/ProposalEngine/prop-service-0.0.1-SNAPSHOT/ServiceCallerBean!com.db.serviceframework.ejb.ServiceCaller.>
java:app/prop-service-0.0.1-SNAPSHOT/ServiceCallerBean!com.db.serviceframework.ejb.ServiceCaller.>
java:module/ServiceCallerBean!com.db.serviceframework.ejb.ServiceCaller.>
I can't use those jndi names which contains jar version(eg 0.0.1-SNAPSHOT) because jar version will keep on changing. But if i use any of the jndi names like java:module/ServiceCallerBean , then there lookup fails with javax.naming.NameNotFoundException: While trying to lookup error
I have tried even :
#EJB
ServiceCaller serviceCaller
in the required class in prop-service but serviceCaller comes out to be null here. Searched on this issue and found that we can use #EJB in only container managed classes, not in simple java class.
I have tried everything but noting seems to be working. So plz help me to solve this issue.
This blog contains a nice explanation of where the JNDI addresses come from. The prop-service-0.0.1-SNAPSHOT entry is taken from the name of the JAR or WAR, so you can use the Maven JAR plugin to change the final name of your JAR you should be able to remove the version number, like this.

Setting Jetty resourcebase to static file embedded in the same jar file

I am trying to access static resource (eg. first.html) packed inside the same .jar file (testJetty.jar), which also has a class which starts the jetty (v.8) server (MainTest.java). I am unable to set the resource base correctly.
The structure of my jar file (testJetty.jar):
testJetty.jar
first.html
MainTest.java
==
Works fine on local machine, but when I wrap it in jar file and then run it, it doesn't work, giving "404: File not found" error.
I tried to set the resourcebase with the following values, all of which failed:
a) Tried setting it to .
resource_handler.setResourceBase("."); // Results in directory containing the jar file, D:\Work\eclipseworkspace\testJettyResult
b) Tried getting it from getResource
ClassLoader loader = this.getClass().getClassLoader();
File indexLoc = new File(loader.getResource("first.html").getFile());
String htmlLoc = indexLoc.getAbsolutePath();
resource_handler.setResourceBase(htmloc); // Results in D:\Work\eclipseworkspace\testJettyResult\file:\D:\Work\eclipseworkspace\testJettyResult\testJetty1.jar!\first.html
c) Tried getting the webdir
String webDir = this.getClass().getProtectionDomain()
.getCodeSource().getLocation().toExternalForm();
resource_handler.setResourceBase(webdir); // Results in D:/Work/eclipseworkspace/testJettyResult/testJetty1.jar
None of these 3 approaches worked.
Any help or alternative would be appreciated
Thanks
abbas
The solutions provided in this thread work but I think some clarity to the solution could be useful.
If you are building a fat jar and use the ProtectionDomain way you may hit some issues because you are loading the whole jar!
class.getProtectionDomain().getCodeSource().getLocation().toExternalForm();
So the better solution is the other provided solution
contextHandler.setResourceBase(
YourClass.class
.getClassLoader()
.getResource("WEB-INF")
.toExternalForm());
The problem here is if you are building a fat jar you are not really dumping your webapp resources into WEB-INF but are probably going into the root of the jar, so a simple workaround is to create a folder XXX and use the second approach as follows:
contextHandler.setResourceBase(
YourClass.class
.getClassLoader()
.getResource("XXX")
.toExternalForm());
Or change your build tool to export the webapp files into that given directory. Maybe Maven does this on a Jar for you but gradle does not.
Not unusually, I found a solution to my problem. The 3rd approach mentioned by Stephen in Embedded Jetty : how to use a .war that is included in the .jar from which Jetty starts? worked!
So, I changed from Resource_handler to WebAppContext, where WebAppContext is pointing to the same jar (testJetty.jar) and it worked!
String webDir = MainTest.class.getProtectionDomain()
.getCodeSource().getLocation().toExternalForm(); ; // Results in D:/Work/eclipseworkspace/testJettyResult/testJetty.jar
WebAppContext webappContext = new WebAppContext(webDir, "/");
It looks like ClassLoader.getResource does not understand an empty string or . or / as an argument. In my jar file I had to move all stuf to WEB-INF(any other wrapping dir will do). So the code looks like
contextHandler.setResourceBase(EmbeddedJetty.class.getClassLoader().getResource("WEB-INF").toExternalForm());
so the context looks like this then:
ContextHandler:744 - Started o.e.j.w.WebAppContext#48b3806{/,jar:file:/Users/xxx/projects/dropbox/ui/target/ui-1.0-SNAPSHOT.jar!/WEB-INF,AVAILABLE}

Resources