ionic 3 build VirtualStats stopped - ionic-framework

Yesterday my app was working fine on browser but now I get an error:
[21:01:05] transpile started ...
[21:01:11] typescript: .../feederhorgasz/node_modules/#ionic/app-scripts/dist/util/virtual-file-utils.d.ts, line: 3
Class 'VirtualStats' incorrectly implements interface 'Stats'. Property 'atimeMs' is missing in type
'VirtualStats'.
L2: export declare class VirtualStats implements Stats {
L3: protected _path: string;
L4: protected _ctime: Date;
Error: Failed to transpile program
at BuildError.Error (native)
at new BuildError (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\util\errors.js:16:28)
at C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:159:20
at transpileWorker (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:107:12)
at Object.transpile (C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\transpile.js:64:12)
at C:\Users\Thomas\mobiledevelopment\feederhorgasz\node_modules\#ionic\app-scripts\dist\build.js:106:82

Put this code on Your project folder\node_modules#ionic\app-scripts\dist\util\virtual-file-utils.d.ts
readonly atimeMs: any;
readonly mtimeMs: any;
readonly ctimeMs: any;
readonly birthtimeMs: any;

Related

Why can't java find twilio?

I am using Eclipse with Gradle. Twilio is listed as dependency. All versions are up to date. Code referencing Gradle will not compile and returns error messages that the Twilio classes do not exist. Code online is frustratingly outdated. I'm hoping someone here can help.
The Code I am running is very basic:
package SendAndReceiveSms;
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
public class SmsSender {
public static final String ACCOUNT_SID = "**Redacted**";
public static final String AUTH_TOKEN = "**Redacted**";
public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
Message message = Message.creator(
new PhoneNumber("**redacted**"),
new PhoneNumber("**redacted**"),
"Message testing.")
.create();
System.out.println(message.getSid());
//sendMessage("**redacted**");
}
public void sendMessage(String numToSend) {
String n = numToSend;
Message message = Message.creator(
new PhoneNumber(n),
new PhoneNumber("+**(redacted)**"),
"Message testing.")
.create();
System.out.println(message.getSid());
}
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:28.2-jre'
//compile group: "com.twilio.sdk", name: "twilio", version: "7.45.+"
//compile group: "com.sparkjava", name: "spark-core", version: "2.7.1"
//compile group: "org.slf4j", name: "slf4j-simple", version: "1.7.21"
implementation 'org.slf4j:slf4j-simple:1.7.+'
implementation 'com.sparkjava:spark-core:2.5.+'
implementation group: 'com.twilio.sdk', name: 'twilio', version: '8.11.0'
//implementation 'com.twilio.sdk:twilio:7.+'
// implementation 'com.twilio.sdk', name: 'twilio', version: '8.11.0'
//runtimeOnly group: 'com.twilio.sdk', name: 'twilio', version: '8.11.0'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
Error code in Terminal:
SmsSender.java:3: error: package com.twilio does not exist
import com.twilio.Twilio;
^
SmsSender.java:4: error: package com.twilio.rest.api.v2010.account does not exist
import com.twilio.rest.api.v2010.account.Message;
^
SmsSender.java:5: error: package com.twilio.type does not exist
import com.twilio.type.PhoneNumber;
^
SmsSender.java:12: error: cannot find symbol
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
^
symbol: variable Twilio
location: class SmsSender
SmsSender.java:13: error: cannot find symbol
Message message = Message.creator(
^
symbol: class Message
location: class SmsSender
SmsSender.java:14: error: cannot find symbol
new PhoneNumber("..."),
^
symbol: class PhoneNumber
location: class SmsSender
SmsSender.java:15: error: cannot find symbol
new PhoneNumber("..."),
^
symbol: class PhoneNumber
location: class SmsSender
SmsSender.java:13: error: cannot find symbol
Message message = Message.creator(
^
symbol: variable Message
location: class SmsSender
SmsSender.java:24: error: cannot find symbol
Message message = Message.creator(
^
symbol: class Message
location: class SmsSender
SmsSender.java:25: error: cannot find symbol
new PhoneNumber(n),
^
symbol: class PhoneNumber
location: class SmsSender
SmsSender.java:26: error: cannot find symbol
new PhoneNumber("..."),
^
symbol: class PhoneNumber
location: class SmsSender
SmsSender.java:24: error: cannot find symbol
Message message = Message.creator(
^
symbol: variable Message
location: class SmsSender
12 errors
error: compilation failed
I don't see any problem with your project setup. You can compare it to this reference project.
So, I suspect the problem you're seeing is related to how Eclipse imports Gradle projects. I'm not a regular Eclipse user but I did try it out for this question. When I imported the project in the above repo I saw import errors similar to yours. I was able to fix them by first telling Eclipse that this is a Gradle project (Project context menu > Configure > Add Gradle Nature) then refreshing the project (Project context menu > Gradle > Refresh Gradle Project). I got those steps from this answer. Then everything was working.

"java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7" error when I try to run a REST Assured test class

I have JDK 1.8 installed and below is the class I run in Eclipse:
import io.restassured.RestAssured;
import static org.hamcrest.Matchers.equalTo;
import static io.restassured.RestAssured.given;
public class test {
public static void main(String[] args) {
RestAssured.baseURI = "https://jsonplaceholder.typicode.com";
given()
.queryParam("posts", "1")
.body("")
.when()
.get()
.then()
.assertThat().statusCode(200)
.body("userId", equalTo(2));
}
}
I get the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7
at org.codehaus.groovy.vmplugin.VMPluginFactory.<clinit>(VMPluginFactory.java:43)
at org.codehaus.groovy.reflection.GroovyClassValueFactory.<clinit>(GroovyClassValueFactory.java:35)
at org.codehaus.groovy.reflection.ClassInfo.<clinit>(ClassInfo.java:107)
at org.codehaus.groovy.reflection.ReflectionCache.getCachedClass(ReflectionCache.java:95)
at org.codehaus.groovy.reflection.ReflectionCache.<clinit>(ReflectionCache.java:39)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:209)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:107)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache
at org.codehaus.groovy.runtime.dgmimpl.NumberNumberMetaMethod.<clinit>(NumberNumberMetaMethod.java:33)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:350)
at java.base/java.lang.Class.newInstance(Class.java:645)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.createMetaMethodFromClass(MetaClassRegistryImpl.java:257)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:110)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:85)
at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:86)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createMap(ScriptBytecodeAdapter.java:635)
at io.restassured.internal.ResponseParserRegistrar.<init>(ResponseParserRegistrar.groovy)
at io.restassured.RestAssured.<clinit>(RestAssured.java:346)
at test.main(test.java:12)
Run mvn dependency:tree to view the whole dependency tree. You check if you see a problem here.
And try upgrading the maven-plugin version.

JAX-RS not responding at all (404)

I'm using Eclipse 2020-03, Gradle and Tomcat. all I did follows.
Installing gradle through eclipse marketplace.
making gradle project.
adding those on build.gradle dependencies
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:28.2-jre'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.27'
compile group: 'org.glassfish.jersey.inject', name: 'jersey-hk2', version: '2.27'
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359'
compile group: 'org.glassfish.jersey.media', name: 'jersey-media-json-jackson', version: '2.27'
}
adding "rest" package on src/main/java
adding ApplicationConfig.java and RestApiService.java on rest package.
ApplicationConfig.java
package rest;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
#ApplicationPath("/api")
public class ApplicationConfig extends Application {
#Override
public Map<String, Object> getProperties(){
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("jersey.config.server.provider.packages", "A_UnivG.rest");
return properties;
}
}
RestApiService.java
package rest;
import java.util.logging.Logger;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import Data.*;
#Path("/Data")
public class RestApiService {
Logger logger = Logger.getLogger("RestApiService");
IntegrationDAO dao = new IntegrationDAO();
#GET
#Path("hello")
#Produces(MediaType.TEXT_PLAIN)
public String getHello() {return "Hello";}
}
and when I try to request http://localhost:portnumber/A_UnivG/api/Data/hello it spits out only 404 error.
cannot figure out why.
My project works with plain jsp files. I have a JSP page which uses DAO Read but it works just fine. well, that shouldn't be a problem I just tried hello world and it doesn't work at all.

Cannot find module "rxjs/observable" on build. IONIC

I am working on an ionic app that is using AngularFire2. But when I push up the code to ionic i get a build error:
ionic-app-scripts build
[22:28:07] typescript: src/providers/sermon/sermon.ts, line: 4
Cannot find module 'rxjs/observable'.
L3: import { AngularFirestore, AngularFirestoreCollection} from 'angularfire2/firestore';
L4: import { Observable } from 'rxjs/observable';
[22:28:07] ionic-app-script task: "build"
[22:28:07] Error: Failed to transpile program
Error: Failed to transpile program
I don't know what is going on... Could someone point me in the right direction for this?
This is a simple typo mistake, pls replace that,
import { Observable } from 'rxjs/Observable'; // 'O' is capital in 'rxjs/Observable'
With the new RxJs 6 it would be
import { Observable } from 'rxjs/Rx';

clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_33_g$(...).style_86_g$ is not a function

Well, all of a sudden everything seems to be broken. I can't recall what I changed. I cleaned the whole project, I checked out an older version of it, I removed all code-server compiled files, restarted Eclipse etc. but I am getting the following error here:
Caused by: com.google.gwt.core.client.JavaScriptException: (TypeError) : this.get_clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_17_g$(...).style_48_g$ is not a function
ConsoleLogger.java:32 TypeError: this.get_clientBundleFieldNameUnlikelyToCollideWithUserSpecifiedFieldOkay_17_g$(...).style_48_g$ is not a function
at Jmg_g$ [as build_style_17_g$] (HomeView_BinderImpl.java:74)
at Dmg_g$ (HomeView_BinderImpl.java:43)
at ymg_g$ [as createAndBindUi_17_g$] (HomeView_BinderImpl.java:31)
at zmg_g$ [as createAndBindUi_0_g$] (HomeView_BinderImpl.java:28)
at tmg_g$ (HomeView.java:20)
at qng_g$ [as com$mz$client$application$admin$home$HomeView_com$mz$client$application$admin$home$HomeView_methodInjection_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:116)
at xng_g$ [as get_Key$type$com$mz$client$application$admin$home$HomeView$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:106)
at ung_g$ [as get_Key$type$com$mz$client$application$admin$home$HomePresenter$MyView$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:30)
at vng_g$ [as get_Key$type$com$mz$client$application$admin$home$HomePresenter$_annotation$$none$$_0_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:57)
at Gng_g$ [as get_27_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:78)
at Hng_g$ [as get_21_g$] (com_gwtplatform_mvp_client_DesktopGinjector_DesktopGinjectorGinjector_fragment.java:77)
at I5f_g$ [as get_16_g$] (StandardProvider.java:47)
at b7d_g$ [as getPresenter_0_g$] (ProxyImpl.java:44)
at lag_g$ [as handleRequest_0_g$] (ProxyPlaceAbstract.java:263)
at xag_g$ [as onPlaceRequest_0_g$] (ProxyPlaceAbstract.java:201)
at L6d_g$ [as dispatch_54_g$] (PlaceRequestInternalEvent.java:130)
at K6d_g$ [as dispatch_1_g$] (PlaceRequestInternalEvent.java:129)
at W6b_g$ [as dispatch_0_g$] (GwtEvent.java:76)
at Ngc_g$ (EventBus.java:40)
at rhc_g$ [as doFire_0_g$] (SimpleEventBus.java:193)
at yhc_g$ [as fireEventFromSource_0_g$] (SimpleEventBus.java:96)
at x4d_g$ [as fireEvent_1_g$] (PlaceManagerImpl.java:158)
at v4d_g$ [as doRevealPlace_0_g$] (PlaceManagerImpl.java:133)
at R4d_g$ [as revealPlace_1_g$] (PlaceManagerImpl.java:354)
at Q4d_g$ [as revealPlace_0_g$] (PlaceManagerImpl.java:335)
at Jxg_g$ [as redirectToLoggedOnPage_0_g$] (LoginPresenter.java:169)
at Mug_g$ [as loggedInAndInitialized_0_g$] (LoginPresenter.java:125)
at Vug_g$ [as done_1_g$] (LoginPresenter.java:115)
at Wce_g$ [as onChildRequestFailure_0_g$] (ParallelRequest.java:144)
at Xce_g$ [as onChildRequestSuccess_0_g$] (ParallelRequest.java:120)
at gde_g$ [as onSuccess_0_g$] (Request.java:68)
at Lfd_g$ [as onResponseReceived_0_g$] (RequestCallbackAdapter.java:232)
at pjc_g$ [as fireOnResponseReceived_0_g$] (Request.java:250)
at xkc_g$ [as onReadyStateChange_0_g$] (RequestBuilder.java:412)
at XMLHttpRequest.<anonymous> (XMLHttpRequest.java:329)
at DI_g$ (Impl.java:233)
at GI_g$ (Impl.java:285)
at XMLHttpRequest.<anonymous> (Impl.java:71)
It is happening now after I login and reveal the home place which looks like this:
private void revealAdminHomePlace() {
this.placeManager.revealPlace(new PlaceRequest.Builder()
.nameToken(AdminNameTokens.home)
.build());
}
Here is the HomeModule:
public class HomeModule extends AbstractPresenterModule {
#Override
protected void configure() {
this.bindPresenter(HomePresenter.class, HomePresenter.MyView.class,
HomeView.class, HomePresenter.MyProxy.class);
}
}
The HomePresenter
public class HomePresenter extends Presenter<HomePresenter.MyView, HomePresenter.MyProxy> {
private final static Logger LOGGER = Logger.getLogger(HomePresenter.class.getName());
public interface MyView extends View {
}
#ProxyStandard
#NameToken(AdminNameTokens.home)
public interface MyProxy extends ProxyPlace<HomePresenter> {
}
#Inject
public HomePresenter(EventBus eventBus, MyView view, MyProxy proxy) {
super(eventBus, view, proxy, AdminToolPresenter.SLOT_AdminToolMainContent);
}
#Override
protected void onReveal() {
LOGGER.fine("HomePresenter.onReveal()");
super.onReveal();
}
}
The HomeView:
public class HomeView extends ViewImpl implements HomePresenter.MyView {
public interface Binder extends UiBinder<Widget, HomeView> {
}
#Inject
public HomeView(Binder uiBinder) {
this.initWidget(uiBinder.createAndBindUi(this));
}
}
As well as the HomeView.ui.xml file:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:m="urn:import:gwt.material.design.client.ui"
xmlns:m.addins="urn:import:gwt.material.design.addins.client.ui">
<ui:style>
</ui:style>
<g:HTMLPanel>
<m:MaterialLabel text="Welcome home!"/>
</g:HTMLPanel>
</ui:UiBinder>
I have no idea what is wrong here and I can't seem to figure out the problem. I have absolutely no clue what this is all of a sudden..
In my case this seemed to have been caused by including some modern CSS in the widget's ui:style... No idea how that caused the error but I suspect the offending line is this: grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));. Once I put this piece of styling in a normal CSS file everything worked.
Just make sure you have enabled
<generateJsInteropExports>true</generateJsInteropExports>
when using gwt-maven-plugin.
I ran into this as well, turned out my browser was still having SuperDev mode turned on and I had recompiled the whole project.
Turning SuperDev mode off, and the issue was gone.
Yes this error was caused by <ui:style> element.
You may need just clear cache of codeserver under SuperDevMode by clicking on "clean" Button.